@guardian/cdk 48.6.0-beta.2 → 49.0.0
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/README.md +1 -1
- package/lib/bin/commands/new-project/index.d.ts +1 -1
- package/lib/bin/commands/new-project/index.d.ts.map +1 -1
- package/lib/constants/metadata-keys.d.ts +0 -2
- package/lib/constants/metadata-keys.d.ts.map +1 -1
- package/lib/constants/metadata-keys.js +0 -2
- package/lib/constants/metadata-keys.js.map +1 -1
- package/lib/constructs/acm/certificate.d.ts +1 -1
- package/lib/constructs/acm/certificate.d.ts.map +1 -1
- package/lib/constructs/autoscaling/user-data.d.ts +1 -1
- package/lib/constructs/autoscaling/user-data.d.ts.map +1 -1
- package/lib/constructs/autoscaling/user-data.js +8 -8
- package/lib/constructs/autoscaling/user-data.js.map +1 -1
- package/lib/constructs/core/parameters/base.d.ts +2 -2
- package/lib/constructs/core/parameters/base.d.ts.map +1 -1
- package/lib/constructs/core/stack.js +27 -27
- package/lib/constructs/core/stack.js.map +1 -1
- package/lib/constructs/ec2/vpc.d.ts +1 -1
- package/lib/constructs/ec2/vpc.d.ts.map +1 -1
- package/lib/constructs/ecs/ecs-task.d.ts +4 -4
- package/lib/constructs/ecs/ecs-task.d.ts.map +1 -1
- package/lib/constructs/iam/policies/base-policy.d.ts +3 -3
- package/lib/constructs/iam/policies/base-policy.d.ts.map +1 -1
- package/lib/constructs/iam/roles/instance-role.d.ts +1 -1
- package/lib/constructs/iam/roles/instance-role.d.ts.map +1 -1
- package/lib/constructs/iam/roles/roles.d.ts +1 -1
- package/lib/constructs/iam/roles/roles.d.ts.map +1 -1
- package/lib/constructs/kinesis/kinesis-stream.d.ts +1 -1
- package/lib/constructs/kinesis/kinesis-stream.d.ts.map +1 -1
- package/lib/constructs/vpc/vpc.d.ts +1 -1
- package/lib/constructs/vpc/vpc.d.ts.map +1 -1
- package/lib/constructs/vpc/vpc.js +1 -1
- package/lib/constructs/vpc/vpc.js.map +1 -1
- package/lib/experimental/constructs/error-budget-alarm.d.ts +2 -18
- package/lib/experimental/constructs/error-budget-alarm.d.ts.map +1 -1
- package/lib/experimental/constructs/error-budget-alarm.js +1 -81
- package/lib/experimental/constructs/error-budget-alarm.js.map +1 -1
- package/lib/experimental/patterns/sns-lambda.d.ts.map +1 -1
- package/lib/experimental/patterns/sns-lambda.js +1 -2
- package/lib/experimental/patterns/sns-lambda.js.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/index.js +48 -48
- package/lib/experimental/riff-raff-yaml-file/index.js.map +1 -1
- package/lib/experimental/riff-raff-yaml-file/types.d.ts +7 -7
- package/lib/experimental/riff-raff-yaml-file/types.d.ts.map +1 -1
- package/lib/patterns/api-multiple-lambdas.d.ts +1 -1
- package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -1
- package/lib/patterns/ec2-app/base.d.ts +0 -21
- package/lib/patterns/ec2-app/base.d.ts.map +1 -1
- package/lib/patterns/ec2-app/base.js +0 -33
- package/lib/patterns/ec2-app/base.js.map +1 -1
- package/lib/patterns/ec2-app/framework.d.ts +1 -1
- package/lib/patterns/ec2-app/framework.d.ts.map +1 -1
- package/lib/types/access.d.ts +1 -1
- package/lib/types/access.d.ts.map +1 -1
- package/lib/types/cli.d.ts +1 -1
- package/lib/types/cli.d.ts.map +1 -1
- package/lib/utils/lambda/event-source.d.ts +4 -4
- package/lib/utils/lambda/event-source.d.ts.map +1 -1
- package/lib/utils/lambda/event-source.js +4 -4
- package/lib/utils/lambda/event-source.js.map +1 -1
- package/lib/utils/mixin/types.d.ts +1 -1
- package/lib/utils/mixin/types.d.ts.map +1 -1
- package/package.json +18 -18
- package/lib/constructs/sns/index.d.ts +0 -2
- package/lib/constructs/sns/index.d.ts.map +0 -1
- package/lib/constructs/sns/index.js +0 -18
- package/lib/constructs/sns/index.js.map +0 -1
- package/lib/constructs/sns/sns-topic.d.ts +0 -15
- package/lib/constructs/sns/sns-topic.d.ts.map +0 -1
- package/lib/constructs/sns/sns-topic.js +0 -17
- package/lib/constructs/sns/sns-topic.js.map +0 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/new-project/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAW7D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bin/commands/new-project/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAW7D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5C,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;CAChC;AAsED,eAAO,MAAM,aAAa,UAAiB,eAAe,uBA+EzD,CAAC"}
|
|
@@ -2,9 +2,7 @@ export declare const MetadataKeys: {
|
|
|
2
2
|
VERSION: string;
|
|
3
3
|
CONSTRUCTS_KEY: string;
|
|
4
4
|
REPOSITORY_NAME: string;
|
|
5
|
-
PATTERN_NAME: string;
|
|
6
5
|
LOG_KINESIS_STREAM_NAME: string;
|
|
7
6
|
SYSTEMD_UNIT: string;
|
|
8
|
-
CDK_FEATURE: string;
|
|
9
7
|
};
|
|
10
8
|
//# sourceMappingURL=metadata-keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-keys.d.ts","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"metadata-keys.d.ts","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC"}
|
|
@@ -5,9 +5,7 @@ exports.MetadataKeys = {
|
|
|
5
5
|
VERSION: "gu:cdk:version",
|
|
6
6
|
CONSTRUCTS_KEY: "gu:cdk:constructs",
|
|
7
7
|
REPOSITORY_NAME: "gu:repo",
|
|
8
|
-
PATTERN_NAME: "gu:cdk:pattern-name",
|
|
9
8
|
LOG_KINESIS_STREAM_NAME: "LogKinesisStreamName",
|
|
10
9
|
SYSTEMD_UNIT: "SystemdUnit",
|
|
11
|
-
CDK_FEATURE: "gu:cdk:feature",
|
|
12
10
|
};
|
|
13
11
|
//# sourceMappingURL=metadata-keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-keys.js","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,gBAAgB;IACzB,cAAc,EAAE,mBAAmB;IACnC,eAAe,EAAE,SAAS;IAC1B,
|
|
1
|
+
{"version":3,"file":"metadata-keys.js","sourceRoot":"","sources":["../../src/constants/metadata-keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,gBAAgB;IACzB,cAAc,EAAE,mBAAmB;IACnC,eAAe,EAAE,SAAS;IAC1B,uBAAuB,EAAE,sBAAsB;IAC/C,YAAY,EAAE,aAAa;CAC5B,CAAC","sourcesContent":["export const MetadataKeys = {\n VERSION: \"gu:cdk:version\",\n CONSTRUCTS_KEY: \"gu:cdk:constructs\",\n REPOSITORY_NAME: \"gu:repo\",\n LOG_KINESIS_STREAM_NAME: \"LogKinesisStreamName\",\n SYSTEMD_UNIT: \"SystemdUnit\",\n};\n"]}
|
|
@@ -2,7 +2,7 @@ import { Certificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
|
2
2
|
import type { GuDomainName } from "../../types";
|
|
3
3
|
import { AppIdentity } from "../core";
|
|
4
4
|
import type { GuStack } from "../core";
|
|
5
|
-
export
|
|
5
|
+
export type GuCertificatePropsWithApp = GuDomainName & AppIdentity;
|
|
6
6
|
declare const GuCertificate_base: {
|
|
7
7
|
new (...args: any[]): {
|
|
8
8
|
readonly idWithApp: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate.d.ts","sourceRoot":"","sources":["../../../src/constructs/acm/certificate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,oCAAoC,CAAC;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,
|
|
1
|
+
{"version":3,"file":"certificate.d.ts","sourceRoot":"","sources":["../../../src/constructs/acm/certificate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAyB,MAAM,oCAAoC,CAAC;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,yBAAyB,GAAG,YAAY,GAAG,WAAW,CAAC;;;;;;AAEnE;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,kBAAgC;gBACrD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB;CAe7D"}
|
|
@@ -3,7 +3,7 @@ import type { S3DownloadOptions } from "aws-cdk-lib/aws-ec2";
|
|
|
3
3
|
import type { GuDistributableForEc2 } from "../../types";
|
|
4
4
|
import type { GuPrivateS3ConfigurationProps } from "../../utils/ec2";
|
|
5
5
|
import type { AppIdentity, GuStack } from "../core";
|
|
6
|
-
export
|
|
6
|
+
export type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;
|
|
7
7
|
export interface GuUserDataProps {
|
|
8
8
|
distributable: GuDistributableForEc2;
|
|
9
9
|
configuration?: GuPrivateS3ConfigurationProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-data.d.ts","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEpD,
|
|
1
|
+
{"version":3,"file":"user-data.d.ts","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,WAAW,CAAC;AACnE,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,qBAAqB,CAAC;IACrC,aAAa,CAAC,EAAE,6BAA6B,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAW;IAErC,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,qBAAqB;gBAqBjB,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,sBAAsB;IAWzD,WAAW,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,UAAU;IAK9C,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;CAI5D"}
|
|
@@ -13,14 +13,6 @@ const core_1 = require("../core");
|
|
|
13
13
|
* - execute distributable
|
|
14
14
|
*/
|
|
15
15
|
class GuUserData {
|
|
16
|
-
constructor(scope, props) {
|
|
17
|
-
this._userData = aws_ec2_1.UserData.forLinux();
|
|
18
|
-
if (props.configuration) {
|
|
19
|
-
this.downloadConfiguration(scope, props.app, props.configuration);
|
|
20
|
-
}
|
|
21
|
-
this.downloadDistributable(scope, props, props.distributable);
|
|
22
|
-
this.addCommands(props.distributable.executionStatement);
|
|
23
|
-
}
|
|
24
16
|
get userData() {
|
|
25
17
|
return this._userData;
|
|
26
18
|
}
|
|
@@ -52,6 +44,14 @@ class GuUserData {
|
|
|
52
44
|
});
|
|
53
45
|
});
|
|
54
46
|
}
|
|
47
|
+
constructor(scope, props) {
|
|
48
|
+
this._userData = aws_ec2_1.UserData.forLinux();
|
|
49
|
+
if (props.configuration) {
|
|
50
|
+
this.downloadConfiguration(scope, props.app, props.configuration);
|
|
51
|
+
}
|
|
52
|
+
this.downloadDistributable(scope, props, props.distributable);
|
|
53
|
+
this.addCommands(props.distributable.executionStatement);
|
|
54
|
+
}
|
|
55
55
|
addCommands(...commands) {
|
|
56
56
|
this._userData.addCommands(...commands);
|
|
57
57
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-data.js","sourceRoot":"","sources":["../../../src/constructs/autoscaling/user-data.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAE/C,+CAA4C;AAC5C,uCAA8C;AAG9C,kCAAwD;AASxD;;;;;;GAMG;AACH,MAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"user-data.js","sourceRoot":"","sources":["../../../src/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,SAAS,EAAE,QAAQ,GAAG,IAAI,QAAQ,EAAE;aACrC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,KAAc,EAAE,KAA6B;QACvD,IAAI,CAAC,SAAS,GAAG,kBAAQ,CAAC,QAAQ,EAAE,CAAC;QAErC,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;SACnE;QAED,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC3D,CAAC;IAED,WAAW,CAAC,GAAG,QAAkB;QAC/B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oBAAoB,CAAC,MAAyB;QAC5C,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9DD,gCA8DC","sourcesContent":["import { UserData } from \"aws-cdk-lib/aws-ec2\";\nimport type { S3DownloadOptions } from \"aws-cdk-lib/aws-ec2\";\nimport { Bucket } from \"aws-cdk-lib/aws-s3\";\nimport { GuDistributable } from \"../../types\";\nimport type { GuDistributableForEc2 } from \"../../types\";\nimport type { GuPrivateS3ConfigurationProps } from \"../../utils/ec2\";\nimport { GuDistributionBucketParameter } from \"../core\";\nimport type { AppIdentity, GuStack } from \"../core\";\n\nexport type GuUserDataPropsWithApp = GuUserDataProps & AppIdentity;\nexport interface GuUserDataProps {\n distributable: GuDistributableForEc2;\n configuration?: GuPrivateS3ConfigurationProps;\n}\n\n/**\n * An abstraction over UserData to simplify its creation.\n * Especially useful for simple user data where we:\n * - (optional) download config\n * - download distributable\n * - execute distributable\n */\nexport class GuUserData {\n private readonly _userData: UserData;\n\n get userData(): UserData {\n return this._userData;\n }\n\n private downloadDistributable(scope: GuStack, app: AppIdentity, props: GuDistributableForEc2) {\n const bucketKey = GuDistributable.getObjectKey(scope, app, props);\n\n const bucket = Bucket.fromBucketAttributes(scope, \"DistributionBucket\", {\n bucketName: GuDistributionBucketParameter.getInstance(scope).valueAsString,\n });\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/${app.app}/${props.fileName}`,\n });\n }\n\n private downloadConfiguration(scope: GuStack, app: string, props: GuPrivateS3ConfigurationProps) {\n const bucket = Bucket.fromBucketAttributes(scope, `${app}ConfigurationBucket`, {\n bucketName: props.bucket.valueAsString,\n });\n\n props.files.forEach((bucketKey) => {\n const fileName = bucketKey.split(\"/\").slice(-1)[0];\n\n // `fileName` is typed as `string | undefined`. Throw if `fileName` is falsy.\n if (!fileName) {\n throw new Error(\"Failed to create configuration section in UserData\");\n }\n\n this.addS3DownloadCommand({\n bucket,\n bucketKey,\n localFile: `/etc/${app}/${fileName}`,\n });\n });\n }\n\n constructor(scope: GuStack, props: GuUserDataPropsWithApp) {\n this._userData = UserData.forLinux();\n\n if (props.configuration) {\n this.downloadConfiguration(scope, props.app, props.configuration);\n }\n\n this.downloadDistributable(scope, props, props.distributable);\n this.addCommands(props.distributable.executionStatement);\n }\n\n addCommands(...commands: string[]): GuUserData {\n this._userData.addCommands(...commands);\n return this;\n }\n\n addS3DownloadCommand(params: S3DownloadOptions): GuUserData {\n this._userData.addS3DownloadCommand(params);\n return this;\n }\n}\n"]}
|
|
@@ -5,8 +5,8 @@ import type { GuStack } from "../stack";
|
|
|
5
5
|
export interface GuParameterProps extends CfnParameterProps {
|
|
6
6
|
fromSSM?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type GuNoTypeParameterProps = Omit<GuParameterProps, "type">;
|
|
9
|
+
export type GuNoTypeParameterPropsWithAppIdentity = Omit<GuParameterProps, "type"> & AppIdentity;
|
|
10
10
|
export declare class GuParameter extends CfnParameter {
|
|
11
11
|
readonly id: string;
|
|
12
12
|
constructor(scope: GuStack, id: string, props: GuParameterProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/constructs/core/parameters/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/constructs/core/parameters/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AACpE,MAAM,MAAM,qCAAqC,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjG,qBAAa,WAAY,SAAQ,YAAY;IAC3C,SAAgB,EAAE,EAAE,MAAM,CAAC;gBAEf,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB;CAShE;AAED,qBAAa,iBAAkB,SAAQ,WAAW;gBACpC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;CAGtE;AAED,qBAAa,cAAe,SAAQ,iBAAiB;gBACvC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB;CAOtE"}
|
|
@@ -40,33 +40,6 @@ const git_1 = require("../../utils/git");
|
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
class GuStack extends aws_cdk_lib_1.Stack {
|
|
43
|
-
// eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App
|
|
44
|
-
constructor(scope, id, props) {
|
|
45
|
-
const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;
|
|
46
|
-
super(scope, id, {
|
|
47
|
-
...props,
|
|
48
|
-
stackName: cloudFormationStackName,
|
|
49
|
-
// TODO Use `DefaultStackSynthesizer` or create own synthesizer?
|
|
50
|
-
// see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth
|
|
51
|
-
synthesizer: new aws_cdk_lib_1.LegacyStackSynthesizer(),
|
|
52
|
-
});
|
|
53
|
-
this._stack = stack;
|
|
54
|
-
this._stage = stage.toUpperCase();
|
|
55
|
-
if (!withoutTags) {
|
|
56
|
-
this.addTag(constants_1.TrackingTag.Key, constants_1.TrackingTag.Value);
|
|
57
|
-
this.addTag("Stack", this.stack);
|
|
58
|
-
this.addTag("Stage", this.stage);
|
|
59
|
-
if (this.app) {
|
|
60
|
-
this.addTag("App", this.app);
|
|
61
|
-
}
|
|
62
|
-
this.tryAddRepositoryTag();
|
|
63
|
-
}
|
|
64
|
-
if (!props.withoutMetadata) {
|
|
65
|
-
aws_cdk_lib_1.Aspects.of(this).add(new metadata_1.Metadata(this));
|
|
66
|
-
}
|
|
67
|
-
aws_cdk_lib_1.Aspects.of(this).add(new cfn_include_reporter_1.CfnIncludeReporter());
|
|
68
|
-
aws_cdk_lib_1.Aspects.of(this).add(new cfn_parameter_reporter_1.CfnParameterReporter());
|
|
69
|
-
}
|
|
70
43
|
get stage() {
|
|
71
44
|
return this._stage;
|
|
72
45
|
}
|
|
@@ -102,6 +75,33 @@ class GuStack extends aws_cdk_lib_1.Stack {
|
|
|
102
75
|
.filter((construct) => construct instanceof aws_cdk_lib_1.CfnParameter)
|
|
103
76
|
.reduce((acc, param) => ({ ...acc, [param.node.id]: param }), {});
|
|
104
77
|
}
|
|
78
|
+
// eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App
|
|
79
|
+
constructor(scope, id, props) {
|
|
80
|
+
const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;
|
|
81
|
+
super(scope, id, {
|
|
82
|
+
...props,
|
|
83
|
+
stackName: cloudFormationStackName,
|
|
84
|
+
// TODO Use `DefaultStackSynthesizer` or create own synthesizer?
|
|
85
|
+
// see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth
|
|
86
|
+
synthesizer: new aws_cdk_lib_1.LegacyStackSynthesizer(),
|
|
87
|
+
});
|
|
88
|
+
this._stack = stack;
|
|
89
|
+
this._stage = stage.toUpperCase();
|
|
90
|
+
if (!withoutTags) {
|
|
91
|
+
this.addTag(constants_1.TrackingTag.Key, constants_1.TrackingTag.Value);
|
|
92
|
+
this.addTag("Stack", this.stack);
|
|
93
|
+
this.addTag("Stage", this.stage);
|
|
94
|
+
if (this.app) {
|
|
95
|
+
this.addTag("App", this.app);
|
|
96
|
+
}
|
|
97
|
+
this.tryAddRepositoryTag();
|
|
98
|
+
}
|
|
99
|
+
if (!props.withoutMetadata) {
|
|
100
|
+
aws_cdk_lib_1.Aspects.of(this).add(new metadata_1.Metadata(this));
|
|
101
|
+
}
|
|
102
|
+
aws_cdk_lib_1.Aspects.of(this).add(new cfn_include_reporter_1.CfnIncludeReporter());
|
|
103
|
+
aws_cdk_lib_1.Aspects.of(this).add(new cfn_parameter_reporter_1.CfnParameterReporter());
|
|
104
|
+
}
|
|
105
105
|
/**
|
|
106
106
|
* Adds a tag to resources in the stack for the repository name.
|
|
107
107
|
* The value is retrieved in the following order:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/constructs/core/stack.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2G;AAE3G,uDAAkD;AAElD,kEAAwC;AACxC,6EAAwE;AACxE,iFAA4E;AAC5E,qDAAkD;AAClD,+CAAyE;AACzE,yCAAqD;AAqCrD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,OAAQ,SAAQ,mBAAK;IA6ChC,8GAA8G;IAC9G,YAAY,KAAU,EAAE,EAAU,EAAE,KAAmB;QACrD,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;QAErG,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE;YACf,GAAG,KAAK;YACR,SAAS,EAAE,uBAAuB;YAElC,gEAAgE;YAChE,8FAA8F;YAC9F,WAAW,EAAE,IAAI,oCAAsB,EAAE;SAC1C,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAElC,IAAI,CAAC,WAAW,EAAE;YAChB,IAAI,CAAC,MAAM,CAAC,uBAAW,CAAC,GAAG,EAAE,uBAAW,CAAC,KAAK,CAAC,CAAC;YAEhD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACjC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACjC,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AAI,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;CACF;AATD,gEASC","sourcesContent":["import { Annotations, App, Aspects, CfnParameter, LegacyStackSynthesizer, Stack, Tags } from \"aws-cdk-lib\";\nimport type { CfnElement, StackProps } from \"aws-cdk-lib\";\nimport { Template } from \"aws-cdk-lib/assertions\";\nimport type { IConstruct } from \"constructs\";\nimport gitUrlParse from \"git-url-parse\";\nimport { CfnIncludeReporter } from \"../../aspects/cfn-include-reporter\";\nimport { CfnParameterReporter } from \"../../aspects/cfn-parameter-reporter\";\nimport { Metadata } from \"../../aspects/metadata\";\nimport { ContextKeys, MetadataKeys, TrackingTag } from \"../../constants\";\nimport { gitRemoteOriginUrl } from \"../../utils/git\";\nimport type { StackStageIdentity } from \"./identity\";\nimport type { GuStaticLogicalId } from \"./migrating\";\n\nexport interface GuStackProps extends Omit<StackProps, \"stackName\"> {\n /**\n * The Guardian stack being used (as defined in your riff-raff.yaml).\n * This will be applied as a tag to all of your resources.\n */\n stack: string;\n\n stage: string;\n\n /**\n * Optional name of the app. If defined, all resources will have an App tag.\n */\n app?: string;\n\n /**\n * The AWS CloudFormation stack name (as shown in the AWS CloudFormation UI).\n * @defaultValue the `GU_CFN_STACK_NAME` environment variable\n */\n cloudFormationStackName?: string;\n /**\n * Set this to true to stop the GuStack from tagging all of your AWS resources.\n * This should only be turned on as part of an initial migration from CloudFormation.\n */\n withoutTags?: boolean;\n\n /**\n * Set to disable CDK metadata. Only for internal use (for disabling for some\n * snapshot tests). We rely on tracking data to prioritise future work so\n * please do not override this.\n */\n withoutMetadata?: boolean;\n}\n\n/**\n * GuStack provides the `stack` and `stage` parameters to a template.\n * It also takes the `app` in the constructor.\n *\n * GuStack will add the Stack, Stage and App tags to all resources.\n *\n * GuStack also adds the tag `X-Gu-CDK-Version`.\n * This tag allows us to measure adoption of this library.\n * It's value is the version of guardian/cdk being used, as defined in `package.json`.\n * As a result, the change sets between version numbers will be fairly noisy,\n * as all resources receive a tag update.\n * It is recommended to upgrade the version of @guardian/cdk being used in two steps:\n * 1. Bump the library, apply the tag updates\n * 2. Make any other stack changes\n *\n * Typical usage is to extend GuStack:\n *\n * ```typescript\n * class MyStack extends GuStack {\n * constructor(scope: App, id: string, props: GuStackProps) {\n * super(scope, id, props)\n * }\n *\n * // add resources here\n * }\n * ```\n */\nexport class GuStack extends Stack implements StackStageIdentity {\n private readonly _stack: string;\n private readonly _stage: string;\n private readonly _app?: string;\n\n get stage(): string {\n return this._stage;\n }\n\n get stack(): string {\n return this._stack;\n }\n\n get app(): string | undefined {\n return this._app;\n }\n\n /**\n * A helper function to add a tag to all resources in a stack.\n *\n * Note: tags will be listed in alphabetical order during synthesis.\n *\n * @param key the tag name\n * @param value the value of the tag\n * @param applyToLaunchedInstances whether or not to apply the tag to instances launched in an ASG.\n * @protected\n */\n protected addTag(key: string, value: string, applyToLaunchedInstances: boolean = true): void {\n // TODO add validation for `key` and `value`\n // see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html\n Tags.of(this).add(key, value, { applyToLaunchedInstances });\n }\n\n /**\n * Returns all the parameters on this stack.\n *\n * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html\n */\n get parameters(): Record<string, CfnParameter> {\n return this.node\n .findAll()\n .filter((construct) => construct instanceof CfnParameter)\n .reduce((acc, param) => ({ ...acc, [param.node.id]: param as CfnParameter }), {});\n }\n\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App\n constructor(scope: App, id: string, props: GuStackProps) {\n const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;\n\n super(scope, id, {\n ...props,\n stackName: cloudFormationStackName,\n\n // TODO Use `DefaultStackSynthesizer` or create own synthesizer?\n // see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth\n synthesizer: new LegacyStackSynthesizer(),\n });\n\n this._stack = stack;\n this._stage = stage.toUpperCase();\n\n if (!withoutTags) {\n this.addTag(TrackingTag.Key, TrackingTag.Value);\n\n this.addTag(\"Stack\", this.stack);\n this.addTag(\"Stage\", this.stage);\n if (this.app) {\n this.addTag(\"App\", this.app);\n }\n\n this.tryAddRepositoryTag();\n }\n\n if (!props.withoutMetadata) {\n Aspects.of(this).add(new Metadata(this));\n }\n\n Aspects.of(this).add(new CfnIncludeReporter());\n Aspects.of(this).add(new CfnParameterReporter());\n }\n\n /**\n * Adds a tag to resources in the stack for the repository name.\n * The value is retrieved in the following order:\n * 1. From the context\n * 2. From git config\n *\n * @private\n */\n private tryAddRepositoryTag(): void {\n try {\n const urlFromContext = this.node.tryGetContext(ContextKeys.REPOSITORY_URL) as string | undefined;\n const repositoryUrl: string = urlFromContext ?? gitRemoteOriginUrl();\n const repositoryName = gitUrlParse(repositoryUrl).full_name;\n this.addTag(MetadataKeys.REPOSITORY_NAME, repositoryName);\n } catch {\n console.info(\n `Unable to find git repository name. Set the ${ContextKeys.REPOSITORY_URL} context value or configure a git remote`\n );\n }\n }\n\n /**\n * Override the auto-generated logical ID for a resource, in the generated CloudFormation template, with a static one.\n *\n * Of particular use when migrating a JSON/YAML CloudFormation template into GuCDK.\n * It's generally advised to retain the logical ID for stateful resources, such as databases or buckets.\n *\n * Let's say we have a YAML template:\n *\n * ```yaml\n * AWSTemplateFormatVersion: '2010-09-09'\n * Resources:\n * UsesTable:\n * Type: AWS::DynamoDB::Table\n * Properties:\n * TableName: !Sub 'users-${stage}'\n * ```\n *\n * When moving to GuCDK we'll have this:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n * }\n * }\n *\n * During synthesis, CDK auto-generates logical IDs, so we'll have a stack with a DynamoDB table named 'UsersTable<SOME GUID>', NOT `UsersTable`.\n * That is, the `UsersTable` table will be deleted.\n *\n * In order to retain the original ID from the YAML template, we will do:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * const table = new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n *\n * this.overrideLogicalId(table, { logicalId: \"UsersTable\", reason: \"Retaining a stateful resource from the YAML template\" });\n * }\n * }\n *\n * @param construct The (stateful) resource to retain the logical ID of.\n * @param logicalId The logical ID of the resource (as defined in the JSON/YAML template.\n * @param reason A small explanation to keep the logical ID. Mainly used to help future developers.\n */\n public overrideLogicalId(construct: IConstruct, { logicalId, reason }: GuStaticLogicalId): void {\n const {\n node: { id, defaultChild },\n } = construct;\n\n (defaultChild as CfnElement).overrideLogicalId(logicalId);\n Annotations.of(construct).addInfo(`Setting logical ID for ${id} to ${logicalId}. Reason: ${reason}`);\n }\n}\n\n/**\n * A GuStack but designed for Stack Set instances.\n *\n * In a stack set application, `GuStackForStackSetInstance` is used to represent the infrastructure to provision in target AWS accounts.\n */\nexport class GuStackForStackSetInstance extends GuStack {\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStackForStackSet should have a unique `App`\n constructor(id: string, props: GuStackProps) {\n super(new App(), id, props);\n }\n\n get cfnJson(): string {\n return JSON.stringify(Template.fromStack(this).toJSON(), null, 2);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/constructs/core/stack.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2G;AAE3G,uDAAkD;AAElD,kEAAwC;AACxC,6EAAwE;AACxE,iFAA4E;AAC5E,qDAAkD;AAClD,+CAAyE;AACzE,yCAAqD;AAqCrD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,OAAQ,SAAQ,mBAAK;IAKhC,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,GAAG;QACL,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EACJ,IAAI,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,GAC3B,GAAG,SAAS,CAAC;QAEb,YAA2B,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC1D,yBAAW,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,OAAO,SAAS,aAAa,MAAM,EAAE,CAAC,CAAC;IACvG,CAAC;CACF;AApKD,0BAoKC;AAED;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,OAAO;IACrD,4GAA4G;IAC5G,YAAY,EAAU,EAAE,KAAmB;QACzC,KAAK,CAAC,IAAI,iBAAG,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,qBAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;CACF;AATD,gEASC","sourcesContent":["import { Annotations, App, Aspects, CfnParameter, LegacyStackSynthesizer, Stack, Tags } from \"aws-cdk-lib\";\nimport type { CfnElement, StackProps } from \"aws-cdk-lib\";\nimport { Template } from \"aws-cdk-lib/assertions\";\nimport type { IConstruct } from \"constructs\";\nimport gitUrlParse from \"git-url-parse\";\nimport { CfnIncludeReporter } from \"../../aspects/cfn-include-reporter\";\nimport { CfnParameterReporter } from \"../../aspects/cfn-parameter-reporter\";\nimport { Metadata } from \"../../aspects/metadata\";\nimport { ContextKeys, MetadataKeys, TrackingTag } from \"../../constants\";\nimport { gitRemoteOriginUrl } from \"../../utils/git\";\nimport type { StackStageIdentity } from \"./identity\";\nimport type { GuStaticLogicalId } from \"./migrating\";\n\nexport interface GuStackProps extends Omit<StackProps, \"stackName\"> {\n /**\n * The Guardian stack being used (as defined in your riff-raff.yaml).\n * This will be applied as a tag to all of your resources.\n */\n stack: string;\n\n stage: string;\n\n /**\n * Optional name of the app. If defined, all resources will have an App tag.\n */\n app?: string;\n\n /**\n * The AWS CloudFormation stack name (as shown in the AWS CloudFormation UI).\n * @defaultValue the `GU_CFN_STACK_NAME` environment variable\n */\n cloudFormationStackName?: string;\n /**\n * Set this to true to stop the GuStack from tagging all of your AWS resources.\n * This should only be turned on as part of an initial migration from CloudFormation.\n */\n withoutTags?: boolean;\n\n /**\n * Set to disable CDK metadata. Only for internal use (for disabling for some\n * snapshot tests). We rely on tracking data to prioritise future work so\n * please do not override this.\n */\n withoutMetadata?: boolean;\n}\n\n/**\n * GuStack provides the `stack` and `stage` parameters to a template.\n * It also takes the `app` in the constructor.\n *\n * GuStack will add the Stack, Stage and App tags to all resources.\n *\n * GuStack also adds the tag `X-Gu-CDK-Version`.\n * This tag allows us to measure adoption of this library.\n * It's value is the version of guardian/cdk being used, as defined in `package.json`.\n * As a result, the change sets between version numbers will be fairly noisy,\n * as all resources receive a tag update.\n * It is recommended to upgrade the version of @guardian/cdk being used in two steps:\n * 1. Bump the library, apply the tag updates\n * 2. Make any other stack changes\n *\n * Typical usage is to extend GuStack:\n *\n * ```typescript\n * class MyStack extends GuStack {\n * constructor(scope: App, id: string, props: GuStackProps) {\n * super(scope, id, props)\n * }\n *\n * // add resources here\n * }\n * ```\n */\nexport class GuStack extends Stack implements StackStageIdentity {\n private readonly _stack: string;\n private readonly _stage: string;\n private readonly _app?: string;\n\n get stage(): string {\n return this._stage;\n }\n\n get stack(): string {\n return this._stack;\n }\n\n get app(): string | undefined {\n return this._app;\n }\n\n /**\n * A helper function to add a tag to all resources in a stack.\n *\n * Note: tags will be listed in alphabetical order during synthesis.\n *\n * @param key the tag name\n * @param value the value of the tag\n * @param applyToLaunchedInstances whether or not to apply the tag to instances launched in an ASG.\n * @protected\n */\n protected addTag(key: string, value: string, applyToLaunchedInstances: boolean = true): void {\n // TODO add validation for `key` and `value`\n // see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html\n Tags.of(this).add(key, value, { applyToLaunchedInstances });\n }\n\n /**\n * Returns all the parameters on this stack.\n *\n * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html\n */\n get parameters(): Record<string, CfnParameter> {\n return this.node\n .findAll()\n .filter((construct) => construct instanceof CfnParameter)\n .reduce((acc, param) => ({ ...acc, [param.node.id]: param as CfnParameter }), {});\n }\n\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStack is the exception as it must take an App\n constructor(scope: App, id: string, props: GuStackProps) {\n const { cloudFormationStackName = process.env.GU_CFN_STACK_NAME, stack, stage, withoutTags } = props;\n\n super(scope, id, {\n ...props,\n stackName: cloudFormationStackName,\n\n // TODO Use `DefaultStackSynthesizer` or create own synthesizer?\n // see https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html#bootstrapping-custom-synth\n synthesizer: new LegacyStackSynthesizer(),\n });\n\n this._stack = stack;\n this._stage = stage.toUpperCase();\n\n if (!withoutTags) {\n this.addTag(TrackingTag.Key, TrackingTag.Value);\n\n this.addTag(\"Stack\", this.stack);\n this.addTag(\"Stage\", this.stage);\n if (this.app) {\n this.addTag(\"App\", this.app);\n }\n\n this.tryAddRepositoryTag();\n }\n\n if (!props.withoutMetadata) {\n Aspects.of(this).add(new Metadata(this));\n }\n\n Aspects.of(this).add(new CfnIncludeReporter());\n Aspects.of(this).add(new CfnParameterReporter());\n }\n\n /**\n * Adds a tag to resources in the stack for the repository name.\n * The value is retrieved in the following order:\n * 1. From the context\n * 2. From git config\n *\n * @private\n */\n private tryAddRepositoryTag(): void {\n try {\n const urlFromContext = this.node.tryGetContext(ContextKeys.REPOSITORY_URL) as string | undefined;\n const repositoryUrl: string = urlFromContext ?? gitRemoteOriginUrl();\n const repositoryName = gitUrlParse(repositoryUrl).full_name;\n this.addTag(MetadataKeys.REPOSITORY_NAME, repositoryName);\n } catch {\n console.info(\n `Unable to find git repository name. Set the ${ContextKeys.REPOSITORY_URL} context value or configure a git remote`\n );\n }\n }\n\n /**\n * Override the auto-generated logical ID for a resource, in the generated CloudFormation template, with a static one.\n *\n * Of particular use when migrating a JSON/YAML CloudFormation template into GuCDK.\n * It's generally advised to retain the logical ID for stateful resources, such as databases or buckets.\n *\n * Let's say we have a YAML template:\n *\n * ```yaml\n * AWSTemplateFormatVersion: '2010-09-09'\n * Resources:\n * UsesTable:\n * Type: AWS::DynamoDB::Table\n * Properties:\n * TableName: !Sub 'users-${stage}'\n * ```\n *\n * When moving to GuCDK we'll have this:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n * }\n * }\n *\n * During synthesis, CDK auto-generates logical IDs, so we'll have a stack with a DynamoDB table named 'UsersTable<SOME GUID>', NOT `UsersTable`.\n * That is, the `UsersTable` table will be deleted.\n *\n * In order to retain the original ID from the YAML template, we will do:\n *\n * class MyStack extends GuStack {\n * constructor(app: App, id: string, props: GuStackProps) {\n * super(app, id, props);\n *\n * const { stage } = this;\n *\n * const table = new Table(this, \"UsersTable\", {\n * name: `users-${stage}`\n * });\n *\n * this.overrideLogicalId(table, { logicalId: \"UsersTable\", reason: \"Retaining a stateful resource from the YAML template\" });\n * }\n * }\n *\n * @param construct The (stateful) resource to retain the logical ID of.\n * @param logicalId The logical ID of the resource (as defined in the JSON/YAML template.\n * @param reason A small explanation to keep the logical ID. Mainly used to help future developers.\n */\n public overrideLogicalId(construct: IConstruct, { logicalId, reason }: GuStaticLogicalId): void {\n const {\n node: { id, defaultChild },\n } = construct;\n\n (defaultChild as CfnElement).overrideLogicalId(logicalId);\n Annotations.of(construct).addInfo(`Setting logical ID for ${id} to ${logicalId}. Reason: ${reason}`);\n }\n}\n\n/**\n * A GuStack but designed for Stack Set instances.\n *\n * In a stack set application, `GuStackForStackSetInstance` is used to represent the infrastructure to provision in target AWS accounts.\n */\nexport class GuStackForStackSetInstance extends GuStack {\n // eslint-disable-next-line custom-rules/valid-constructors -- GuStackForStackSet should have a unique `App`\n constructor(id: string, props: GuStackProps) {\n super(new App(), id, props);\n }\n\n get cfnJson(): string {\n return JSON.stringify(Template.fromStack(this).toJSON(), null, 2);\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import type { GuStack } from "../core";
|
|
|
3
3
|
interface VpcFromIdProps extends Omit<VpcAttributes, "availabilityZones"> {
|
|
4
4
|
availabilityZones?: string[];
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
type VpcFromIdParameterProps = Omit<VpcFromIdProps, "vpcId">;
|
|
7
7
|
export declare enum SubnetType {
|
|
8
8
|
PUBLIC = "Public",
|
|
9
9
|
PRIVATE = "Private"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/ec2/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,UAAU,cAAe,SAAQ,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC;IACvE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,
|
|
1
|
+
{"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/ec2/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,UAAU,cAAe,SAAQ,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC;IACvE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,KAAK,uBAAuB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAG7D,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAGD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD,eAAO,MAAM,QAAQ,WAAY;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,MAA0B,CAAC;AAE/E,qBAAa,KAAK;IAChB,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE;IAkB5D,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,EAAE;IAc7E,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAOtE,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,uBAAuB,GAAG,IAAI;CAI1F"}
|
|
@@ -29,17 +29,17 @@ import { AppIdentity } from "../core";
|
|
|
29
29
|
* }
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type RepositoryContainer = {
|
|
33
33
|
repository: IRepository;
|
|
34
34
|
version: string;
|
|
35
35
|
type: "repository";
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type RegistryContainer = {
|
|
38
38
|
id?: string;
|
|
39
39
|
type: "registry";
|
|
40
40
|
};
|
|
41
|
-
export
|
|
42
|
-
export
|
|
41
|
+
export type ContainerConfiguration = RepositoryContainer | RegistryContainer;
|
|
42
|
+
export type GuEcsTaskMonitoringProps = {
|
|
43
43
|
snsTopicArn: string;
|
|
44
44
|
noMonitoring: false;
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecs-task.d.ts","sourceRoot":"","sources":["../../../src/constructs/ecs/ecs-task.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AASvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAsB,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,
|
|
1
|
+
{"version":3,"file":"ecs-task.d.ts","sourceRoot":"","sources":["../../../src/constructs/ecs/ecs-task.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AASvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAsB,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,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Stack } from "../../core";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type GuPolicyProps = PolicyProps;
|
|
5
|
+
export type GuNoStatementsPolicyProps = Omit<GuPolicyProps, "statements">;
|
|
6
6
|
export declare class GuPolicy extends Policy {
|
|
7
7
|
constructor(scope: GuStack, id: string, props: GuPolicyProps);
|
|
8
8
|
}
|
|
@@ -10,7 +10,7 @@ export interface GuAllowPolicyProps extends GuNoStatementsPolicyProps {
|
|
|
10
10
|
actions: string[];
|
|
11
11
|
resources: string[];
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type GuDenyPolicyProps = GuAllowPolicyProps;
|
|
14
14
|
export declare class GuAllowPolicy extends GuPolicy {
|
|
15
15
|
constructor(scope: GuStack, id: string, props: GuAllowPolicyProps);
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-policy.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/policies/base-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAmB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"base-policy.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/policies/base-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAmB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC;AAExC,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAE1E,qBAAa,QAAS,SAAQ,MAAM;gBACtB,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;CAG7D;AAED,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACnE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AACD,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAEnD,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;CAWlE;AAED,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAWjE"}
|
|
@@ -11,7 +11,7 @@ export interface GuInstanceRoleProps {
|
|
|
11
11
|
withoutLogShipping?: boolean;
|
|
12
12
|
additionalPolicies?: GuPolicy[];
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type GuInstanceRolePropsWithApp = GuInstanceRoleProps & AppIdentity;
|
|
15
15
|
declare const GuInstanceRole_base: {
|
|
16
16
|
new (...args: any[]): {
|
|
17
17
|
readonly idWithApp: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance-role.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/instance-role.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;CACjC;AAED,
|
|
1
|
+
{"version":3,"file":"instance-role.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/instance-role.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC;CACjC;AAED,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAAG,WAAW,CAAC;;;;;;AAE3E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAe,SAAQ,mBAA2B;gBACjD,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,0BAA0B;CAsB9D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Role } from "aws-cdk-lib/aws-iam";
|
|
2
2
|
import type { RoleProps } from "aws-cdk-lib/aws-iam";
|
|
3
3
|
import type { GuStack } from "../../core";
|
|
4
|
-
export
|
|
4
|
+
export type GuRoleProps = RoleProps;
|
|
5
5
|
export declare class GuRole extends Role {
|
|
6
6
|
constructor(scope: GuStack, id: string, props: GuRoleProps);
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../../src/constructs/iam/roles/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC;AAEpC,qBAAa,MAAO,SAAQ,IAAI;gBAClB,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;CAG3D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Stream } from "aws-cdk-lib/aws-kinesis";
|
|
2
2
|
import type { StreamProps } from "aws-cdk-lib/aws-kinesis";
|
|
3
3
|
import type { GuStack } from "../core";
|
|
4
|
-
export
|
|
4
|
+
export type GuKinesisStreamProps = StreamProps;
|
|
5
5
|
/**
|
|
6
6
|
* Construct which creates a Kinesis stream.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinesis-stream.d.ts","sourceRoot":"","sources":["../../../src/constructs/kinesis/kinesis-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,
|
|
1
|
+
{"version":3,"file":"kinesis-stream.d.ts","sourceRoot":"","sources":["../../../src/constructs/kinesis/kinesis-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;gBAC7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB;CAGrE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { VpcProps } from "aws-cdk-lib/aws-ec2";
|
|
2
2
|
import { Vpc } from "aws-cdk-lib/aws-ec2";
|
|
3
3
|
import type { GuStack } from "../core";
|
|
4
|
-
export
|
|
4
|
+
export type GuVpcProps = VpcProps;
|
|
5
5
|
/**
|
|
6
6
|
* Construct which creates a Virtual Private Cloud.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAA4C,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,
|
|
1
|
+
{"version":3,"file":"vpc.d.ts","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAA4C,GAAG,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,KAAM,SAAQ,GAAG;IAC5B;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;gBAc7B,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU;CA4B3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpc.js","sourceRoot":"","sources":["../../../src/constructs/vpc/vpc.ts"],"names":[],"mappings":";;;AAAA,6C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AU,CAAC,8BAA8B,OAAO,mBAAmB,EAAE;YACxE,YAAY;YACZ,YAAY;YACZ,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAED,YAAY,KAAc,EAAE,EAAU,EAAE,KAAkB;QACxD,MAAM,eAAe,GAAa;YAChC,gBAAgB,EAAE;gBAChB,EAAE,EAAE;oBACF,OAAO,EAAE,sCAA4B,CAAC,EAAE;iBACzC;gBACD,QAAQ,EAAE;oBACR,OAAO,EAAE,sCAA4B,CAAC,QAAQ;iBAC/C;aACF;YAED,mBAAmB,EAAE;gBACnB;oBACE,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,oBAAU,CAAC,MAAM;iBAC9B;gBACD;oBACE,IAAI,EAAE,aAAa;oBACnB,UAAU,EAAE,oBAAU,CAAC,mBAAmB;iBAC3C;aACF;SACF,CAAC;QAEF,8GAA8G;QAC9G,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;QAExC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,eAAe,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;CACF;AAnDD,sBAmDC","sourcesContent":["import { Token } from \"aws-cdk-lib\";\nimport type { VpcProps } from \"aws-cdk-lib/aws-ec2\";\nimport { GatewayVpcEndpointAwsService, SubnetType, Vpc } from \"aws-cdk-lib/aws-ec2\";\nimport type { GuStack } from \"../core\";\n\nexport type GuVpcProps = VpcProps;\n\n/**\n * Construct which creates a Virtual Private Cloud.\n *\n * NOTE: This construct requires an\n * [environment](https://docs.aws.amazon.com/cdk/latest/guide/environments.html)\n * to be set to function correctly. Without this, an environment-agnostic\n * template will be produced, which will only use two AZs even if the region\n * contains more than that. To set this, set the `env` prop when instantiating\n * your stack.\n *\n * NOTE: If using this construct outside eu-west-1, you'll need to commit the\n * `cdk.context.json` file that's created after synthesising locally.\n *\n * Be aware that account IDs are considered sensitive information and should NOT\n * be committed to public repos.\n *\n * The VPC is provisioned with a public and private subnet for each availability\n * zone, with IPs spread evenly across these. Instances in private subnets\n * cannot be accessed directly over the internet. You should locate services in\n * instances in the private subnets, and provide HTTP(S) as required via load\n * balancers living in the public subnets.\n *\n * A CIDR block is a combined IP and network mask that specifies the IP\n * addresses in your VPC. For testing purposes any (AWS supported) CIDR block\n * will do, but for production you should:\n *\n * - use a /21 network mask (providing up to 2048 IPs, which is plenty for most\n * accounts)\n * - ask Enterprise Tech for an IP address to go with this range (so that\n * peering with other company VPCs is possible without IP clashes)\n *\n * A managed NAT is created for each private subnet to allow access to the\n * internet.\n *\n * For recommendations on how best to configure your VPC see:\n * https://github.com/guardian/recommendations/blob/main/AWS.md#vpc\n *\n * For more information on VPCs and AWS see:\n * https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html.\n */\nexport class GuVpc extends Vpc {\n /**\n * Programmatically sets the CDK context with a list of AZs for eu-west-1.\n * This means consuming stacks do NOT have to commit a `cdk.context.json`\n * file when using this construct in eu-west-1.\n *\n * @throws {Error} if the account ID has not been explicitly set on the parent GuStack\n * @private\n */\n private static setAvailabilityZoneContext({ account, node }: GuStack) {\n if (Token.isUnresolved(account)) {\n throw new Error(\n `Account ID not set - the resulting VPC might not be shaped how you'd expect. See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html#env`\n );\n }\n\n node.setContext(`availability-zones:account=${account}:region=eu-west-1`, [\n \"eu-west-1a\",\n \"eu-west-1b\",\n \"eu-west-1c\",\n ]);\n }\n\n constructor(scope: GuStack, id: string, props?: GuVpcProps) {\n const defaultVpcProps: VpcProps = {\n gatewayEndpoints: {\n s3: {\n service: GatewayVpcEndpointAwsService.S3,\n },\n dynamodb: {\n service: GatewayVpcEndpointAwsService.DYNAMODB,\n },\n },\n\n subnetConfiguration: [\n {\n name: \"ingress\",\n subnetType: SubnetType.PUBLIC,\n },\n {\n name: \"application\",\n subnetType: SubnetType.PRIVATE_WITH_EGRESS,\n },\n ],\n };\n\n // Set the context BEFORE the `super` call to avoid `Error: Cannot set context after children have been added`\n GuVpc.setAvailabilityZoneContext(scope);\n\n super(scope, id, { ...defaultVpcProps, ...props });\n }\n}\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { CfnRuleGroupsNamespace } from "aws-cdk-lib/aws-aps";
|
|
2
1
|
import type { IMetric } from "aws-cdk-lib/aws-cloudwatch";
|
|
3
2
|
import { Construct } from "constructs";
|
|
4
3
|
import type { GuStack } from "../../constructs/core";
|
|
5
|
-
export interface
|
|
4
|
+
export interface ErrorBudgetAlarmProps {
|
|
6
5
|
/**
|
|
7
6
|
* The name of the SLO. Assumed to be unique per stack.
|
|
8
7
|
*/
|
|
@@ -24,21 +23,6 @@ export interface CloudWatchErrorBudgetAlarmProps {
|
|
|
24
23
|
*/
|
|
25
24
|
snsTopicNameForAlerts: string;
|
|
26
25
|
}
|
|
27
|
-
export interface PrometheusErrorBudgetAlarmProps {
|
|
28
|
-
/**
|
|
29
|
-
* The name of the SLO. Assumed to be unique per stack.
|
|
30
|
-
*/
|
|
31
|
-
sloName: string;
|
|
32
|
-
/**
|
|
33
|
-
* The percentage target for the SLO, expressed as a decimal floating point number. Must be between 0.95 and 0.995.
|
|
34
|
-
*/
|
|
35
|
-
sloTarget: number;
|
|
36
|
-
badEvents: string;
|
|
37
|
-
validEvents: string;
|
|
38
|
-
}
|
|
39
|
-
export declare class GuPrometheusErrorBudgetAlarmExperimental extends CfnRuleGroupsNamespace {
|
|
40
|
-
constructor(scope: GuStack, props: PrometheusErrorBudgetAlarmProps);
|
|
41
|
-
}
|
|
42
26
|
/**
|
|
43
27
|
* Use this construct to create alarms that will notify you when you are at risk of missing your SLO targets.
|
|
44
28
|
*
|
|
@@ -68,6 +52,6 @@ export declare class GuPrometheusErrorBudgetAlarmExperimental extends CfnRuleGro
|
|
|
68
52
|
* and for a description of the props that need to be passed see [[ErrorBudgetAlarmProps]]
|
|
69
53
|
*/
|
|
70
54
|
export declare class GuErrorBudgetAlarmExperimental extends Construct {
|
|
71
|
-
constructor(scope: GuStack, props:
|
|
55
|
+
constructor(scope: GuStack, props: ErrorBudgetAlarmProps);
|
|
72
56
|
}
|
|
73
57
|
//# sourceMappingURL=error-budget-alarm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-budget-alarm.d.ts","sourceRoot":"","sources":["../../../src/experimental/constructs/error-budget-alarm.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"error-budget-alarm.d.ts","sourceRoot":"","sources":["../../../src/experimental/constructs/error-budget-alarm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAa7E,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,8BAA+B,SAAQ,SAAS;gBAC/C,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,qBAAqB;CAsEzD"}
|