@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
|
@@ -8,12 +8,16 @@ interface SimCdkAssetsPublisherProperties {
|
|
|
8
8
|
readonly stackName?: string | undefined;
|
|
9
9
|
readonly cdkOutContext?: SimCdkOutContext | undefined;
|
|
10
10
|
/**
|
|
11
|
-
* The principal the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The principal the assets are published as.
|
|
12
|
+
*
|
|
13
|
+
* A real `cdk deploy` publishes assets before CloudFormation sees the
|
|
14
|
+
* template, as the file publishing Role the assets manifest names in each
|
|
15
|
+
* destination's `assumeRoleArn`. CloudFormation then processes the template
|
|
16
|
+
* as the execution Role. A deployment that names an assets caller is what
|
|
17
|
+
* tells the two apart here, and one that names none publishes as whoever
|
|
18
|
+
* deploys.
|
|
15
19
|
*/
|
|
16
|
-
readonly
|
|
20
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* Publishes a CDK cloud assembly's file assets into simulated S3.
|
|
@@ -25,7 +29,7 @@ interface SimCdkAssetsPublisherProperties {
|
|
|
25
29
|
* Lambda function resolves its code through the ordinary sim S3 fetch with no
|
|
26
30
|
* Lambda-specific asset handling.
|
|
27
31
|
*
|
|
28
|
-
* Publishing is byte movement only
|
|
32
|
+
* Publishing is byte movement only. Nothing here runs asset code. Functions
|
|
29
33
|
* sim Lambda cannot run, such as a CDK BucketDeployment provider written in
|
|
30
34
|
* Python, are declined later by the Lambda resource creator on their Runtime.
|
|
31
35
|
*/
|
|
@@ -42,15 +46,16 @@ export declare class SimCdkAssetsPublisher {
|
|
|
42
46
|
publish(): Promise<void>;
|
|
43
47
|
private publishAsset;
|
|
44
48
|
/**
|
|
45
|
-
*
|
|
49
|
+
* Make the staging Bucket if this is the first asset published into it,
|
|
46
50
|
* standing in for the CDK bootstrap stack that provisions it for real.
|
|
47
51
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* The bootstrap stack runs long before the deployment, and neither the file
|
|
53
|
+
* publishing Role nor the execution Role creates this Bucket. It comes
|
|
54
|
+
* through `makeSimBucket` for that reason, which asks IAM nothing. A
|
|
55
|
+
* deployment scoped to the permissions its real execution Role holds would
|
|
56
|
+
* otherwise be refused `s3:CreateBucket` before creating a Resource.
|
|
57
|
+
*
|
|
58
|
+
* A name already taken in another scope is a real failure, and is reported.
|
|
54
59
|
*/
|
|
55
60
|
private ensureBucket;
|
|
56
61
|
private stagingS3;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SimCfnPseudoParameters } from "../../parameters/pseudo/sim-cfn-pseudo-parameters.js";
|
|
2
2
|
import { SimCdkAssetPublications, } from "./sim-cdk-asset-publications.js";
|
|
3
3
|
import { readSimCdkAssetBytes } from "./sim-cdk-asset-bytes.js";
|
|
4
|
-
import { simCfnResourceCallerOptions
|
|
4
|
+
import { simCfnResourceCallerOptions } from "../../resource/caller/sim-cfn-resource-caller-options.js";
|
|
5
5
|
/**
|
|
6
6
|
* Publishes a CDK cloud assembly's file assets into simulated S3.
|
|
7
7
|
*
|
|
@@ -12,7 +12,7 @@ import { simCfnResourceCallerOptions, } from "../../resource/caller/sim-cfn-reso
|
|
|
12
12
|
* Lambda function resolves its code through the ordinary sim S3 fetch with no
|
|
13
13
|
* Lambda-specific asset handling.
|
|
14
14
|
*
|
|
15
|
-
* Publishing is byte movement only
|
|
15
|
+
* Publishing is byte movement only. Nothing here runs asset code. Functions
|
|
16
16
|
* sim Lambda cannot run, such as a CDK BucketDeployment provider written in
|
|
17
17
|
* Python, are declined later by the Lambda resource creator on their Runtime.
|
|
18
18
|
*/
|
|
@@ -42,7 +42,7 @@ export class SimCdkAssetsPublisher {
|
|
|
42
42
|
}),
|
|
43
43
|
}).resolve(cdkOutContext.assetsManifest);
|
|
44
44
|
for (const publication of publications) {
|
|
45
|
-
// oxlint-disable-next-line no-await-in-loop --
|
|
45
|
+
// oxlint-disable-next-line no-await-in-loop -- published in manifest order, as cdk-assets publishes them
|
|
46
46
|
await this.publishAsset(publication);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -52,38 +52,30 @@ export class SimCdkAssetsPublisher {
|
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
const s3 = this.stagingS3();
|
|
55
|
-
|
|
56
|
-
await this.ensureBucket(s3, publication.bucketName, options);
|
|
55
|
+
this.ensureBucket(s3, publication.bucketName);
|
|
57
56
|
await s3.putObject({
|
|
58
57
|
input: {
|
|
59
58
|
Bucket: publication.bucketName,
|
|
60
59
|
Key: publication.objectKey,
|
|
61
60
|
Body: assetBytes,
|
|
62
61
|
},
|
|
63
|
-
},
|
|
62
|
+
}, simCfnResourceCallerOptions(this.properties.assetsCaller));
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
|
-
*
|
|
65
|
+
* Make the staging Bucket if this is the first asset published into it,
|
|
67
66
|
* standing in for the CDK bootstrap stack that provisions it for real.
|
|
68
67
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
68
|
+
* The bootstrap stack runs long before the deployment, and neither the file
|
|
69
|
+
* publishing Role nor the execution Role creates this Bucket. It comes
|
|
70
|
+
* through `makeSimBucket` for that reason, which asks IAM nothing. A
|
|
71
|
+
* deployment scoped to the permissions its real execution Role holds would
|
|
72
|
+
* otherwise be refused `s3:CreateBucket` before creating a Resource.
|
|
73
|
+
*
|
|
74
|
+
* A name already taken in another scope is a real failure, and is reported.
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
if (s3.getSimBucketByName(bucketName)
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
await s3.createBucket({ input: { Bucket: bucketName } }, options);
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
if (s3.getSimBucketByName(bucketName) === undefined) {
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
76
|
+
ensureBucket(s3, bucketName) {
|
|
77
|
+
if (s3.getSimBucketByName(bucketName) === undefined) {
|
|
78
|
+
s3.makeSimBucket(bucketName);
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
stagingS3() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncMappedFactory } from "@kensio/part-factory";
|
|
2
2
|
import { TemporaryDirectory } from "../../../util/filesystem/temporary-directory.js";
|
|
3
3
|
import type { SimCfnTemplateValueRecord } from "../template/value/sim-cfn-template-value.js";
|
|
4
|
+
import type { SimCdkAssetsManifest } from "./sim-cdk-out-context.js";
|
|
4
5
|
/**
|
|
5
6
|
* One synthesized Stack in a cloud assembly a test writes.
|
|
6
7
|
*/
|
|
@@ -25,9 +26,20 @@ export interface SimCdkCloudAssemblyStackInput {
|
|
|
25
26
|
readonly resources?: SimCfnTemplateValueRecord | undefined;
|
|
26
27
|
/** The template's Outputs, which a Stack sharing a value needs. */
|
|
27
28
|
readonly outputs?: SimCfnTemplateValueRecord | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The assets manifest `cdk synth` writes beside the template, for a Stack
|
|
31
|
+
* that stages file assets. A Stack given none has no manifest file at all,
|
|
32
|
+
* which is what a Stack with nothing to stage synthesizes.
|
|
33
|
+
*/
|
|
34
|
+
readonly assets?: SimCdkAssetsManifest | undefined;
|
|
28
35
|
}
|
|
29
36
|
export interface SimCdkCloudAssemblyInput {
|
|
30
37
|
readonly stacks: readonly SimCdkCloudAssemblyStackInput[];
|
|
38
|
+
/**
|
|
39
|
+
* Staged asset files to write into the assembly, keyed by the path an assets
|
|
40
|
+
* manifest source names.
|
|
41
|
+
*/
|
|
42
|
+
readonly assetFiles?: Record<string, string> | undefined;
|
|
31
43
|
}
|
|
32
44
|
/** The Bucket a Stack in a written assembly creates, unless it is given others. */
|
|
33
45
|
export declare function assemblyStackBucketName(artifactId: string): string;
|
|
@@ -23,13 +23,19 @@ export function assemblyStackBucketName(artifactId) {
|
|
|
23
23
|
export const simCdkCloudAssemblyFactory = new AsyncMappedFactory(() => ({ stacks: [{ artifactId: "SiteStack", regionName: "eu-west-2" }] }), async (input) => {
|
|
24
24
|
const directory = new TemporaryDirectory();
|
|
25
25
|
await directory.writeFile(["cdk.out", "manifest.json"], jsonStringify(assemblyManifest(input.stacks)));
|
|
26
|
-
await Promise.all(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
await Promise.all([
|
|
27
|
+
...input.stacks.map(async (stack) => directory.writeFile(["cdk.out", templateFileName(stack)],
|
|
28
|
+
// JSON.stringify drops an undefined value, so a Stack given no
|
|
29
|
+
// Outputs writes a template with none rather than a null one.
|
|
30
|
+
jsonStringify({
|
|
31
|
+
Resources: stackResources(stack),
|
|
32
|
+
Outputs: stack.outputs,
|
|
33
|
+
}))),
|
|
34
|
+
...input.stacks
|
|
35
|
+
.filter((stack) => stack.assets !== undefined)
|
|
36
|
+
.map(async (stack) => directory.writeFile(["cdk.out", assetsFileName(stack)], jsonStringify(stack.assets))),
|
|
37
|
+
...Object.entries(input.assetFiles ?? {}).map(async ([assetPath, content]) => directory.writeFile(["cdk.out", assetPath], content)),
|
|
38
|
+
]);
|
|
33
39
|
return directory;
|
|
34
40
|
});
|
|
35
41
|
function assemblyManifest(stacks) {
|
|
@@ -56,6 +62,9 @@ function assemblyManifest(stacks) {
|
|
|
56
62
|
function templateFileName(stack) {
|
|
57
63
|
return `${stack.artifactId}.template.json`;
|
|
58
64
|
}
|
|
65
|
+
function assetsFileName(stack) {
|
|
66
|
+
return `${stack.artifactId}.assets.json`;
|
|
67
|
+
}
|
|
59
68
|
function stackResources(stack) {
|
|
60
69
|
return (stack.resources ?? {
|
|
61
70
|
[`${stack.artifactId}Bucket`]: {
|
|
@@ -18,6 +18,8 @@ interface CreateStackCommandHandlerProperties {
|
|
|
18
18
|
readonly bindings?: readonly SimCfnBinding[] | undefined;
|
|
19
19
|
/** The principal the Stack's Resources are created as. */
|
|
20
20
|
readonly caller?: SimAwsCaller | undefined;
|
|
21
|
+
/** The principal the Stack's CDK file assets are published as. */
|
|
22
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
21
23
|
/** The order Resources with no dependency between them are started in. */
|
|
22
24
|
readonly resourceOrder?: SimCfnResourceOrder | undefined;
|
|
23
25
|
readonly exports?: SimCfnExports | undefined;
|
|
@@ -35,6 +37,7 @@ export declare class CreateStackCommandHandler implements CommandHandler<SimCrea
|
|
|
35
37
|
private readonly cdkOutContext;
|
|
36
38
|
private readonly bindings;
|
|
37
39
|
private readonly caller;
|
|
40
|
+
private readonly assetsCaller;
|
|
38
41
|
private readonly resourceOrder;
|
|
39
42
|
private readonly exports;
|
|
40
43
|
constructor(properties: CreateStackCommandHandlerProperties);
|
|
@@ -16,10 +16,11 @@ export class CreateStackCommandHandler {
|
|
|
16
16
|
cdkOutContext;
|
|
17
17
|
bindings;
|
|
18
18
|
caller;
|
|
19
|
+
assetsCaller;
|
|
19
20
|
resourceOrder;
|
|
20
21
|
exports;
|
|
21
22
|
constructor(properties) {
|
|
22
|
-
const { simAws, accountRegionScope, stacks, background, cdkOutContext, bindings, caller, resourceOrder, exports, } = properties;
|
|
23
|
+
const { simAws, accountRegionScope, stacks, background, cdkOutContext, bindings, caller, assetsCaller, resourceOrder, exports, } = properties;
|
|
23
24
|
this.simAws = simAws;
|
|
24
25
|
this.accountRegionScope = accountRegionScope;
|
|
25
26
|
this.stacks = stacks;
|
|
@@ -27,6 +28,7 @@ export class CreateStackCommandHandler {
|
|
|
27
28
|
this.cdkOutContext = cdkOutContext;
|
|
28
29
|
this.bindings = bindings;
|
|
29
30
|
this.caller = caller;
|
|
31
|
+
this.assetsCaller = assetsCaller;
|
|
30
32
|
this.resourceOrder = resourceOrder;
|
|
31
33
|
this.exports = exports;
|
|
32
34
|
}
|
|
@@ -65,6 +67,7 @@ export class CreateStackCommandHandler {
|
|
|
65
67
|
cdkOutContext: this.cdkOutContext,
|
|
66
68
|
bindings: this.bindings,
|
|
67
69
|
caller: this.caller,
|
|
70
|
+
assetsCaller: this.assetsCaller,
|
|
68
71
|
resourceOrder: this.resourceOrder,
|
|
69
72
|
exports: this.exports,
|
|
70
73
|
});
|
|
@@ -22,6 +22,11 @@ interface UpdateStackCommandHandlerProperties {
|
|
|
22
22
|
* one. Left out, the Stack goes on running as whoever deployed it.
|
|
23
23
|
*/
|
|
24
24
|
readonly caller?: SimAwsCaller | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The principal to publish the re-synthesized CDK file assets as, for an
|
|
27
|
+
* update that names one. Left out, they are published as `caller`.
|
|
28
|
+
*/
|
|
29
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
25
30
|
/** The export names published in this Account and Region. */
|
|
26
31
|
readonly exports?: SimCfnExports | undefined;
|
|
27
32
|
}
|
|
@@ -37,6 +42,7 @@ export declare class UpdateStackCommandHandler implements CommandHandler<SimUpda
|
|
|
37
42
|
private readonly background;
|
|
38
43
|
private readonly cdkOutContext;
|
|
39
44
|
private readonly caller;
|
|
45
|
+
private readonly assetsCaller;
|
|
40
46
|
private readonly exports;
|
|
41
47
|
constructor(properties: UpdateStackCommandHandlerProperties);
|
|
42
48
|
/**
|
|
@@ -14,6 +14,7 @@ export class UpdateStackCommandHandler {
|
|
|
14
14
|
background;
|
|
15
15
|
cdkOutContext;
|
|
16
16
|
caller;
|
|
17
|
+
assetsCaller;
|
|
17
18
|
exports;
|
|
18
19
|
constructor(properties) {
|
|
19
20
|
this.simAws = properties.simAws;
|
|
@@ -22,6 +23,7 @@ export class UpdateStackCommandHandler {
|
|
|
22
23
|
this.background = properties.background;
|
|
23
24
|
this.cdkOutContext = properties.cdkOutContext;
|
|
24
25
|
this.caller = properties.caller;
|
|
26
|
+
this.assetsCaller = properties.assetsCaller;
|
|
25
27
|
this.exports = properties.exports;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
@@ -51,7 +53,11 @@ export class UpdateStackCommandHandler {
|
|
|
51
53
|
stack,
|
|
52
54
|
input: command.input,
|
|
53
55
|
exports: this.exports,
|
|
54
|
-
}), {
|
|
56
|
+
}), {
|
|
57
|
+
cdkOutContext: this.cdkOutContext,
|
|
58
|
+
caller: this.caller,
|
|
59
|
+
assetsCaller: this.assetsCaller,
|
|
60
|
+
});
|
|
55
61
|
return {
|
|
56
62
|
StackId: stack.stackId,
|
|
57
63
|
$metadata: {},
|
|
@@ -27,7 +27,7 @@ export class SimCfnCdkOutDeployer {
|
|
|
27
27
|
}
|
|
28
28
|
async deployStack(stack, plan, deployed) {
|
|
29
29
|
const { simAws, accountRegionScope } = this.scope;
|
|
30
|
-
const { transform, caller, resourceOrder, ...options } = cdkOutOptionsFor(stack, plan.stackOptions);
|
|
30
|
+
const { transform, caller, assetsCaller, resourceOrder, ...options } = cdkOutOptionsFor(stack, plan.stackOptions);
|
|
31
31
|
return await simAws
|
|
32
32
|
.accountRegionScope(accountRegionScope.accountId, stack.regionName)
|
|
33
33
|
.cloudFormation()
|
|
@@ -36,6 +36,7 @@ export class SimCfnCdkOutDeployer {
|
|
|
36
36
|
stackName: stack.stackName,
|
|
37
37
|
...options,
|
|
38
38
|
caller: caller ?? plan.caller,
|
|
39
|
+
assetsCaller: assetsCaller ?? plan.assetsCaller,
|
|
39
40
|
resourceOrder: resourceOrder ?? plan.resourceOrder,
|
|
40
41
|
transform: cdkOutBoundTransform(transform, deployed),
|
|
41
42
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SimCdkAssemblyStack } from "../cdk/sim-cdk-assembly-manifest.js";
|
|
2
|
+
import type { SimCfnCdkOutStackOptionsByName } from "./sim-cfn-cdk-out-stack-options.js";
|
|
3
|
+
/**
|
|
4
|
+
* Refuse options keyed against a Stack that is not being deployed.
|
|
5
|
+
*
|
|
6
|
+
* A renamed Stack would otherwise take its bindings, its caller and its
|
|
7
|
+
* transform with it without saying anything, and the deployment that lost them
|
|
8
|
+
* looks like one that never had them.
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertCdkOutOptionsAreDeployed(optionsByName: SimCfnCdkOutStackOptionsByName | undefined, deploying: readonly SimCdkAssemblyStack[]): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refuse options keyed against a Stack that is not being deployed.
|
|
3
|
+
*
|
|
4
|
+
* A renamed Stack would otherwise take its bindings, its caller and its
|
|
5
|
+
* transform with it without saying anything, and the deployment that lost them
|
|
6
|
+
* looks like one that never had them.
|
|
7
|
+
*/
|
|
8
|
+
export function assertCdkOutOptionsAreDeployed(optionsByName, deploying) {
|
|
9
|
+
const names = new Set(deploying.flatMap((stack) => [stack.stackName, stack.artifactId]));
|
|
10
|
+
const unmatched = Object.keys(optionsByName ?? {}).filter((name) => !names.has(name));
|
|
11
|
+
if (unmatched.length > 0) {
|
|
12
|
+
throw new Error(`Options were given for ${unmatched.join(", ")}, which no Stack being deployed is named. The Stacks being deployed are ${deploying.map((stack) => stack.stackName).join(", ")}.`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AwsRegionName } from "../../aws/sim-aws-region.js";
|
|
2
2
|
import type { SimAwsCaller } from "../../aws/caller/sim-aws-caller.js";
|
|
3
3
|
import { type SimCdkAssemblyStack } from "../cdk/sim-cdk-assembly-manifest.js";
|
|
4
|
-
import {
|
|
4
|
+
import type { SimCfnCdkOutStackOptionsByName } from "./sim-cfn-cdk-out-stack-options.js";
|
|
5
5
|
import type { SimCfnResourceOrder } from "../stack/deploy/sim-cfn-resource-order.js";
|
|
6
6
|
export interface SimCloudFormationDeployCdkOutProperties {
|
|
7
7
|
/** The `cdk.out` directory to deploy, holding a `manifest.json`. */
|
|
@@ -23,6 +23,15 @@ export interface SimCloudFormationDeployCdkOutProperties {
|
|
|
23
23
|
* in `stackOptions` overrides for its own Stack.
|
|
24
24
|
*/
|
|
25
25
|
readonly caller?: SimAwsCaller | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The principal every Stack in the assembly publishes its CDK file assets
|
|
28
|
+
* as, which one named in `stackOptions` overrides for its own Stack.
|
|
29
|
+
*
|
|
30
|
+
* A real `cdk deploy` publishes assets as the file publishing Role and
|
|
31
|
+
* processes each template as the execution Role. Left out, an assembly
|
|
32
|
+
* publishes its assets as `caller`.
|
|
33
|
+
*/
|
|
34
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
26
35
|
/**
|
|
27
36
|
* The order every Stack in the assembly creates Resources with no dependency
|
|
28
37
|
* between them in, which one named in `stackOptions` overrides for its own
|
|
@@ -43,6 +52,7 @@ export interface SimCfnCdkOutPlannedStack extends SimCdkAssemblyStack {
|
|
|
43
52
|
export interface SimCfnCdkOutPlan {
|
|
44
53
|
readonly stacks: readonly SimCfnCdkOutPlannedStack[];
|
|
45
54
|
readonly caller?: SimAwsCaller | undefined;
|
|
55
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
46
56
|
readonly resourceOrder?: SimCfnResourceOrder | undefined;
|
|
47
57
|
readonly stackOptions?: SimCfnCdkOutStackOptionsByName | undefined;
|
|
48
58
|
}
|
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { loadCdkAssemblyStacks, } from "../cdk/sim-cdk-assembly-manifest.js";
|
|
3
3
|
import { orderCdkAssemblyStacks } from "../cdk/sim-cdk-assembly-order.js";
|
|
4
4
|
import { selectCdkAssemblyStacks } from "../cdk/sim-cdk-assembly-selection.js";
|
|
5
|
-
import { assertCdkOutOptionsAreDeployed
|
|
5
|
+
import { assertCdkOutOptionsAreDeployed } from "./sim-cfn-cdk-out-options-deployed.js";
|
|
6
6
|
/**
|
|
7
7
|
* Work out which Stacks to deploy, in what order, and into which region.
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@ import { assertCdkOutOptionsAreDeployed, } from "./sim-cfn-cdk-out-stack-options
|
|
|
10
10
|
* an assembly that cannot be deployed says so before any Stack is created.
|
|
11
11
|
*/
|
|
12
12
|
export async function planCdkOutDeployment(properties) {
|
|
13
|
-
const { directoryPath, stackNames, caller, resourceOrder, stackOptions } = cdkOutDeployment(properties.request);
|
|
13
|
+
const { directoryPath, stackNames, caller, assetsCaller, resourceOrder, stackOptions, } = cdkOutDeployment(properties.request);
|
|
14
14
|
const selected = selectCdkAssemblyStacks({
|
|
15
15
|
stacks: await loadCdkAssemblyStacks(directoryPath),
|
|
16
16
|
stackNames,
|
|
@@ -23,6 +23,7 @@ export async function planCdkOutDeployment(properties) {
|
|
|
23
23
|
regionName: stack.regionName ?? properties.defaultRegionName,
|
|
24
24
|
})),
|
|
25
25
|
caller,
|
|
26
|
+
assetsCaller,
|
|
26
27
|
resourceOrder,
|
|
27
28
|
stackOptions,
|
|
28
29
|
};
|
|
@@ -34,6 +34,11 @@ export interface SimCfnCdkOutStackOptions {
|
|
|
34
34
|
* application Stack deployed by another is what this is for.
|
|
35
35
|
*/
|
|
36
36
|
readonly caller?: SimAwsCaller | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The principal this Stack publishes its CDK file assets as, where the
|
|
39
|
+
* assembly's own assets caller is not the right one for it.
|
|
40
|
+
*/
|
|
41
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
37
42
|
/**
|
|
38
43
|
* The order this Stack creates Resources with no dependency between them in,
|
|
39
44
|
* where the assembly's own order is not the right one for it.
|
|
@@ -53,11 +58,3 @@ export declare function cdkOutOptionsFor(stack: SimCdkAssemblyStack, optionsByNa
|
|
|
53
58
|
* keeps the deployment it was handed while the call goes on deploying.
|
|
54
59
|
*/
|
|
55
60
|
export declare function cdkOutBoundTransform(transform: SimCfnCdkOutTemplateTransform | undefined, deployed: ReadonlyMap<string, SimCfnDeployedStack>): SimCfnTemplateFileTransform | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Refuse options keyed against a Stack that is not being deployed.
|
|
58
|
-
*
|
|
59
|
-
* A renamed Stack would otherwise take its bindings, its caller and its
|
|
60
|
-
* transform with it without saying anything, and the deployment that lost them
|
|
61
|
-
* looks like one that never had them.
|
|
62
|
-
*/
|
|
63
|
-
export declare function assertCdkOutOptionsAreDeployed(optionsByName: SimCfnCdkOutStackOptionsByName | undefined, deploying: readonly SimCdkAssemblyStack[]): void;
|
|
@@ -17,17 +17,3 @@ export function cdkOutBoundTransform(transform, deployed) {
|
|
|
17
17
|
const deployedSoFar = new Map(deployed);
|
|
18
18
|
return (template) => transform(template, deployedSoFar);
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Refuse options keyed against a Stack that is not being deployed.
|
|
22
|
-
*
|
|
23
|
-
* A renamed Stack would otherwise take its bindings, its caller and its
|
|
24
|
-
* transform with it without saying anything, and the deployment that lost them
|
|
25
|
-
* looks like one that never had them.
|
|
26
|
-
*/
|
|
27
|
-
export function assertCdkOutOptionsAreDeployed(optionsByName, deploying) {
|
|
28
|
-
const names = new Set(deploying.flatMap((stack) => [stack.stackName, stack.artifactId]));
|
|
29
|
-
const unmatched = Object.keys(optionsByName ?? {}).filter((name) => !names.has(name));
|
|
30
|
-
if (unmatched.length > 0) {
|
|
31
|
-
throw new Error(`Options were given for ${unmatched.join(", ")}, which no Stack being deployed is named. The Stacks being deployed are ${deploying.map((stack) => stack.stackName).join(", ")}.`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -24,6 +24,15 @@ export interface SimCloudFormationCreateStackProperties {
|
|
|
24
24
|
* policy denying an Account's root principal then denies.
|
|
25
25
|
*/
|
|
26
26
|
readonly caller?: SimAwsCaller | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The principal the CDK file assets staged beside the template are published
|
|
29
|
+
* as.
|
|
30
|
+
*
|
|
31
|
+
* A real `cdk deploy` publishes them as the file publishing Role and only
|
|
32
|
+
* then processes the template as the execution Role, which is why the two
|
|
33
|
+
* are named apart. Left out, assets are published as `caller`.
|
|
34
|
+
*/
|
|
35
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
27
36
|
/**
|
|
28
37
|
* The order Resources with no dependency between them are created in.
|
|
29
38
|
*
|
|
@@ -59,6 +59,7 @@ export class SimCloudFormationTemplateDeployer {
|
|
|
59
59
|
parameters: properties.parameters,
|
|
60
60
|
bindings: properties.bindings,
|
|
61
61
|
caller: properties.caller,
|
|
62
|
+
assetsCaller: properties.assetsCaller,
|
|
62
63
|
resourceOrder: properties.resourceOrder,
|
|
63
64
|
cdkOutContext: await cdkOutContextForTemplatePath(properties.templatePath),
|
|
64
65
|
});
|
|
@@ -118,6 +119,7 @@ export class SimCloudFormationTemplateDeployer {
|
|
|
118
119
|
cdkOutContext: deployment.cdkOutContext,
|
|
119
120
|
bindings: deployment.bindings,
|
|
120
121
|
caller: deployment.caller,
|
|
122
|
+
assetsCaller: deployment.assetsCaller,
|
|
121
123
|
resourceOrder: deployment.resourceOrder,
|
|
122
124
|
exports: this.exports,
|
|
123
125
|
});
|
|
@@ -20,6 +20,15 @@ export interface SimCloudFormationDeployTemplateFileProperties {
|
|
|
20
20
|
* policy denying an Account's root principal then denies.
|
|
21
21
|
*/
|
|
22
22
|
readonly caller?: SimAwsCaller | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The principal the CDK file assets staged beside the template are published
|
|
25
|
+
* as.
|
|
26
|
+
*
|
|
27
|
+
* A real `cdk deploy` publishes them as the file publishing Role and only
|
|
28
|
+
* then processes the template as the execution Role, which is why the two
|
|
29
|
+
* are named apart. Left out, assets are published as `caller`.
|
|
30
|
+
*/
|
|
31
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
23
32
|
/**
|
|
24
33
|
* The order Resources with no dependency between them are created in.
|
|
25
34
|
*
|
|
@@ -64,6 +73,7 @@ export interface SimCfnLoadedTemplateFile {
|
|
|
64
73
|
readonly parameters?: Record<string, string> | undefined;
|
|
65
74
|
readonly bindings?: readonly SimCfnBinding[] | undefined;
|
|
66
75
|
readonly caller?: SimAwsCaller | undefined;
|
|
76
|
+
readonly assetsCaller?: SimAwsCaller | undefined;
|
|
67
77
|
readonly resourceOrder?: SimCfnResourceOrder | undefined;
|
|
68
78
|
readonly cdkOutContext?: SimCdkOutContext | undefined;
|
|
69
79
|
}
|
|
@@ -16,7 +16,7 @@ export class SimCfnTemplateFileLoader {
|
|
|
16
16
|
*/
|
|
17
17
|
async load(properties) {
|
|
18
18
|
const deployment = simCfnTemplateFileDeployment(properties);
|
|
19
|
-
const { templatePath, parameters, bindings, caller, resourceOrder } = deployment;
|
|
19
|
+
const { templatePath, parameters, bindings, caller, assetsCaller, resourceOrder, } = deployment;
|
|
20
20
|
const stackName = deployment.stackName ?? stackNameFromTemplatePath(templatePath);
|
|
21
21
|
// The template is named to a `yulin watch` supervisor, so re-synthing a
|
|
22
22
|
// stack restarts the process that deployed it. Nothing happens outside
|
|
@@ -32,6 +32,7 @@ export class SimCfnTemplateFileLoader {
|
|
|
32
32
|
parameters,
|
|
33
33
|
bindings,
|
|
34
34
|
caller,
|
|
35
|
+
assetsCaller,
|
|
35
36
|
resourceOrder,
|
|
36
37
|
cdkOutContext,
|
|
37
38
|
};
|
package/dist/service/cloudformation/resource/cfn/sim-cfn-default-resource-value-adapter.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SimCfnTemplateValue } from "../../template/value/sim-cfn-template-
|
|
|
2
2
|
import type { SimCfnResourceValueAdapter } from "./sim-cfn-resource-value-adapter.js";
|
|
3
3
|
interface SimCfnDefaultResourceValueAdapterProperties {
|
|
4
4
|
readonly logicalId: string;
|
|
5
|
+
readonly uncreatedPhysicalName?: string | undefined;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* Fallback CloudFormation-facing values for Resource types without specific
|
|
@@ -9,9 +10,15 @@ interface SimCfnDefaultResourceValueAdapterProperties {
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class SimCfnDefaultResourceValueAdapter implements SimCfnResourceValueAdapter {
|
|
11
12
|
private readonly logicalId;
|
|
13
|
+
private readonly uncreatedPhysicalName;
|
|
12
14
|
constructor(properties: SimCfnDefaultResourceValueAdapterProperties);
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* The physical ID this Resource would have had, or the logical-ID stand-in.
|
|
17
|
+
*
|
|
18
|
+
* A service that worked out the Resource's name before refusing to create it
|
|
19
|
+
* leaves the simulation holding the name real CloudFormation would have
|
|
20
|
+
* produced. That is what Ref answers with. The logical ID is left for a
|
|
21
|
+
* Resource nothing ever named.
|
|
15
22
|
*/
|
|
16
23
|
refValue(): SimCfnTemplateValue;
|
|
17
24
|
/**
|
|
@@ -5,14 +5,21 @@ import { simCfnUnansweredAttribute } from "./sim-cfn-unanswered-attribute.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export class SimCfnDefaultResourceValueAdapter {
|
|
7
7
|
logicalId;
|
|
8
|
+
uncreatedPhysicalName;
|
|
8
9
|
constructor(properties) {
|
|
9
10
|
this.logicalId = properties.logicalId;
|
|
11
|
+
this.uncreatedPhysicalName = properties.uncreatedPhysicalName;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* The physical ID this Resource would have had, or the logical-ID stand-in.
|
|
15
|
+
*
|
|
16
|
+
* A service that worked out the Resource's name before refusing to create it
|
|
17
|
+
* leaves the simulation holding the name real CloudFormation would have
|
|
18
|
+
* produced. That is what Ref answers with. The logical ID is left for a
|
|
19
|
+
* Resource nothing ever named.
|
|
13
20
|
*/
|
|
14
21
|
refValue() {
|
|
15
|
-
return this.logicalId;
|
|
22
|
+
return this.uncreatedPhysicalName ?? this.logicalId;
|
|
16
23
|
}
|
|
17
24
|
/**
|
|
18
25
|
* Default attribute stand-in.
|
|
@@ -7,6 +7,11 @@ export interface SimCfnResourceValueAdapterProperties {
|
|
|
7
7
|
readonly logicalId: string;
|
|
8
8
|
readonly type: string | undefined;
|
|
9
9
|
readonly simResource: object | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The name real CloudFormation would have given the Resource, where the
|
|
12
|
+
* service knew it before deciding not to create it.
|
|
13
|
+
*/
|
|
14
|
+
readonly uncreatedPhysicalName?: string | undefined;
|
|
10
15
|
}
|
|
11
16
|
/**
|
|
12
17
|
* The adapter for a Resource type one service owns, or nothing when the
|
|
@@ -23,6 +28,6 @@ export type SimCfnServiceValueAdapter = SimCfnResourceValueAdapter | undefined;
|
|
|
23
28
|
* Each service matches its own Resource types, beside that service's adapters,
|
|
24
29
|
* so this registry stays a list of services. A Resource no service claims
|
|
25
30
|
* falls through to the default adapter, which answers a Ref with the logical
|
|
26
|
-
* ID.
|
|
31
|
+
* ID, or with the name a service worked out before refusing the Resource.
|
|
27
32
|
*/
|
|
28
33
|
export declare function simCfnResourceValueAdapter(properties: SimCfnResourceValueAdapterProperties): SimCfnResourceValueAdapter;
|
|
@@ -10,7 +10,7 @@ import { simCfnServiceValueAdapters } from "./sim-cfn-service-value-adapters.js"
|
|
|
10
10
|
* Each service matches its own Resource types, beside that service's adapters,
|
|
11
11
|
* so this registry stays a list of services. A Resource no service claims
|
|
12
12
|
* falls through to the default adapter, which answers a Ref with the logical
|
|
13
|
-
* ID.
|
|
13
|
+
* ID, or with the name a service worked out before refusing the Resource.
|
|
14
14
|
*/
|
|
15
15
|
export function simCfnResourceValueAdapter(properties) {
|
|
16
16
|
for (const serviceAdapter of simCfnServiceValueAdapters) {
|
|
@@ -21,5 +21,6 @@ export function simCfnResourceValueAdapter(properties) {
|
|
|
21
21
|
}
|
|
22
22
|
return new SimCfnDefaultResourceValueAdapter({
|
|
23
23
|
logicalId: properties.logicalId,
|
|
24
|
+
uncreatedPhysicalName: properties.uncreatedPhysicalName,
|
|
24
25
|
});
|
|
25
26
|
}
|
|
@@ -39,6 +39,10 @@ export declare class SimCfnResourceCreateOperation<T extends object = object> {
|
|
|
39
39
|
* a gap and is skipped, unless nothing this simulator models could have told
|
|
40
40
|
* it apart from one that was created, in which case saying it is missing
|
|
41
41
|
* sends a reader after something that is not lost.
|
|
42
|
+
*
|
|
43
|
+
* Either way the Resource keeps whatever name the refusal carried. A
|
|
44
|
+
* template reading a Ref of it then gets the name real CloudFormation would
|
|
45
|
+
* have produced.
|
|
42
46
|
*/
|
|
43
47
|
private recordUncreated;
|
|
44
48
|
private resourceCreationError;
|