@kensio/yulin 1.21.5 → 1.21.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/service/cloudformation/resource/cfn/sim-cfn-default-resource-value-adapter.d.ts +8 -1
- package/dist/service/cloudformation/resource/cfn/sim-cfn-default-resource-value-adapter.js +9 -2
- package/dist/service/cloudformation/resource/cfn/sim-cfn-resource-value-adapter.d.ts +6 -1
- package/dist/service/cloudformation/resource/cfn/sim-cfn-resource-value-adapter.js +2 -1
- package/dist/service/cloudformation/resource/create/sim-cfn-resource-create-operation.d.ts +4 -0
- package/dist/service/cloudformation/resource/create/sim-cfn-resource-create-operation.js +6 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource-record.d.ts +19 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource-record.js +26 -0
- package/dist/service/cloudformation/resource/sim-cfn-resource.js +1 -0
- package/dist/service/cloudformation/resource/unsupported/sim-cfn-named-skip.d.ts +26 -0
- package/dist/service/cloudformation/resource/unsupported/sim-cfn-named-skip.js +31 -0
- package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.d.ts +5 -2
- package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.js +10 -2
- package/dist/service/cloudfront/cfn/origin-access-control/sim-cfn-cf-oac-creator.d.ts +5 -2
- package/dist/service/cloudfront/cfn/origin-access-control/sim-cfn-cf-oac-creator.js +10 -2
- package/dist/service/cloudfront/cfn/origin-request-policy/sim-cfn-cf-orp-creator.d.ts +5 -2
- package/dist/service/cloudfront/cfn/origin-request-policy/sim-cfn-cf-orp-creator.js +10 -2
- package/dist/service/cloudfront/cfn/policy/sim-cfn-cf-policy-creators.d.ts +33 -0
- package/dist/service/cloudfront/cfn/policy/sim-cfn-cf-policy-creators.js +39 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-creator.d.ts +5 -2
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-creator.js +10 -2
- package/dist/service/cloudfront/cfn/sim-cfn-cf-authorizer.d.ts +40 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cf-authorizer.js +50 -0
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.d.ts +1 -4
- package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.js +14 -46
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +6 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.js +7 -0
- package/dist/service/cloudfront/sim-cloudfront.d.ts +6 -0
- package/dist/service/cloudfront/sim-cloudfront.js +7 -0
- package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.d.ts +8 -0
- package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.js +62 -0
- package/dist/service/dynamodb/document/sim-dynamodb-document-routes.d.ts +1 -1
- package/dist/service/dynamodb/document/sim-dynamodb-document-routes.js +3 -1
- package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-creator.js +1 -0
- package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.d.ts +4 -0
- package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.js +26 -1
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-creator.js +3 -1
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.d.ts +0 -7
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.js +0 -20
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.d.ts +13 -0
- package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.js +59 -0
- package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.d.ts +1 -1
- package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.js +1 -1
- package/dist/service/iam/authorize/sim-iam-action-authorizer.d.ts +8 -3
- package/dist/service/iam/authorize/sim-iam-action-authorizer.js +13 -4
- package/dist/service/iam/cfn/role/sim-cfn-iam-role-creator.js +1 -0
- package/dist/service/iam/cfn/role/sim-cfn-iam-role-properties-parser.d.ts +1 -0
- package/dist/service/iam/cfn/role/sim-cfn-iam-role-properties-parser.js +21 -14
- package/dist/service/iam/cfn/{sim-cfn-iam-optional-string.d.ts → sim-cfn-iam-property.d.ts} +10 -2
- package/dist/service/iam/cfn/sim-cfn-iam-property.js +31 -0
- package/dist/service/iam/cfn/user/sim-cfn-iam-user-properties-parser.js +1 -1
- package/dist/service/iam/command/role/create-role/create-role-record-factory.js +3 -0
- package/dist/service/iam/command/role/create-role/create-role.command.d.ts +10 -0
- package/dist/service/iam/command/role/get-role/get-role.command.d.ts +2 -0
- package/dist/service/iam/command/role/get-role/get-role.handler.js +2 -0
- package/dist/service/iam/command/role/sim-iam-role-command-handlers.js +15 -1
- package/dist/service/iam/role/sim-iam-role-boundary.d.ts +24 -0
- package/dist/service/iam/role/sim-iam-role-boundary.js +24 -0
- package/dist/service/iam/role/sim-iam-role-with-policy.factory.d.ts +1 -0
- package/dist/service/iam/role/sim-iam-role.d.ts +10 -0
- package/dist/service/iam/serve/sim-iam-query-entity.d.ts +6 -1
- package/dist/service/iam/serve/sim-iam-query-entity.js +10 -4
- package/dist/service/iam/serve/sim-iam-query-role-operations.js +15 -3
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-properties.js +1 -1
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.d.ts +3 -2
- package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.js +25 -3
- package/dist/service/lambda/cfn/function/sim-cfn-lambda-runtime-skip.d.ts +6 -0
- package/dist/service/lambda/cfn/function/sim-cfn-lambda-runtime-skip.js +9 -2
- package/dist/service/route53/command/create-hosted-zone/sim-route53-zone-id.js +23 -1
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-creator.js +1 -0
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.d.ts +9 -4
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.js +18 -6
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.d.ts +10 -0
- package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.js +16 -1
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-creator.js +1 -1
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.d.ts +11 -6
- package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.js +18 -9
- package/docs/README.md +33 -4
- package/docs/ai-skill/README.md +52 -54
- package/docs/cli/README.md +84 -94
- package/docs/factories/README.md +42 -54
- package/docs/lint/README.md +41 -67
- package/docs/non-aws-dependencies/README.md +72 -168
- package/docs/sdk/README.md +97 -98
- package/docs/serve/README.md +192 -898
- package/docs/services/cloudformation/README.md +88 -23
- package/docs/services/cloudfront/README.md +109 -0
- package/docs/services/dynamodb/README.md +128 -8
- package/docs/services/eventbridge/README.md +10 -2
- package/docs/services/iam/README.md +125 -2
- package/docs/services/lambda/README.md +7 -1
- package/docs/services/route53/README.md +11 -0
- package/docs/services/sns/README.md +13 -7
- package/docs/services/ssm/README.md +6 -4
- package/docs/terraform/README.md +108 -126
- package/docs/time/README.md +80 -120
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/dist/service/iam/cfn/sim-cfn-iam-optional-string.js +0 -17
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { simCfAuthorize } from "../sim-cf-authorize.js";
|
|
2
|
+
/**
|
|
3
|
+
* Authorizes the CloudFront Resources a template is the only way to make.
|
|
4
|
+
*
|
|
5
|
+
* A cache policy, an origin request policy, a response headers policy and an
|
|
6
|
+
* origin access control have no SDK command here, so their CloudFormation
|
|
7
|
+
* creators reach the stored policy directly rather than through a command that
|
|
8
|
+
* would ask IAM on the way. This is where those creators ask instead, so a
|
|
9
|
+
* deploy Role holding no CloudFront permission is refused the way real
|
|
10
|
+
* CloudFormation refuses it.
|
|
11
|
+
*/
|
|
12
|
+
export class SimCfnCfAuthorizer {
|
|
13
|
+
accountId;
|
|
14
|
+
iam;
|
|
15
|
+
constructor(properties) {
|
|
16
|
+
this.accountId = properties.accountId;
|
|
17
|
+
this.iam = properties.iam;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Ensure the caller may take an action that names nothing yet.
|
|
21
|
+
*
|
|
22
|
+
* A create action has no ID to authorize against until it succeeds, and
|
|
23
|
+
* CloudFront offers no resource-level permission for one, so a policy
|
|
24
|
+
* granting it writes `*` and that is what it is decided against.
|
|
25
|
+
*/
|
|
26
|
+
authorizeAny(action, options) {
|
|
27
|
+
simCfAuthorize({
|
|
28
|
+
iam: this.iam,
|
|
29
|
+
action,
|
|
30
|
+
resource: "*",
|
|
31
|
+
caller: options?.caller,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Ensure the caller may take an action on the CloudFront resource a path
|
|
36
|
+
* names, such as `cache-policy/8f1a2b3c`.
|
|
37
|
+
*
|
|
38
|
+
* A delete names the thing it is deleting, so a policy can grant deleting
|
|
39
|
+
* one cache policy without granting deleting every cache policy in the
|
|
40
|
+
* Account.
|
|
41
|
+
*/
|
|
42
|
+
authorizeResource(action, resourcePath, options) {
|
|
43
|
+
simCfAuthorize({
|
|
44
|
+
iam: this.iam,
|
|
45
|
+
action,
|
|
46
|
+
resource: `arn:aws:cloudfront::${this.accountId}:${resourcePath}`,
|
|
47
|
+
caller: options?.caller,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -8,10 +8,7 @@ export declare class SimCloudFrontCloudFormationResourceFactory implements SimCf
|
|
|
8
8
|
private readonly distroCreator;
|
|
9
9
|
private readonly functionCreator;
|
|
10
10
|
private readonly distroDeleter;
|
|
11
|
-
private readonly
|
|
12
|
-
private readonly cachePolicyCreator;
|
|
13
|
-
private readonly originRequestPolicyCreator;
|
|
14
|
-
private readonly originAccessControlCreator;
|
|
11
|
+
private readonly policyCreators;
|
|
15
12
|
private readonly keyValueStoreCreator;
|
|
16
13
|
constructor(cloudFront: SimCloudFront);
|
|
17
14
|
/**
|
|
@@ -2,10 +2,7 @@ import { simCfnResourceCallerOptions } from "../../cloudformation/resource/calle
|
|
|
2
2
|
import { SimCfnCfDistroCreator } from "./distro/sim-cfn-cf-distro-creator.js";
|
|
3
3
|
import { SimCfnCffCreator } from "./cff/sim-cfn-cff-creator.js";
|
|
4
4
|
import { SimCfnCfDistroDeleter } from "./distro/sim-cfn-cf-distro-deleter.js";
|
|
5
|
-
import {
|
|
6
|
-
import { SimCfnCfCachePolicyCreator } from "./cache-policy/sim-cfn-cf-cache-policy-creator.js";
|
|
7
|
-
import { SimCfnCfOriginRequestPolicyCreator } from "./origin-request-policy/sim-cfn-cf-orp-creator.js";
|
|
8
|
-
import { SimCfnCfOriginAccessControlCreator } from "./origin-access-control/sim-cfn-cf-oac-creator.js";
|
|
5
|
+
import { SimCfnCfPolicyCreators } from "./policy/sim-cfn-cf-policy-creators.js";
|
|
9
6
|
import { SimCfnCfKeyValueStoreCreator } from "./key-value-store/sim-cfn-cf-kvs-creator.js";
|
|
10
7
|
/**
|
|
11
8
|
* CloudFormation Resource factory for simulated CloudFront resources.
|
|
@@ -14,24 +11,13 @@ export class SimCloudFrontCloudFormationResourceFactory {
|
|
|
14
11
|
distroCreator;
|
|
15
12
|
functionCreator;
|
|
16
13
|
distroDeleter;
|
|
17
|
-
|
|
18
|
-
cachePolicyCreator;
|
|
19
|
-
originRequestPolicyCreator;
|
|
20
|
-
originAccessControlCreator;
|
|
14
|
+
policyCreators;
|
|
21
15
|
keyValueStoreCreator;
|
|
22
16
|
constructor(cloudFront) {
|
|
23
17
|
this.distroCreator = new SimCfnCfDistroCreator({ cloudFront });
|
|
24
18
|
this.functionCreator = new SimCfnCffCreator({ cloudFront });
|
|
25
19
|
this.distroDeleter = new SimCfnCfDistroDeleter({ cloudFront });
|
|
26
|
-
this.
|
|
27
|
-
new SimCfnCfResponseHeadersPolicyCreator({ cloudFront });
|
|
28
|
-
this.cachePolicyCreator = new SimCfnCfCachePolicyCreator({ cloudFront });
|
|
29
|
-
this.originRequestPolicyCreator = new SimCfnCfOriginRequestPolicyCreator({
|
|
30
|
-
cloudFront,
|
|
31
|
-
});
|
|
32
|
-
this.originAccessControlCreator = new SimCfnCfOriginAccessControlCreator({
|
|
33
|
-
cloudFront,
|
|
34
|
-
});
|
|
20
|
+
this.policyCreators = new SimCfnCfPolicyCreators(cloudFront);
|
|
35
21
|
this.keyValueStoreCreator = new SimCfnCfKeyValueStoreCreator({
|
|
36
22
|
cloudFront,
|
|
37
23
|
});
|
|
@@ -41,6 +27,11 @@ export class SimCloudFrontCloudFormationResourceFactory {
|
|
|
41
27
|
*/
|
|
42
28
|
async create(resourceTypeName, resource, context) {
|
|
43
29
|
const properties = context.resolvedProperties ?? resource.properties;
|
|
30
|
+
const options = simCfnResourceCallerOptions(context.caller);
|
|
31
|
+
const policyCreator = this.policyCreators.creatorFor(resourceTypeName);
|
|
32
|
+
if (policyCreator !== undefined) {
|
|
33
|
+
return policyCreator.create(resource, properties, options);
|
|
34
|
+
}
|
|
44
35
|
switch (resourceTypeName) {
|
|
45
36
|
case "Distribution": {
|
|
46
37
|
return await this.distroCreator.create(resource, properties, context);
|
|
@@ -48,20 +39,8 @@ export class SimCloudFrontCloudFormationResourceFactory {
|
|
|
48
39
|
case "Function": {
|
|
49
40
|
return await this.functionCreator.create(resource, properties, context);
|
|
50
41
|
}
|
|
51
|
-
case "ResponseHeadersPolicy": {
|
|
52
|
-
return this.responseHeadersPolicyCreator.create(resource, properties);
|
|
53
|
-
}
|
|
54
|
-
case "CachePolicy": {
|
|
55
|
-
return this.cachePolicyCreator.create(resource, properties);
|
|
56
|
-
}
|
|
57
|
-
case "OriginRequestPolicy": {
|
|
58
|
-
return this.originRequestPolicyCreator.create(resource, properties);
|
|
59
|
-
}
|
|
60
|
-
case "OriginAccessControl": {
|
|
61
|
-
return this.originAccessControlCreator.create(resource, properties);
|
|
62
|
-
}
|
|
63
42
|
case "KeyValueStore": {
|
|
64
|
-
return await this.keyValueStoreCreator.create(resource, properties,
|
|
43
|
+
return await this.keyValueStoreCreator.create(resource, properties, options);
|
|
65
44
|
}
|
|
66
45
|
default: {
|
|
67
46
|
throw new Error(`Unsupported sim CloudFront CloudFormation Resource ${resourceTypeName}`);
|
|
@@ -74,6 +53,11 @@ export class SimCloudFrontCloudFormationResourceFactory {
|
|
|
74
53
|
*/
|
|
75
54
|
async delete(resourceTypeName, resource, context) {
|
|
76
55
|
const options = simCfnResourceCallerOptions(context.caller);
|
|
56
|
+
const policyCreator = this.policyCreators.creatorFor(resourceTypeName);
|
|
57
|
+
if (policyCreator !== undefined) {
|
|
58
|
+
policyCreator.delete(resource, options);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
77
61
|
switch (resourceTypeName) {
|
|
78
62
|
case "Distribution": {
|
|
79
63
|
await this.distroDeleter.delete(resource, options);
|
|
@@ -83,22 +67,6 @@ export class SimCloudFrontCloudFormationResourceFactory {
|
|
|
83
67
|
await this.functionCreator.delete(resource, options);
|
|
84
68
|
return;
|
|
85
69
|
}
|
|
86
|
-
case "ResponseHeadersPolicy": {
|
|
87
|
-
this.responseHeadersPolicyCreator.delete(resource);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
case "CachePolicy": {
|
|
91
|
-
this.cachePolicyCreator.delete(resource);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
case "OriginRequestPolicy": {
|
|
95
|
-
this.originRequestPolicyCreator.delete(resource);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
case "OriginAccessControl": {
|
|
99
|
-
this.originAccessControlCreator.delete(resource);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
70
|
case "KeyValueStore": {
|
|
103
71
|
await this.keyValueStoreCreator.delete(resource, options);
|
|
104
72
|
return;
|
|
@@ -23,6 +23,7 @@ import { SimCfKeyValueStoreCommands } from "./key-value-store/sim-cf-key-value-s
|
|
|
23
23
|
import { SimCloudFrontKeyValueStoreApi } from "./sim-cloudfront-key-value-store.js";
|
|
24
24
|
import { SimCfFunctionCommands } from "./cff/sim-cf-function-commands.js";
|
|
25
25
|
import { SimCfInvalidationCommands } from "./command/invalidation/sim-cf-invalidation-commands.js";
|
|
26
|
+
import { SimCfnCfAuthorizer } from "./cfn/sim-cfn-cf-authorizer.js";
|
|
26
27
|
/**
|
|
27
28
|
* How one simulated CloudFront is put together.
|
|
28
29
|
*/
|
|
@@ -92,6 +93,11 @@ export declare class SimCloudFrontCommands {
|
|
|
92
93
|
* The invalidation commands, and the Distributions they clear.
|
|
93
94
|
*/
|
|
94
95
|
readonly invalidations: SimCfInvalidationCommands;
|
|
96
|
+
/**
|
|
97
|
+
* How the CloudFormation Resource factory authorizes the Resources it
|
|
98
|
+
* creates without a command of their own.
|
|
99
|
+
*/
|
|
100
|
+
readonly cfnAuthorizer: SimCfnCfAuthorizer;
|
|
95
101
|
private readonly distributionState;
|
|
96
102
|
private readonly configurationState;
|
|
97
103
|
constructor(properties: SimCloudFrontCommandsProperties);
|
|
@@ -13,6 +13,7 @@ import { SimCloudFrontKeyValueStoreApi } from "./sim-cloudfront-key-value-store.
|
|
|
13
13
|
import { SimCffKeyValueStoreUsers } from "./cff/kvs/sim-cff-key-value-store-users.js";
|
|
14
14
|
import { SimCfFunctionCommands } from "./cff/sim-cf-function-commands.js";
|
|
15
15
|
import { SimCfInvalidationCommands } from "./command/invalidation/sim-cf-invalidation-commands.js";
|
|
16
|
+
import { SimCfnCfAuthorizer } from "./cfn/sim-cfn-cf-authorizer.js";
|
|
16
17
|
/**
|
|
17
18
|
* The commands of one simulated CloudFront, and the state they share.
|
|
18
19
|
*
|
|
@@ -45,6 +46,11 @@ export class SimCloudFrontCommands {
|
|
|
45
46
|
* The invalidation commands, and the Distributions they clear.
|
|
46
47
|
*/
|
|
47
48
|
invalidations;
|
|
49
|
+
/**
|
|
50
|
+
* How the CloudFormation Resource factory authorizes the Resources it
|
|
51
|
+
* creates without a command of their own.
|
|
52
|
+
*/
|
|
53
|
+
cfnAuthorizer;
|
|
48
54
|
distributionState;
|
|
49
55
|
configurationState;
|
|
50
56
|
constructor(properties) {
|
|
@@ -74,6 +80,7 @@ export class SimCloudFrontCommands {
|
|
|
74
80
|
iam,
|
|
75
81
|
background,
|
|
76
82
|
});
|
|
83
|
+
this.cfnAuthorizer = new SimCfnCfAuthorizer({ accountId, iam });
|
|
77
84
|
this.configurationState = {
|
|
78
85
|
s3OriginResolver,
|
|
79
86
|
customOriginDispatcher,
|
|
@@ -2,6 +2,7 @@ import type { SimArn } from "../aws/arn.js";
|
|
|
2
2
|
import type { SimCfnServiceResourceFactory } from "../cloudformation/resource/factory/sim-cfn-resource-factory.type.js";
|
|
3
3
|
import type { SimSdkCommandRouter } from "../../sdk/router/sim-sdk-command-router.type.js";
|
|
4
4
|
import type { SimCloudFrontFunction, SimCloudFrontFunctionName } from "./cff/sim-cloudfront-function.js";
|
|
5
|
+
import type { SimCfnCfAuthorizer } from "./cfn/sim-cfn-cf-authorizer.js";
|
|
5
6
|
import type { SimCreateDistributionCommand, SimCreateDistributionCommandOutput } from "./command/create-distribution/create-distribution.command.js";
|
|
6
7
|
import type { SimCreateFunctionCommand, SimCreateFunctionCommandOutput } from "./command/create-function/create-function.command.js";
|
|
7
8
|
import type { SimDeleteDistributionCommand, SimDeleteDistributionCommandOutput } from "./command/delete-distribution/delete-distribution.command.js";
|
|
@@ -92,6 +93,11 @@ export declare class SimCloudFront extends SimCloudFrontDistributions {
|
|
|
92
93
|
* Get a sim CloudFront Function by name.
|
|
93
94
|
*/
|
|
94
95
|
getCloudFrontFunctionByName(cloudFrontFunctionName: SimCloudFrontFunctionName | string): SimCloudFrontFunction | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* How the CloudFormation Resource factory authorizes a deployment's caller
|
|
98
|
+
* for the Resources it creates without a command of their own.
|
|
99
|
+
*/
|
|
100
|
+
cfnAuthorizer(): SimCfnCfAuthorizer;
|
|
95
101
|
/**
|
|
96
102
|
* Get this service's CloudFormation Resource factory.
|
|
97
103
|
*/
|
|
@@ -129,6 +129,13 @@ export class SimCloudFront extends SimCloudFrontDistributions {
|
|
|
129
129
|
getCloudFrontFunctionByName(cloudFrontFunctionName) {
|
|
130
130
|
return this.cloudFrontFunctions.get(cloudFrontFunctionName);
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* How the CloudFormation Resource factory authorizes a deployment's caller
|
|
134
|
+
* for the Resources it creates without a command of their own.
|
|
135
|
+
*/
|
|
136
|
+
cfnAuthorizer() {
|
|
137
|
+
return this.commands.cfnAuthorizer;
|
|
138
|
+
}
|
|
132
139
|
/**
|
|
133
140
|
* Get this service's CloudFormation Resource factory.
|
|
134
141
|
*/
|
|
@@ -54,4 +54,12 @@ export declare const simDynamoDbDocumentCommandPaths: {
|
|
|
54
54
|
readonly input: SimDynamoDbDocumentPath;
|
|
55
55
|
readonly output: SimDynamoDbDocumentPath;
|
|
56
56
|
};
|
|
57
|
+
readonly transactWrite: {
|
|
58
|
+
readonly input: SimDynamoDbDocumentPath;
|
|
59
|
+
readonly output: SimDynamoDbDocumentPath;
|
|
60
|
+
};
|
|
61
|
+
readonly transactGet: {
|
|
62
|
+
readonly input: SimDynamoDbDocumentPath;
|
|
63
|
+
readonly output: SimDynamoDbDocumentPath;
|
|
64
|
+
};
|
|
57
65
|
};
|
|
@@ -47,6 +47,58 @@ const batchWriteRequests = simDynamoDbDocumentEach(simDynamoDbDocumentEach(batch
|
|
|
47
47
|
* The keys every table is read by in a batch get.
|
|
48
48
|
*/
|
|
49
49
|
const batchGetKeys = simDynamoDbDocumentEach(simDynamoDbDocumentFields({ Keys: valueRecords }));
|
|
50
|
+
/**
|
|
51
|
+
* One action of a transactional write that names an item by its key, which a
|
|
52
|
+
* ConditionCheck, a Delete and an Update all do.
|
|
53
|
+
*/
|
|
54
|
+
const transactWriteKeyed = simDynamoDbDocumentFields({
|
|
55
|
+
Key: simDynamoDbDocumentValues(),
|
|
56
|
+
ExpressionAttributeValues: simDynamoDbDocumentValues(),
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* The Put of a transactional write, which carries a whole item.
|
|
60
|
+
*/
|
|
61
|
+
const transactWritePut = simDynamoDbDocumentFields({
|
|
62
|
+
Item: simDynamoDbDocumentValues(),
|
|
63
|
+
ExpressionAttributeValues: simDynamoDbDocumentValues(),
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* The actions a transactional write applies.
|
|
67
|
+
*
|
|
68
|
+
* An entry carries exactly one of the four, so each is named here and the
|
|
69
|
+
* three the entry left out are left out of the conversion with it. Every
|
|
70
|
+
* action carries its own condition, so its expression values are converted
|
|
71
|
+
* alongside the item they compare against.
|
|
72
|
+
*/
|
|
73
|
+
const transactWriteActions = simDynamoDbDocumentEach(simDynamoDbDocumentFields({
|
|
74
|
+
ConditionCheck: transactWriteKeyed,
|
|
75
|
+
Put: transactWritePut,
|
|
76
|
+
Delete: transactWriteKeyed,
|
|
77
|
+
Update: transactWriteKeyed,
|
|
78
|
+
}));
|
|
79
|
+
/**
|
|
80
|
+
* One Get of a transactional read, which names an item by its key.
|
|
81
|
+
*/
|
|
82
|
+
const transactGet = simDynamoDbDocumentFields({
|
|
83
|
+
Get: simDynamoDbDocumentFields({ Key: simDynamoDbDocumentValues() }),
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* What a transactional read answers with, one entry per Get.
|
|
87
|
+
*/
|
|
88
|
+
const transactGetResponses = simDynamoDbDocumentEach(simDynamoDbDocumentFields({ Item: simDynamoDbDocumentValues() }));
|
|
89
|
+
/**
|
|
90
|
+
* What a transactional write answers with, which is nothing to convert.
|
|
91
|
+
*
|
|
92
|
+
* `ItemCollectionMetrics` is the one place the real document client converts
|
|
93
|
+
* this output, and it is only reported when a request asks for it with
|
|
94
|
+
* `ReturnItemCollectionMetrics`, which simulated DynamoDB refuses.
|
|
95
|
+
*
|
|
96
|
+
* A cancelled transaction is not converted either. `CancellationReasons` reach
|
|
97
|
+
* a caller on a thrown `TransactionCanceledException` rather than in an
|
|
98
|
+
* answer, and the real document client leaves the `Item` of a reason as the
|
|
99
|
+
* descriptors the low-level Command reports.
|
|
100
|
+
*/
|
|
101
|
+
const transactWritten = simDynamoDbDocumentFields({});
|
|
50
102
|
/**
|
|
51
103
|
* Where each supported document Command carries native values.
|
|
52
104
|
*
|
|
@@ -108,4 +160,14 @@ export const simDynamoDbDocumentCommandPaths = {
|
|
|
108
160
|
UnprocessedKeys: batchGetKeys,
|
|
109
161
|
}),
|
|
110
162
|
},
|
|
163
|
+
transactWrite: {
|
|
164
|
+
input: simDynamoDbDocumentFields({ TransactItems: transactWriteActions }),
|
|
165
|
+
output: transactWritten,
|
|
166
|
+
},
|
|
167
|
+
transactGet: {
|
|
168
|
+
input: simDynamoDbDocumentFields({
|
|
169
|
+
TransactItems: simDynamoDbDocumentEach(transactGet),
|
|
170
|
+
}),
|
|
171
|
+
output: simDynamoDbDocumentFields({ Responses: transactGetResponses }),
|
|
172
|
+
},
|
|
111
173
|
};
|
|
@@ -25,7 +25,7 @@ export declare function simDynamoDbDocumentSharedNameRoutes(dynamoDb: SimDynamoD
|
|
|
25
25
|
* so are routed by `simDynamoDbDocumentSharedNameRoutes` instead.
|
|
26
26
|
*
|
|
27
27
|
* An operation with no document route at all, such as a document
|
|
28
|
-
* `
|
|
28
|
+
* `ExecuteStatementCommand`, is refused by name like any other unsupported
|
|
29
29
|
* Command, rather than failing part way through a conversion.
|
|
30
30
|
*/
|
|
31
31
|
export declare function simDynamoDbDocumentRoutes(dynamoDb: SimDynamoDb): readonly (readonly [string, SimSdkCommandRoute])[];
|
|
@@ -43,7 +43,7 @@ export function simDynamoDbDocumentSharedNameRoutes(dynamoDb) {
|
|
|
43
43
|
* so are routed by `simDynamoDbDocumentSharedNameRoutes` instead.
|
|
44
44
|
*
|
|
45
45
|
* An operation with no document route at all, such as a document
|
|
46
|
-
* `
|
|
46
|
+
* `ExecuteStatementCommand`, is refused by name like any other unsupported
|
|
47
47
|
* Command, rather than failing part way through a conversion.
|
|
48
48
|
*/
|
|
49
49
|
export function simDynamoDbDocumentRoutes(dynamoDb) {
|
|
@@ -54,5 +54,7 @@ export function simDynamoDbDocumentRoutes(dynamoDb) {
|
|
|
54
54
|
namedDocumentRoute("UpdateCommand", paths.update, async (input, options) => await dynamoDb.updateItem({ input }, options)),
|
|
55
55
|
namedDocumentRoute("BatchWriteCommand", paths.batchWrite, async (input, options) => await dynamoDb.batchWriteItem({ input }, options)),
|
|
56
56
|
namedDocumentRoute("BatchGetCommand", paths.batchGet, async (input, options) => await dynamoDb.batchGetItem({ input }, options)),
|
|
57
|
+
namedDocumentRoute("TransactWriteCommand", paths.transactWrite, async (input, options) => await dynamoDb.transactWriteItems({ input }, options)),
|
|
58
|
+
namedDocumentRoute("TransactGetCommand", paths.transactGet, async (input, options) => await dynamoDb.transactGetItems({ input }, options)),
|
|
57
59
|
];
|
|
58
60
|
}
|
|
@@ -24,6 +24,7 @@ export class SimCfnEventBusCreator {
|
|
|
24
24
|
properties,
|
|
25
25
|
});
|
|
26
26
|
busProperties.refuseUnsimulated();
|
|
27
|
+
busProperties.recordIgnoredProperties();
|
|
27
28
|
const name = busProperties.name();
|
|
28
29
|
const description = busProperties.description();
|
|
29
30
|
return await simCfnEventBridgeResourceCreation(eventBusResourceType, resource.logicalId, async () => {
|
|
@@ -27,6 +27,10 @@ export declare class SimCfnEventBusProperties {
|
|
|
27
27
|
* Refuse what this simulation does not model, naming the property.
|
|
28
28
|
*/
|
|
29
29
|
refuseUnsimulated(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Record the properties the bus is created without acting on.
|
|
32
|
+
*/
|
|
33
|
+
recordIgnoredProperties(): void;
|
|
30
34
|
private propertyError;
|
|
31
35
|
}
|
|
32
36
|
export {};
|
|
@@ -19,8 +19,23 @@ const unsimulatedProperties = [
|
|
|
19
19
|
["EventSourceName", "partner event buses are not simulated"],
|
|
20
20
|
["KmsKeyIdentifier", "events are not encrypted with a customer managed key"],
|
|
21
21
|
["LogConfig", "event bus logging is not simulated"],
|
|
22
|
-
["Tags", "event bus tags are not simulated"],
|
|
23
22
|
];
|
|
23
|
+
/**
|
|
24
|
+
* What a template can say about an event bus that this simulation has nothing
|
|
25
|
+
* to act on, and why.
|
|
26
|
+
*
|
|
27
|
+
* `Tags` is the whole list, and it is recorded rather than refused. A bus
|
|
28
|
+
* behaves the same way with a tag and without one, and a CDK app calling
|
|
29
|
+
* `Tags.of(app).add(...)` tags every bus in it.
|
|
30
|
+
*/
|
|
31
|
+
const ignoredPropertyReasons = new Map([
|
|
32
|
+
[
|
|
33
|
+
"Tags",
|
|
34
|
+
`${eventBusResourceType} property Tags is not simulated, so the bus is ` +
|
|
35
|
+
"created without them. Nothing reads them back and nothing is grouped " +
|
|
36
|
+
"or billed by them.",
|
|
37
|
+
],
|
|
38
|
+
]);
|
|
24
39
|
/**
|
|
25
40
|
* Reads AWS::Events::EventBus properties into the shape CreateEventBus takes.
|
|
26
41
|
*/
|
|
@@ -71,6 +86,16 @@ export class SimCfnEventBusProperties {
|
|
|
71
86
|
}
|
|
72
87
|
}
|
|
73
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Record the properties the bus is created without acting on.
|
|
91
|
+
*/
|
|
92
|
+
recordIgnoredProperties() {
|
|
93
|
+
for (const [property, reason] of ignoredPropertyReasons) {
|
|
94
|
+
if (this.properties.has(property)) {
|
|
95
|
+
this.resource.ignoreProperty(property, reason);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
74
99
|
propertyError(reason) {
|
|
75
100
|
return simCfnEventBridgeResourceError(eventBusResourceType, this.resource.logicalId, reason);
|
|
76
101
|
}
|
|
@@ -2,6 +2,7 @@ import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
|
2
2
|
import { simCfnEventBridgeResourceCreation } from "../sim-cfn-event-bridge-resource-error.js";
|
|
3
3
|
import { eventRuleResourceType } from "../sim-cfn-event-bridge-resource-types.js";
|
|
4
4
|
import { SimCfnEventRuleProperties } from "./sim-cfn-event-rule-properties.js";
|
|
5
|
+
import { recordIgnoredEventRuleProperties, refuseUnsimulatedEventRuleProperties, } from "./sim-cfn-event-rule-unsimulated-properties.js";
|
|
5
6
|
/**
|
|
6
7
|
* Creates simulated rules from AWS::Events::Rule Resources.
|
|
7
8
|
*
|
|
@@ -27,7 +28,8 @@ export class SimCfnEventRuleCreator {
|
|
|
27
28
|
resource,
|
|
28
29
|
properties,
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
+
refuseUnsimulatedEventRuleProperties(resource, properties);
|
|
32
|
+
recordIgnoredEventRuleProperties(resource, properties);
|
|
31
33
|
const name = ruleProperties.name();
|
|
32
34
|
const busName = ruleProperties.busName();
|
|
33
35
|
const targets = ruleProperties.targets();
|
|
@@ -48,13 +48,6 @@ export declare class SimCfnEventRuleProperties {
|
|
|
48
48
|
* The rule's inline targets.
|
|
49
49
|
*/
|
|
50
50
|
targets(): readonly SimCfnEventRuleTarget[];
|
|
51
|
-
/**
|
|
52
|
-
* Refuse what this simulation does not model, naming the property.
|
|
53
|
-
*
|
|
54
|
-
* Both are asked by key rather than by value, so a template writing `null`
|
|
55
|
-
* for one is refused rather than read as having left it out.
|
|
56
|
-
*/
|
|
57
|
-
refuseUnsimulated(): void;
|
|
58
51
|
private stringProperty;
|
|
59
52
|
private propertyError;
|
|
60
53
|
}
|
|
@@ -89,26 +89,6 @@ export class SimCfnEventRuleProperties {
|
|
|
89
89
|
targets() {
|
|
90
90
|
return simCfnEventRuleTargets(this.properties.get("Targets"), (reason) => this.propertyError(reason));
|
|
91
91
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Refuse what this simulation does not model, naming the property.
|
|
94
|
-
*
|
|
95
|
-
* Both are asked by key rather than by value, so a template writing `null`
|
|
96
|
-
* for one is refused rather than read as having left it out.
|
|
97
|
-
*/
|
|
98
|
-
refuseUnsimulated() {
|
|
99
|
-
if (this.properties.has("RoleArn")) {
|
|
100
|
-
throw this.propertyError("RoleArn is not simulated, so the Resource is refused rather than " +
|
|
101
|
-
"deployed without it: a rule reaches its target as the EventBridge " +
|
|
102
|
-
"service principal, admitted by the target's own resource policy");
|
|
103
|
-
}
|
|
104
|
-
// Rule tags never reach PutRule, which is the one place that would
|
|
105
|
-
// otherwise refuse them, so a tagged rule would deploy and quietly lose
|
|
106
|
-
// its tags.
|
|
107
|
-
if (this.properties.has("Tags")) {
|
|
108
|
-
throw this.propertyError("Tags are not simulated, so the Resource is refused rather than " +
|
|
109
|
-
"deployed without them");
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
92
|
stringProperty(name) {
|
|
113
93
|
const value = this.properties.get(name);
|
|
114
94
|
if (value === undefined) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
|
|
2
|
+
import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
|
|
3
|
+
/**
|
|
4
|
+
* Refuse what this simulation does not model, naming the property.
|
|
5
|
+
*
|
|
6
|
+
* Asked by key rather than by value, so a template writing `null` for one of
|
|
7
|
+
* these is refused rather than read as having left it out.
|
|
8
|
+
*/
|
|
9
|
+
export declare function refuseUnsimulatedEventRuleProperties(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): void;
|
|
10
|
+
/**
|
|
11
|
+
* Record the properties the rule is created without acting on.
|
|
12
|
+
*/
|
|
13
|
+
export declare function recordIgnoredEventRuleProperties(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { simCfnEventBridgeResourceError } from "../sim-cfn-event-bridge-resource-error.js";
|
|
2
|
+
import { eventRuleResourceType } from "../sim-cfn-event-bridge-resource-types.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a template can say about a rule that this simulation does not model,
|
|
5
|
+
* and why each one fails the Resource.
|
|
6
|
+
*
|
|
7
|
+
* `RoleArn` is the whole list. A rule reaches its target as the EventBridge
|
|
8
|
+
* service principal, admitted by the target's own resource policy, so a rule
|
|
9
|
+
* deployed with a role would sit in a test looking as though the role decided
|
|
10
|
+
* something.
|
|
11
|
+
*/
|
|
12
|
+
const refusedPropertyReasons = new Map([
|
|
13
|
+
[
|
|
14
|
+
"RoleArn",
|
|
15
|
+
"RoleArn is not simulated, so the Resource is refused rather than " +
|
|
16
|
+
"deployed without it: a rule reaches its target as the EventBridge " +
|
|
17
|
+
"service principal, admitted by the target's own resource policy",
|
|
18
|
+
],
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* What a template can say about a rule that this simulation has nothing to act
|
|
22
|
+
* on, and why each one is recorded rather than refused.
|
|
23
|
+
*
|
|
24
|
+
* `Tags` is the whole list. Rule tags never reach `PutRule`, so the record is
|
|
25
|
+
* the only place a tagged rule says it lost them. A rule routes the same
|
|
26
|
+
* events with a tag and without one, and a CDK app calling
|
|
27
|
+
* `Tags.of(app).add(...)` tags every rule in it.
|
|
28
|
+
*/
|
|
29
|
+
const ignoredPropertyReasons = new Map([
|
|
30
|
+
[
|
|
31
|
+
"Tags",
|
|
32
|
+
`${eventRuleResourceType} property Tags is not simulated, so the rule is ` +
|
|
33
|
+
"created without them. Nothing reads them back and nothing is grouped " +
|
|
34
|
+
"or billed by them.",
|
|
35
|
+
],
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* Refuse what this simulation does not model, naming the property.
|
|
39
|
+
*
|
|
40
|
+
* Asked by key rather than by value, so a template writing `null` for one of
|
|
41
|
+
* these is refused rather than read as having left it out.
|
|
42
|
+
*/
|
|
43
|
+
export function refuseUnsimulatedEventRuleProperties(resource, properties) {
|
|
44
|
+
for (const [property, reason] of refusedPropertyReasons) {
|
|
45
|
+
if (Object.hasOwn(properties, property)) {
|
|
46
|
+
throw simCfnEventBridgeResourceError(eventRuleResourceType, resource.logicalId, reason);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Record the properties the rule is created without acting on.
|
|
52
|
+
*/
|
|
53
|
+
export function recordIgnoredEventRuleProperties(resource, properties) {
|
|
54
|
+
for (const [property, reason] of ignoredPropertyReasons) {
|
|
55
|
+
if (Object.hasOwn(properties, property)) {
|
|
56
|
+
resource.ignoreProperty(property, reason);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -15,7 +15,7 @@ export declare function simCfnEventBridgeResourceError(resourceType: string, log
|
|
|
15
15
|
* Every Resource type here goes through the ordinary EventBridge commands, so
|
|
16
16
|
* what a template may ask for is decided once, by simulated EventBridge, rather
|
|
17
17
|
* than again in the CloudFormation layer. What that leaves out is where the
|
|
18
|
-
* request came from: a deployment failing with `Rule
|
|
18
|
+
* request came from: a deployment failing with `Rule pattern is not valid`
|
|
19
19
|
* says nothing about which Resource asked for it. Only EventBridge's own errors
|
|
20
20
|
* are renamed, so a refusal the CloudFormation layer decided keeps the wording
|
|
21
21
|
* it was written with.
|
|
@@ -20,7 +20,7 @@ export function simCfnEventBridgeResourceError(resourceType, logicalId, reason,
|
|
|
20
20
|
* Every Resource type here goes through the ordinary EventBridge commands, so
|
|
21
21
|
* what a template may ask for is decided once, by simulated EventBridge, rather
|
|
22
22
|
* than again in the CloudFormation layer. What that leaves out is where the
|
|
23
|
-
* request came from: a deployment failing with `Rule
|
|
23
|
+
* request came from: a deployment failing with `Rule pattern is not valid`
|
|
24
24
|
* says nothing about which Resource asked for it. Only EventBridge's own errors
|
|
25
25
|
* are renamed, so a refusal the CloudFormation layer decided keeps the wording
|
|
26
26
|
* it was written with.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SimAwsCaller } from "../../aws/caller/sim-aws-caller.js";
|
|
2
|
+
import type { SimIamConditionValue } from "../policy/sim-iam-policy.js";
|
|
2
3
|
import type { SimIamInterServiceAuthZ } from "./sim-iam-inter-service-auth-z.js";
|
|
3
4
|
interface SimIamActionAuthorizerProperties {
|
|
4
5
|
readonly iam: SimIamInterServiceAuthZ;
|
|
@@ -9,8 +10,9 @@ interface SimIamActionAuthorizerProperties {
|
|
|
9
10
|
*
|
|
10
11
|
* This shared authorizer suits services whose commands map one-to-one onto an
|
|
11
12
|
* IAM action and resource ARN, such as the IAM and CloudFormation control
|
|
12
|
-
* planes.
|
|
13
|
-
*
|
|
13
|
+
* planes. A command carrying a condition value of its own passes it here.
|
|
14
|
+
* Commands needing more than that, such as a service that hands a Role over,
|
|
15
|
+
* use their own per-command authorizers instead.
|
|
14
16
|
*/
|
|
15
17
|
export declare class SimIamActionAuthorizer {
|
|
16
18
|
private readonly iam;
|
|
@@ -21,7 +23,10 @@ export declare class SimIamActionAuthorizer {
|
|
|
21
23
|
* The caller is passed through unchanged so sim IAM can distinguish an
|
|
22
24
|
* omitted caller, which defaults to Account root, from an explicit
|
|
23
25
|
* anonymous caller, which has no identity policy permissions.
|
|
26
|
+
*
|
|
27
|
+
* Condition values the request itself carries are supplied last, since most
|
|
28
|
+
* commands carry none and read better without an empty record.
|
|
24
29
|
*/
|
|
25
|
-
authorize(action: string, resource: string, caller?: SimAwsCaller): void;
|
|
30
|
+
authorize(action: string, resource: string, caller?: SimAwsCaller, conditionContext?: Readonly<Record<string, SimIamConditionValue>>): void;
|
|
26
31
|
}
|
|
27
32
|
export {};
|
|
@@ -5,8 +5,9 @@ import { SimIamAccessDenied } from "../error/sim-iam.error.js";
|
|
|
5
5
|
*
|
|
6
6
|
* This shared authorizer suits services whose commands map one-to-one onto an
|
|
7
7
|
* IAM action and resource ARN, such as the IAM and CloudFormation control
|
|
8
|
-
* planes.
|
|
9
|
-
*
|
|
8
|
+
* planes. A command carrying a condition value of its own passes it here.
|
|
9
|
+
* Commands needing more than that, such as a service that hands a Role over,
|
|
10
|
+
* use their own per-command authorizers instead.
|
|
10
11
|
*/
|
|
11
12
|
export class SimIamActionAuthorizer {
|
|
12
13
|
iam;
|
|
@@ -19,9 +20,17 @@ export class SimIamActionAuthorizer {
|
|
|
19
20
|
* The caller is passed through unchanged so sim IAM can distinguish an
|
|
20
21
|
* omitted caller, which defaults to Account root, from an explicit
|
|
21
22
|
* anonymous caller, which has no identity policy permissions.
|
|
23
|
+
*
|
|
24
|
+
* Condition values the request itself carries are supplied last, since most
|
|
25
|
+
* commands carry none and read better without an empty record.
|
|
22
26
|
*/
|
|
23
|
-
authorize(action, resource, caller) {
|
|
24
|
-
const decision = this.iam.authorize({
|
|
27
|
+
authorize(action, resource, caller, conditionContext) {
|
|
28
|
+
const decision = this.iam.authorize({
|
|
29
|
+
action,
|
|
30
|
+
resource,
|
|
31
|
+
caller,
|
|
32
|
+
conditionContext,
|
|
33
|
+
});
|
|
25
34
|
if (decision.isDenied) {
|
|
26
35
|
throw new SimIamAccessDenied({
|
|
27
36
|
principal: decision.caller.principal,
|