@kensio/yulin 1.21.4 → 1.21.6
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/cdk/assets/sim-cdk-assets-publisher.d.ts +18 -13
- package/dist/service/cloudformation/cdk/assets/sim-cdk-assets-publisher.js +16 -24
- package/dist/service/cloudformation/cdk/sim-cdk-cloud-assembly.factory.d.ts +12 -0
- package/dist/service/cloudformation/cdk/sim-cdk-cloud-assembly.factory.js +16 -7
- package/dist/service/cloudformation/command/create-stack/create-stack.handler.d.ts +3 -0
- package/dist/service/cloudformation/command/create-stack/create-stack.handler.js +4 -1
- package/dist/service/cloudformation/command/update-stack/update-stack.handler.d.ts +6 -0
- package/dist/service/cloudformation/command/update-stack/update-stack.handler.js +7 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-deployer.js +2 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-options-deployed.d.ts +10 -0
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-options-deployed.js +14 -0
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-plan.d.ts +11 -1
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-plan.js +3 -2
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.d.ts +5 -8
- package/dist/service/cloudformation/deploy/sim-cfn-cdk-out-stack-options.js +0 -14
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +9 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js +2 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts +10 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.js +2 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-updater.js +1 -0
- 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/cloudformation/stack/sim-cfn-stack-deploy-context.d.ts +47 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack-deploy-context.js +46 -0
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts +9 -19
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.js +12 -26
- package/dist/service/cloudformation/stack/sim-cfn-stack.js +2 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.type.d.ts +14 -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/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/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/s3/bucket/sim-s3-bucket-maker.d.ts +31 -0
- package/dist/service/s3/bucket/sim-s3-bucket-maker.js +41 -0
- package/dist/service/s3/command/create-bucket/create-bucket.handler.d.ts +2 -2
- package/dist/service/s3/command/create-bucket/create-bucket.handler.js +4 -12
- package/dist/service/s3/sim-s3-commands.d.ts +6 -0
- package/dist/service/s3/sim-s3-commands.js +7 -0
- package/dist/service/s3/sim-s3.d.ts +16 -0
- package/dist/service/s3/sim-s3.js +25 -0
- package/docs/services/cloudformation/README.md +144 -25
- package/docs/services/cloudfront/README.md +109 -0
- package/docs/services/dynamodb/README.md +128 -8
- package/docs/services/iam/README.md +125 -2
- package/docs/services/route53/README.md +11 -0
- package/package.json +2 -2
- package/dist/service/iam/cfn/sim-cfn-iam-optional-string.js +0 -17
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SimCfnResourceCreator } from "./sim-cfn-resource-creator.js";
|
|
2
2
|
import { simCfnInertResourceReason } from "../inert/sim-cfn-inert-resource.js";
|
|
3
3
|
import { isSimCfnUnsupportedResourceError } from "../unsupported/sim-cfn-unsupported-resource.js";
|
|
4
|
+
import { simCfnSkippedPhysicalName } from "../unsupported/sim-cfn-named-skip.js";
|
|
4
5
|
/**
|
|
5
6
|
* Runs the asynchronous CloudFormation Resource creation lifecycle.
|
|
6
7
|
*
|
|
@@ -63,8 +64,13 @@ export class SimCfnResourceCreateOperation {
|
|
|
63
64
|
* a gap and is skipped, unless nothing this simulator models could have told
|
|
64
65
|
* it apart from one that was created, in which case saying it is missing
|
|
65
66
|
* sends a reader after something that is not lost.
|
|
67
|
+
*
|
|
68
|
+
* Either way the Resource keeps whatever name the refusal carried. A
|
|
69
|
+
* template reading a Ref of it then gets the name real CloudFormation would
|
|
70
|
+
* have produced.
|
|
66
71
|
*/
|
|
67
72
|
recordUncreated(error, context) {
|
|
73
|
+
this.resource.recordUncreatedPhysicalName(simCfnSkippedPhysicalName(error));
|
|
68
74
|
const inertReason = simCfnInertResourceReason(this.resource, context.resources);
|
|
69
75
|
if (inertReason !== undefined) {
|
|
70
76
|
this.resource.markCreateInert(inertReason);
|
|
@@ -18,6 +18,7 @@ import type { SimCfnResourceResolveContext, SimCloudFormationResourceProperties
|
|
|
18
18
|
* be calling.
|
|
19
19
|
*/
|
|
20
20
|
export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgnorer {
|
|
21
|
+
#private;
|
|
21
22
|
readonly accountRegionScope: SimAwsAccountRegionScope;
|
|
22
23
|
readonly logicalId: string;
|
|
23
24
|
/** The Stack this Resource belongs to, where a generated name comes from. */
|
|
@@ -32,6 +33,14 @@ export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgno
|
|
|
32
33
|
* The simulated AWS object created for this CloudFormation Resource.
|
|
33
34
|
*/
|
|
34
35
|
abstract get simResource(): object | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The name real CloudFormation would have given this Resource, where a
|
|
38
|
+
* service worked it out before refusing to create it.
|
|
39
|
+
*
|
|
40
|
+
* A Resource with a name behind it answers Ref with that name. The
|
|
41
|
+
* logical-ID stand-in is left for a Resource nothing ever named.
|
|
42
|
+
*/
|
|
43
|
+
get uncreatedPhysicalName(): string | undefined;
|
|
35
44
|
/**
|
|
36
45
|
* The properties this Resource was created without acting on.
|
|
37
46
|
*/
|
|
@@ -97,6 +106,12 @@ export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgno
|
|
|
97
106
|
* only thing that knows whether a property changes behaviour it simulates.
|
|
98
107
|
*/
|
|
99
108
|
ignoreProperty(path: string, reason: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Record the name a service worked out for this Resource before refusing to
|
|
111
|
+
* create it. Called by the creation operation, which is where a refusal
|
|
112
|
+
* carrying a name is read.
|
|
113
|
+
*/
|
|
114
|
+
recordUncreatedPhysicalName(physicalName: string | undefined): void;
|
|
100
115
|
/**
|
|
101
116
|
* The value returned when this Resource is referenced via Fn::GetAtt.
|
|
102
117
|
*
|
|
@@ -132,5 +147,9 @@ export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgno
|
|
|
132
147
|
* again.
|
|
133
148
|
*/
|
|
134
149
|
protected clearIgnoredProperties(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Forget the name a refusal recorded, for a Resource being created again.
|
|
152
|
+
*/
|
|
153
|
+
protected clearUncreatedPhysicalName(): void;
|
|
135
154
|
private cfnValueAdapter;
|
|
136
155
|
}
|
|
@@ -25,6 +25,7 @@ export class SimCfnResourceRecord {
|
|
|
25
25
|
/** The Stack this Resource belongs to, where a generated name comes from. */
|
|
26
26
|
stackName;
|
|
27
27
|
template;
|
|
28
|
+
#uncreatedPhysicalName;
|
|
28
29
|
ignoredPropertyList = new SimCfnIgnoredProperties();
|
|
29
30
|
resourceTemplateReader;
|
|
30
31
|
propertyResolver;
|
|
@@ -54,6 +55,16 @@ export class SimCfnResourceRecord {
|
|
|
54
55
|
});
|
|
55
56
|
this.resourceLogicalIds = resourceLogicalIds;
|
|
56
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* The name real CloudFormation would have given this Resource, where a
|
|
60
|
+
* service worked it out before refusing to create it.
|
|
61
|
+
*
|
|
62
|
+
* A Resource with a name behind it answers Ref with that name. The
|
|
63
|
+
* logical-ID stand-in is left for a Resource nothing ever named.
|
|
64
|
+
*/
|
|
65
|
+
get uncreatedPhysicalName() {
|
|
66
|
+
return this.#uncreatedPhysicalName;
|
|
67
|
+
}
|
|
57
68
|
/**
|
|
58
69
|
* The properties this Resource was created without acting on.
|
|
59
70
|
*/
|
|
@@ -140,6 +151,14 @@ export class SimCfnResourceRecord {
|
|
|
140
151
|
ignoreProperty(path, reason) {
|
|
141
152
|
this.ignoredPropertyList.record(this, path, reason);
|
|
142
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Record the name a service worked out for this Resource before refusing to
|
|
156
|
+
* create it. Called by the creation operation, which is where a refusal
|
|
157
|
+
* carrying a name is read.
|
|
158
|
+
*/
|
|
159
|
+
recordUncreatedPhysicalName(physicalName) {
|
|
160
|
+
this.#uncreatedPhysicalName = physicalName;
|
|
161
|
+
}
|
|
143
162
|
/**
|
|
144
163
|
* The value returned when this Resource is referenced via Fn::GetAtt.
|
|
145
164
|
*
|
|
@@ -183,11 +202,18 @@ export class SimCfnResourceRecord {
|
|
|
183
202
|
clearIgnoredProperties() {
|
|
184
203
|
this.ignoredPropertyList.clear();
|
|
185
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Forget the name a refusal recorded, for a Resource being created again.
|
|
207
|
+
*/
|
|
208
|
+
clearUncreatedPhysicalName() {
|
|
209
|
+
this.#uncreatedPhysicalName = undefined;
|
|
210
|
+
}
|
|
186
211
|
cfnValueAdapter() {
|
|
187
212
|
return simCfnResourceValueAdapter({
|
|
188
213
|
logicalId: this.logicalId,
|
|
189
214
|
type: this.type,
|
|
190
215
|
simResource: this.simResource,
|
|
216
|
+
uncreatedPhysicalName: this.uncreatedPhysicalName,
|
|
191
217
|
});
|
|
192
218
|
}
|
|
193
219
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A refusal from a service that had already worked out the name real
|
|
3
|
+
* CloudFormation would give the Resource.
|
|
4
|
+
*
|
|
5
|
+
* The logical ID a skipped Resource answers `Ref` with stands in for a value
|
|
6
|
+
* the simulation does not hold. Where a service names a Resource before
|
|
7
|
+
* refusing it, the simulation does hold one, so raising this carries the name
|
|
8
|
+
* through the refusal and the Resource answers `Ref` with it. Sim Lambda
|
|
9
|
+
* declining a function on its Runtime is the case that needs it: CDK writes a
|
|
10
|
+
* log group name as `/aws/lambda/` joined to a `Ref` of the function, and a
|
|
11
|
+
* logical ID there produces a log group under a name no account would hold.
|
|
12
|
+
*
|
|
13
|
+
* Nothing else about the refusal changes. The message still decides whether
|
|
14
|
+
* the Stack records a skip or fails. A service raising this says "Unsupported
|
|
15
|
+
* sim ... CloudFormation" as it would in an ordinary Error.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SimCfnNamedSkip extends Error {
|
|
18
|
+
readonly physicalName: string;
|
|
19
|
+
readonly name = "SimCfnNamedSkip";
|
|
20
|
+
constructor(message: string, physicalName: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The name a refusal carries, or nothing where the service had not named the
|
|
24
|
+
* Resource before refusing it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function simCfnSkippedPhysicalName(error: unknown): string | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A refusal from a service that had already worked out the name real
|
|
3
|
+
* CloudFormation would give the Resource.
|
|
4
|
+
*
|
|
5
|
+
* The logical ID a skipped Resource answers `Ref` with stands in for a value
|
|
6
|
+
* the simulation does not hold. Where a service names a Resource before
|
|
7
|
+
* refusing it, the simulation does hold one, so raising this carries the name
|
|
8
|
+
* through the refusal and the Resource answers `Ref` with it. Sim Lambda
|
|
9
|
+
* declining a function on its Runtime is the case that needs it: CDK writes a
|
|
10
|
+
* log group name as `/aws/lambda/` joined to a `Ref` of the function, and a
|
|
11
|
+
* logical ID there produces a log group under a name no account would hold.
|
|
12
|
+
*
|
|
13
|
+
* Nothing else about the refusal changes. The message still decides whether
|
|
14
|
+
* the Stack records a skip or fails. A service raising this says "Unsupported
|
|
15
|
+
* sim ... CloudFormation" as it would in an ordinary Error.
|
|
16
|
+
*/
|
|
17
|
+
export class SimCfnNamedSkip extends Error {
|
|
18
|
+
physicalName;
|
|
19
|
+
name = "SimCfnNamedSkip";
|
|
20
|
+
constructor(message, physicalName) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.physicalName = physicalName;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The name a refusal carries, or nothing where the service had not named the
|
|
27
|
+
* Resource before refusing it.
|
|
28
|
+
*/
|
|
29
|
+
export function simCfnSkippedPhysicalName(error) {
|
|
30
|
+
return error instanceof SimCfnNamedSkip ? error.physicalName : undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SimAwsCaller } from "../../aws/caller/sim-aws-caller.js";
|
|
2
|
+
import type { SimCdkOutContext } from "../cdk/sim-cdk-out-context.js";
|
|
3
|
+
/**
|
|
4
|
+
* What an update can replace on a Stack's deploy context. Anything it leaves
|
|
5
|
+
* out, the Stack goes on using.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimCfnStackUpdateContext {
|
|
8
|
+
readonly cdkOutContext?: SimCdkOutContext | undefined;
|
|
9
|
+
readonly caller?: SimAwsCaller | undefined;
|
|
10
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* What a Stack is deploying from, and who it is deploying as.
|
|
14
|
+
*
|
|
15
|
+
* These three travel together and are the only things an update replaces, so
|
|
16
|
+
* they are held apart from the rest of a Stack's Resource operations. An
|
|
17
|
+
* operation reads them here whenever it runs, rather than closing over the
|
|
18
|
+
* values the deployment started with.
|
|
19
|
+
*/
|
|
20
|
+
export declare class SimCfnStackDeployContext {
|
|
21
|
+
/** The CDK cloud assembly the Stack's template was synthesized into. */
|
|
22
|
+
cdkOutContext: SimCdkOutContext | undefined;
|
|
23
|
+
/** The principal the Stack's Resource work is authorized as. */
|
|
24
|
+
caller: SimAwsCaller | undefined;
|
|
25
|
+
/** The principal the Stack's CDK file assets are published as. */
|
|
26
|
+
assetsCaller: SimAwsCaller | undefined;
|
|
27
|
+
constructor(properties: SimCfnStackUpdateContext);
|
|
28
|
+
/**
|
|
29
|
+
* Take on what an update brings with it, for this and every later operation.
|
|
30
|
+
*
|
|
31
|
+
* A synthesis writes the template and the assets manifest beside it together,
|
|
32
|
+
* so a Stack updated from a re-synthesized template needs the manifest that
|
|
33
|
+
* came with it. Keeping the one the Stack was deployed from would look up the
|
|
34
|
+
* asset a replaced Resource names in a manifest written before it existed.
|
|
35
|
+
*
|
|
36
|
+
* An update naming a caller runs as that one, and the Stack is torn down as
|
|
37
|
+
* it afterwards. An update that names none keeps the deployment's caller, so
|
|
38
|
+
* a Stack updated from a plain template path goes on running as whoever
|
|
39
|
+
* deployed it.
|
|
40
|
+
*/
|
|
41
|
+
useUpdate(properties: SimCfnStackUpdateContext): void;
|
|
42
|
+
/**
|
|
43
|
+
* The principal file assets are published as, which is the deployment's own
|
|
44
|
+
* caller unless the deployment named one for publishing.
|
|
45
|
+
*/
|
|
46
|
+
publishingCaller(): SimAwsCaller | undefined;
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Stack is deploying from, and who it is deploying as.
|
|
3
|
+
*
|
|
4
|
+
* These three travel together and are the only things an update replaces, so
|
|
5
|
+
* they are held apart from the rest of a Stack's Resource operations. An
|
|
6
|
+
* operation reads them here whenever it runs, rather than closing over the
|
|
7
|
+
* values the deployment started with.
|
|
8
|
+
*/
|
|
9
|
+
export class SimCfnStackDeployContext {
|
|
10
|
+
/** The CDK cloud assembly the Stack's template was synthesized into. */
|
|
11
|
+
cdkOutContext;
|
|
12
|
+
/** The principal the Stack's Resource work is authorized as. */
|
|
13
|
+
caller;
|
|
14
|
+
/** The principal the Stack's CDK file assets are published as. */
|
|
15
|
+
assetsCaller;
|
|
16
|
+
constructor(properties) {
|
|
17
|
+
this.cdkOutContext = properties.cdkOutContext;
|
|
18
|
+
this.caller = properties.caller;
|
|
19
|
+
this.assetsCaller = properties.assetsCaller;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Take on what an update brings with it, for this and every later operation.
|
|
23
|
+
*
|
|
24
|
+
* A synthesis writes the template and the assets manifest beside it together,
|
|
25
|
+
* so a Stack updated from a re-synthesized template needs the manifest that
|
|
26
|
+
* came with it. Keeping the one the Stack was deployed from would look up the
|
|
27
|
+
* asset a replaced Resource names in a manifest written before it existed.
|
|
28
|
+
*
|
|
29
|
+
* An update naming a caller runs as that one, and the Stack is torn down as
|
|
30
|
+
* it afterwards. An update that names none keeps the deployment's caller, so
|
|
31
|
+
* a Stack updated from a plain template path goes on running as whoever
|
|
32
|
+
* deployed it.
|
|
33
|
+
*/
|
|
34
|
+
useUpdate(properties) {
|
|
35
|
+
this.cdkOutContext = properties.cdkOutContext ?? this.cdkOutContext;
|
|
36
|
+
this.caller = properties.caller ?? this.caller;
|
|
37
|
+
this.assetsCaller = properties.assetsCaller ?? this.assetsCaller;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The principal file assets are published as, which is the deployment's own
|
|
41
|
+
* caller unless the deployment named one for publishing.
|
|
42
|
+
*/
|
|
43
|
+
publishingCaller() {
|
|
44
|
+
return this.assetsCaller ?? this.caller;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { SimAwsCaller } from "../../aws/caller/sim-aws-caller.js";
|
|
|
4
4
|
import type { SimAwsAccountRegionScope } from "../../aws/sim-aws-account-region-scope.js";
|
|
5
5
|
import type { SimCfnBinding } from "../bind/sim-cfn-binding.js";
|
|
6
6
|
import type { SimCdkOutContext } from "../cdk/sim-cdk-out-context.js";
|
|
7
|
+
import { type SimCfnStackUpdateContext } from "./sim-cfn-stack-deploy-context.js";
|
|
7
8
|
import type { SimCfnResource } from "../resource/sim-cfn-resource.js";
|
|
8
9
|
import { SimCfnResourceRetention } from "../resource/delete/sim-cfn-resource-retention.js";
|
|
9
10
|
import type { SimCfnTemplate } from "../template/sim-cfn-template.js";
|
|
@@ -28,6 +29,11 @@ interface SimCfnStackResourceOperationsProperties {
|
|
|
28
29
|
* caller leaves each service to decide the request as the Account root.
|
|
29
30
|
*/
|
|
30
31
|
readonly caller?: SimAwsCaller | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The principal the Stack's CDK file assets are published as, where that is
|
|
34
|
+
* somebody other than the caller its Resources are created as.
|
|
35
|
+
*/
|
|
36
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
31
37
|
/**
|
|
32
38
|
* The order Resources with no dependency between them are started in.
|
|
33
39
|
*/
|
|
@@ -52,8 +58,7 @@ export declare class SimCfnStackResourceOperations {
|
|
|
52
58
|
private readonly stackName;
|
|
53
59
|
private readonly bindings;
|
|
54
60
|
private readonly resourceOrder;
|
|
55
|
-
private
|
|
56
|
-
private caller;
|
|
61
|
+
private readonly context;
|
|
57
62
|
/**
|
|
58
63
|
* Resources an update kept in simulated AWS.
|
|
59
64
|
*
|
|
@@ -64,23 +69,8 @@ export declare class SimCfnStackResourceOperations {
|
|
|
64
69
|
*/
|
|
65
70
|
private readonly retainedByUpdates;
|
|
66
71
|
constructor(properties: SimCfnStackResourceOperationsProperties);
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
* A synthesis writes the template and the assets manifest beside it together,
|
|
71
|
-
* so a Stack updated from a re-synthesized template needs the manifest that
|
|
72
|
-
* came with it. Keeping the one the Stack was deployed from would look up the
|
|
73
|
-
* asset a replaced Resource names in a manifest written before it existed.
|
|
74
|
-
*
|
|
75
|
-
* An update naming a caller runs as that one, and the Stack is torn down as
|
|
76
|
-
* it afterwards. An update that names none keeps the deployment's caller, so
|
|
77
|
-
* a Stack updated from a plain template path goes on running as whoever
|
|
78
|
-
* deployed it.
|
|
79
|
-
*/
|
|
80
|
-
useUpdate(properties: {
|
|
81
|
-
readonly cdkOutContext?: SimCdkOutContext | undefined;
|
|
82
|
-
readonly caller?: SimAwsCaller | undefined;
|
|
83
|
-
}): void;
|
|
72
|
+
/** Take on what an update brings with it, for every later operation. */
|
|
73
|
+
useUpdate(properties: SimCfnStackUpdateContext): void;
|
|
84
74
|
/**
|
|
85
75
|
* Create every Resource in the given Stack Resource map.
|
|
86
76
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SimCfnStackDeployContext, } from "./sim-cfn-stack-deploy-context.js";
|
|
1
2
|
import { SimCdkAssetsPublisher } from "../cdk/assets/sim-cdk-assets-publisher.js";
|
|
2
3
|
import { SimCfnResourceRetention } from "../resource/delete/sim-cfn-resource-retention.js";
|
|
3
4
|
import { simCfnStackRetainedLogicalIds } from "./teardown/sim-cfn-stack-retained-logical-ids.js";
|
|
@@ -24,8 +25,7 @@ export class SimCfnStackResourceOperations {
|
|
|
24
25
|
stackName;
|
|
25
26
|
bindings;
|
|
26
27
|
resourceOrder;
|
|
27
|
-
|
|
28
|
-
caller;
|
|
28
|
+
context;
|
|
29
29
|
/**
|
|
30
30
|
* Resources an update kept in simulated AWS.
|
|
31
31
|
*
|
|
@@ -36,31 +36,17 @@ export class SimCfnStackResourceOperations {
|
|
|
36
36
|
*/
|
|
37
37
|
retainedByUpdates = [];
|
|
38
38
|
constructor(properties) {
|
|
39
|
-
const { simAws, accountRegionScope, stackName,
|
|
39
|
+
const { simAws, accountRegionScope, stackName, bindings, resourceOrder } = properties;
|
|
40
40
|
this.simAws = simAws;
|
|
41
41
|
this.accountRegionScope = accountRegionScope;
|
|
42
42
|
this.stackName = stackName;
|
|
43
|
-
this.cdkOutContext = cdkOutContext;
|
|
44
43
|
this.bindings = bindings;
|
|
45
|
-
this.caller = caller;
|
|
46
44
|
this.resourceOrder = resourceOrder;
|
|
45
|
+
this.context = new SimCfnStackDeployContext(properties);
|
|
47
46
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Take on what an update brings with it, for this and every later operation.
|
|
50
|
-
*
|
|
51
|
-
* A synthesis writes the template and the assets manifest beside it together,
|
|
52
|
-
* so a Stack updated from a re-synthesized template needs the manifest that
|
|
53
|
-
* came with it. Keeping the one the Stack was deployed from would look up the
|
|
54
|
-
* asset a replaced Resource names in a manifest written before it existed.
|
|
55
|
-
*
|
|
56
|
-
* An update naming a caller runs as that one, and the Stack is torn down as
|
|
57
|
-
* it afterwards. An update that names none keeps the deployment's caller, so
|
|
58
|
-
* a Stack updated from a plain template path goes on running as whoever
|
|
59
|
-
* deployed it.
|
|
60
|
-
*/
|
|
47
|
+
/** Take on what an update brings with it, for every later operation. */
|
|
61
48
|
useUpdate(properties) {
|
|
62
|
-
this.
|
|
63
|
-
this.caller = properties.caller ?? this.caller;
|
|
49
|
+
this.context.useUpdate(properties);
|
|
64
50
|
}
|
|
65
51
|
/**
|
|
66
52
|
* Create every Resource in the given Stack Resource map.
|
|
@@ -120,7 +106,7 @@ export class SimCfnStackResourceOperations {
|
|
|
120
106
|
simAws: this.simAws,
|
|
121
107
|
currentResources,
|
|
122
108
|
updatedResources,
|
|
123
|
-
caller: this.caller,
|
|
109
|
+
caller: this.context.caller,
|
|
124
110
|
});
|
|
125
111
|
}));
|
|
126
112
|
}
|
|
@@ -173,8 +159,8 @@ export class SimCfnStackResourceOperations {
|
|
|
173
159
|
simAws: this.simAws,
|
|
174
160
|
accountRegionScope: this.accountRegionScope,
|
|
175
161
|
stackName: this.stackName,
|
|
176
|
-
cdkOutContext: this.cdkOutContext,
|
|
177
|
-
|
|
162
|
+
cdkOutContext: this.context.cdkOutContext,
|
|
163
|
+
assetsCaller: this.context.publishingCaller(),
|
|
178
164
|
}).publish();
|
|
179
165
|
}
|
|
180
166
|
creator(resources) {
|
|
@@ -182,9 +168,9 @@ export class SimCfnStackResourceOperations {
|
|
|
182
168
|
simAws: this.simAws,
|
|
183
169
|
resources,
|
|
184
170
|
stackName: this.stackName,
|
|
185
|
-
cdkOutContext: this.cdkOutContext,
|
|
171
|
+
cdkOutContext: this.context.cdkOutContext,
|
|
186
172
|
bindings: this.bindings,
|
|
187
|
-
caller: this.caller,
|
|
173
|
+
caller: this.context.caller,
|
|
188
174
|
resourceOrder: this.resourceOrder,
|
|
189
175
|
});
|
|
190
176
|
}
|
|
@@ -193,7 +179,7 @@ export class SimCfnStackResourceOperations {
|
|
|
193
179
|
simAws: this.simAws,
|
|
194
180
|
resources,
|
|
195
181
|
stackName: this.stackName,
|
|
196
|
-
caller: this.caller,
|
|
182
|
+
caller: this.context.caller,
|
|
197
183
|
retention,
|
|
198
184
|
});
|
|
199
185
|
}
|
|
@@ -38,7 +38,7 @@ export class SimCfnStack {
|
|
|
38
38
|
stackOutputs;
|
|
39
39
|
cfnTemplate;
|
|
40
40
|
constructor(properties) {
|
|
41
|
-
const { simAws, accountRegionScope, background, stackName, stackId, template, cdkOutContext, bindings, caller, resourceOrder, exports, } = properties;
|
|
41
|
+
const { simAws, accountRegionScope, background, stackName, stackId, template, cdkOutContext, bindings, caller, assetsCaller, resourceOrder, exports, } = properties;
|
|
42
42
|
this.background = background;
|
|
43
43
|
this.stackName = stackName;
|
|
44
44
|
this.stackId = stackId;
|
|
@@ -61,6 +61,7 @@ export class SimCfnStack {
|
|
|
61
61
|
cdkOutContext,
|
|
62
62
|
bindings,
|
|
63
63
|
caller,
|
|
64
|
+
assetsCaller,
|
|
64
65
|
resourceOrder,
|
|
65
66
|
});
|
|
66
67
|
this.lifecycle = new SimCfnStackDeploymentLifecycle({
|
|
@@ -24,6 +24,11 @@ export interface SimCfnStackUpdateProperties {
|
|
|
24
24
|
* The Stack goes on using it, as it does the cloud assembly.
|
|
25
25
|
*/
|
|
26
26
|
readonly caller?: SimAwsCaller | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The principal to publish the re-synthesized file assets as, for an update
|
|
29
|
+
* that names one. The Stack goes on using it too.
|
|
30
|
+
*/
|
|
31
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
27
32
|
}
|
|
28
33
|
export interface SimCloudFormationStackProperties {
|
|
29
34
|
readonly simAws: SimAws;
|
|
@@ -44,6 +49,15 @@ export interface SimCloudFormationStackProperties {
|
|
|
44
49
|
* simulation.
|
|
45
50
|
*/
|
|
46
51
|
readonly caller?: SimAwsCaller | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* The principal the CDK file assets staged beside the template are published
|
|
54
|
+
* as.
|
|
55
|
+
*
|
|
56
|
+
* A real `cdk deploy` publishes them as the file publishing Role and only
|
|
57
|
+
* then processes the template as the execution Role, which is why the two
|
|
58
|
+
* are named apart. Left out, assets are published as `caller`.
|
|
59
|
+
*/
|
|
60
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
47
61
|
/**
|
|
48
62
|
* The order this Stack starts Resources with no dependency between them in.
|
|
49
63
|
* The template's own order unless the deployment asked for another one.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
|
|
1
2
|
import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
|
|
2
3
|
import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
|
|
3
4
|
import type { SimCloudFront } from "../../sim-cloudfront.js";
|
|
@@ -10,15 +11,17 @@ interface SimCfnCfCachePolicyCreatorProperties {
|
|
|
10
11
|
* Resources.
|
|
11
12
|
*/
|
|
12
13
|
export declare class SimCfnCfCachePolicyCreator {
|
|
14
|
+
private static readonly createAction;
|
|
15
|
+
private static readonly deleteAction;
|
|
13
16
|
private readonly cloudFront;
|
|
14
17
|
constructor(properties: SimCfnCfCachePolicyCreatorProperties);
|
|
15
18
|
/**
|
|
16
19
|
* Create and store the policy one Resource describes.
|
|
17
20
|
*/
|
|
18
|
-
create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontCachePolicy;
|
|
21
|
+
create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontCachePolicy;
|
|
19
22
|
/**
|
|
20
23
|
* Remove a policy created from a Resource.
|
|
21
24
|
*/
|
|
22
|
-
delete(resource: SimCfnResource): void;
|
|
25
|
+
delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
|
|
23
26
|
}
|
|
24
27
|
export {};
|
|
@@ -4,6 +4,8 @@ import { SimCfnCfCachePolicyConfig } from "./sim-cfn-cf-cache-policy-config.js";
|
|
|
4
4
|
* Resources.
|
|
5
5
|
*/
|
|
6
6
|
export class SimCfnCfCachePolicyCreator {
|
|
7
|
+
static createAction = "cloudfront:CreateCachePolicy";
|
|
8
|
+
static deleteAction = "cloudfront:DeleteCachePolicy";
|
|
7
9
|
cloudFront;
|
|
8
10
|
constructor(properties) {
|
|
9
11
|
this.cloudFront = properties.cloudFront;
|
|
@@ -11,7 +13,10 @@ export class SimCfnCfCachePolicyCreator {
|
|
|
11
13
|
/**
|
|
12
14
|
* Create and store the policy one Resource describes.
|
|
13
15
|
*/
|
|
14
|
-
create(resource, properties) {
|
|
16
|
+
create(resource, properties, options) {
|
|
17
|
+
this.cloudFront
|
|
18
|
+
.cfnAuthorizer()
|
|
19
|
+
.authorizeAny(SimCfnCfCachePolicyCreator.createAction, options);
|
|
15
20
|
const policy = new SimCfnCfCachePolicyConfig({
|
|
16
21
|
resource,
|
|
17
22
|
properties,
|
|
@@ -22,11 +27,14 @@ export class SimCfnCfCachePolicyCreator {
|
|
|
22
27
|
/**
|
|
23
28
|
* Remove a policy created from a Resource.
|
|
24
29
|
*/
|
|
25
|
-
delete(resource) {
|
|
30
|
+
delete(resource, options) {
|
|
26
31
|
const policy = resource.simResource;
|
|
27
32
|
if (policy === undefined) {
|
|
28
33
|
return;
|
|
29
34
|
}
|
|
35
|
+
this.cloudFront
|
|
36
|
+
.cfnAuthorizer()
|
|
37
|
+
.authorizeResource(SimCfnCfCachePolicyCreator.deleteAction, `cache-policy/${policy.id}`, options);
|
|
30
38
|
this.cloudFront.removeCachePolicy(policy.id);
|
|
31
39
|
}
|
|
32
40
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
|
|
1
2
|
import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
|
|
2
3
|
import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
|
|
3
4
|
import type { SimCloudFront } from "../../sim-cloudfront.js";
|
|
@@ -10,15 +11,17 @@ interface SimCfnCfOriginAccessControlCreatorProperties {
|
|
|
10
11
|
* AWS::CloudFront::OriginAccessControl Resources.
|
|
11
12
|
*/
|
|
12
13
|
export declare class SimCfnCfOriginAccessControlCreator {
|
|
14
|
+
private static readonly createAction;
|
|
15
|
+
private static readonly deleteAction;
|
|
13
16
|
private readonly cloudFront;
|
|
14
17
|
constructor(properties: SimCfnCfOriginAccessControlCreatorProperties);
|
|
15
18
|
/**
|
|
16
19
|
* Create and store the origin access control one Resource describes.
|
|
17
20
|
*/
|
|
18
|
-
create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontOriginAccessControl;
|
|
21
|
+
create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontOriginAccessControl;
|
|
19
22
|
/**
|
|
20
23
|
* Remove an origin access control created from a Resource.
|
|
21
24
|
*/
|
|
22
|
-
delete(resource: SimCfnResource): void;
|
|
25
|
+
delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
|
|
23
26
|
}
|
|
24
27
|
export {};
|
|
@@ -4,6 +4,8 @@ import { SimCfnCfOriginAccessControlConfig } from "./sim-cfn-cf-oac-config.js";
|
|
|
4
4
|
* AWS::CloudFront::OriginAccessControl Resources.
|
|
5
5
|
*/
|
|
6
6
|
export class SimCfnCfOriginAccessControlCreator {
|
|
7
|
+
static createAction = "cloudfront:CreateOriginAccessControl";
|
|
8
|
+
static deleteAction = "cloudfront:DeleteOriginAccessControl";
|
|
7
9
|
cloudFront;
|
|
8
10
|
constructor(properties) {
|
|
9
11
|
this.cloudFront = properties.cloudFront;
|
|
@@ -11,7 +13,10 @@ export class SimCfnCfOriginAccessControlCreator {
|
|
|
11
13
|
/**
|
|
12
14
|
* Create and store the origin access control one Resource describes.
|
|
13
15
|
*/
|
|
14
|
-
create(resource, properties) {
|
|
16
|
+
create(resource, properties, options) {
|
|
17
|
+
this.cloudFront
|
|
18
|
+
.cfnAuthorizer()
|
|
19
|
+
.authorizeAny(SimCfnCfOriginAccessControlCreator.createAction, options);
|
|
15
20
|
const originAccessControl = new SimCfnCfOriginAccessControlConfig({
|
|
16
21
|
resource,
|
|
17
22
|
properties,
|
|
@@ -22,11 +27,14 @@ export class SimCfnCfOriginAccessControlCreator {
|
|
|
22
27
|
/**
|
|
23
28
|
* Remove an origin access control created from a Resource.
|
|
24
29
|
*/
|
|
25
|
-
delete(resource) {
|
|
30
|
+
delete(resource, options) {
|
|
26
31
|
const originAccessControl = resource.simResource;
|
|
27
32
|
if (originAccessControl === undefined) {
|
|
28
33
|
return;
|
|
29
34
|
}
|
|
35
|
+
this.cloudFront
|
|
36
|
+
.cfnAuthorizer()
|
|
37
|
+
.authorizeResource(SimCfnCfOriginAccessControlCreator.deleteAction, `origin-access-control/${originAccessControl.id}`, options);
|
|
30
38
|
this.cloudFront.removeOriginAccessControl(originAccessControl.id);
|
|
31
39
|
}
|
|
32
40
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
|
|
1
2
|
import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
|
|
2
3
|
import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
|
|
3
4
|
import type { SimCloudFront } from "../../sim-cloudfront.js";
|
|
@@ -10,15 +11,17 @@ interface SimCfnCfOriginRequestPolicyCreatorProperties {
|
|
|
10
11
|
* AWS::CloudFront::OriginRequestPolicy Resources.
|
|
11
12
|
*/
|
|
12
13
|
export declare class SimCfnCfOriginRequestPolicyCreator {
|
|
14
|
+
private static readonly createAction;
|
|
15
|
+
private static readonly deleteAction;
|
|
13
16
|
private readonly cloudFront;
|
|
14
17
|
constructor(properties: SimCfnCfOriginRequestPolicyCreatorProperties);
|
|
15
18
|
/**
|
|
16
19
|
* Create and store the policy one Resource describes.
|
|
17
20
|
*/
|
|
18
|
-
create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontOriginRequestPolicy;
|
|
21
|
+
create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontOriginRequestPolicy;
|
|
19
22
|
/**
|
|
20
23
|
* Remove a policy created from a Resource.
|
|
21
24
|
*/
|
|
22
|
-
delete(resource: SimCfnResource): void;
|
|
25
|
+
delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
|
|
23
26
|
}
|
|
24
27
|
export {};
|