@gradientedge/cdk-utils 8.91.0 → 8.92.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/.eslintrc.json +40 -0
- package/app/api-destined-function/src/lib/lambda.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.d.ts +6 -6
- package/dist/app/api-destined-function/src/lib/lambda.js +6 -6
- package/dist/lib/lambda.d.ts +6 -6
- package/dist/lib/lambda.js +6 -6
- package/dist/lib/lambda.js.map +1 -1
- package/dist/src/lib/common/construct.d.ts +4 -7
- package/dist/src/lib/common/construct.js +4 -7
- package/dist/src/lib/common/stack.d.ts +9 -13
- package/dist/src/lib/common/stack.js +9 -13
- package/dist/src/lib/common/types.d.ts +0 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/event.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +0 -27
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +41 -68
- package/dist/src/lib/construct/api-to-eventbridge-target/types.d.ts +13 -25
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.js +0 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +0 -37
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +44 -81
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/types.d.ts +1 -5
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/api.js +0 -3
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +0 -14
- package/dist/src/lib/construct/api-to-lambda-target/main.js +7 -21
- package/dist/src/lib/construct/api-to-lambda-target/types.d.ts +7 -13
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +0 -18
- package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/graphql-api-lambda/types.d.ts +4 -8
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +1 -12
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +0 -12
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +2 -14
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +0 -18
- package/dist/src/lib/construct/rest-api-lambda/main.js +1 -19
- package/dist/src/lib/construct/rest-api-lambda/types.d.ts +6 -10
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +0 -11
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +3 -14
- package/dist/src/lib/construct/rest-api-lambda-with-cache/types.d.ts +1 -3
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -25
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +32 -52
- package/dist/src/lib/construct/site-with-ecs-backend/types.d.ts +10 -11
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +0 -8
- package/dist/src/lib/construct/static-asset-deployment/main.js +0 -8
- package/dist/src/lib/construct/static-asset-deployment/types.d.ts +1 -1
- package/dist/src/lib/construct/static-site/main.d.ts +0 -17
- package/dist/src/lib/construct/static-site/main.js +1 -18
- package/dist/src/lib/construct/static-site/types.d.ts +9 -11
- package/dist/src/lib/services/aws/api-gateway/main.d.ts +21 -25
- package/dist/src/lib/services/aws/api-gateway/main.js +42 -46
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -2
- package/dist/src/lib/services/aws/appconfig/constants.d.ts +0 -6
- package/dist/src/lib/services/aws/appconfig/constants.js +26 -32
- package/dist/src/lib/services/aws/appconfig/main.d.ts +16 -19
- package/dist/src/lib/services/aws/appconfig/main.js +19 -22
- package/dist/src/lib/services/aws/appconfig/types.d.ts +1 -3
- package/dist/src/lib/services/aws/certificate-manager/main.d.ts +5 -10
- package/dist/src/lib/services/aws/certificate-manager/main.js +5 -10
- package/dist/src/lib/services/aws/certificate-manager/types.d.ts +3 -5
- package/dist/src/lib/services/aws/cloudfront/main.d.ts +41 -47
- package/dist/src/lib/services/aws/cloudfront/main.js +56 -62
- package/dist/src/lib/services/aws/cloudfront/types.d.ts +1 -7
- package/dist/src/lib/services/aws/cloudtrail/main.d.ts +8 -12
- package/dist/src/lib/services/aws/cloudtrail/main.js +8 -12
- package/dist/src/lib/services/aws/cloudtrail/types.d.ts +0 -2
- package/dist/src/lib/services/aws/cloudwatch/logs.d.ts +11 -15
- package/dist/src/lib/services/aws/cloudwatch/logs.js +15 -19
- package/dist/src/lib/services/aws/cloudwatch/main.d.ts +80 -84
- package/dist/src/lib/services/aws/cloudwatch/main.js +116 -122
- package/dist/src/lib/services/aws/cloudwatch/types.d.ts +20 -42
- package/dist/src/lib/services/aws/codebuild/main.d.ts +0 -4
- package/dist/src/lib/services/aws/codebuild/main.js +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.d.ts +3 -7
- package/dist/src/lib/services/aws/dynamodb/main.js +13 -17
- package/dist/src/lib/services/aws/dynamodb/types.d.ts +0 -2
- package/dist/src/lib/services/aws/elastic-container-registry/main.d.ts +3 -7
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +3 -7
- package/dist/src/lib/services/aws/elastic-container-service/main.d.ts +19 -23
- package/dist/src/lib/services/aws/elastic-container-service/main.js +35 -39
- package/dist/src/lib/services/aws/elastic-container-service/types.d.ts +1 -9
- package/dist/src/lib/services/aws/elastic-file-system/main.d.ts +9 -13
- package/dist/src/lib/services/aws/elastic-file-system/main.js +14 -18
- package/dist/src/lib/services/aws/elastic-file-system/types.d.ts +1 -5
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.d.ts +5 -9
- package/dist/src/lib/services/aws/elastic-kubernetes-service/main.js +8 -12
- package/dist/src/lib/services/aws/elastic-kubernetes-service/types.d.ts +1 -3
- package/dist/src/lib/services/aws/elasticache/main.d.ts +14 -18
- package/dist/src/lib/services/aws/elasticache/main.js +35 -39
- package/dist/src/lib/services/aws/elasticache/types.d.ts +0 -4
- package/dist/src/lib/services/aws/eventbridge/main.d.ts +25 -29
- package/dist/src/lib/services/aws/eventbridge/main.js +34 -38
- package/dist/src/lib/services/aws/eventbridge/target.d.ts +6 -9
- package/dist/src/lib/services/aws/eventbridge/target.js +8 -10
- package/dist/src/lib/services/aws/eventbridge/types.d.ts +2 -10
- package/dist/src/lib/services/aws/evidently/main.d.ts +15 -19
- package/dist/src/lib/services/aws/evidently/main.js +19 -23
- package/dist/src/lib/services/aws/evidently/types.d.ts +0 -10
- package/dist/src/lib/services/aws/identity-access-management/main.d.ts +66 -70
- package/dist/src/lib/services/aws/identity-access-management/main.js +97 -101
- package/dist/src/lib/services/aws/key-management-service/main.d.ts +3 -7
- package/dist/src/lib/services/aws/key-management-service/main.js +6 -10
- package/dist/src/lib/services/aws/key-management-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/lambda/main.d.ts +42 -47
- package/dist/src/lib/services/aws/lambda/main.js +64 -69
- package/dist/src/lib/services/aws/lambda/types.d.ts +6 -16
- package/dist/src/lib/services/aws/route53/main.d.ts +17 -21
- package/dist/src/lib/services/aws/route53/main.js +19 -23
- package/dist/src/lib/services/aws/route53/types.d.ts +0 -2
- package/dist/src/lib/services/aws/secrets-manager/main.d.ts +6 -19
- package/dist/src/lib/services/aws/secrets-manager/main.js +6 -25
- package/dist/src/lib/services/aws/simple-notification-service/main.d.ts +8 -12
- package/dist/src/lib/services/aws/simple-notification-service/main.js +10 -14
- package/dist/src/lib/services/aws/simple-notification-service/types.d.ts +0 -2
- package/dist/src/lib/services/aws/simple-queue-service/main.d.ts +11 -15
- package/dist/src/lib/services/aws/simple-queue-service/main.js +19 -23
- package/dist/src/lib/services/aws/simple-queue-service/types.d.ts +4 -6
- package/dist/src/lib/services/aws/simple-storage-service/main.d.ts +24 -32
- package/dist/src/lib/services/aws/simple-storage-service/main.js +32 -40
- package/dist/src/lib/services/aws/simple-storage-service/types.d.ts +2 -8
- package/dist/src/lib/services/aws/step-function/main.d.ts +55 -59
- package/dist/src/lib/services/aws/step-function/main.js +91 -95
- package/dist/src/lib/services/aws/step-function/types.d.ts +0 -32
- package/dist/src/lib/services/aws/systems-manager/main.d.ts +10 -16
- package/dist/src/lib/services/aws/systems-manager/main.js +13 -19
- package/dist/src/lib/services/aws/systems-manager/types.d.ts +0 -2
- package/dist/src/lib/services/aws/virtual-private-cloud/main.d.ts +9 -12
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +10 -16
- package/dist/src/lib/services/aws/web-application-firewall/main.d.ts +6 -10
- package/dist/src/lib/services/aws/web-application-firewall/main.js +12 -16
- package/dist/src/lib/services/aws/web-application-firewall/types.d.ts +0 -4
- package/dist/src/lib/types/aws/index.d.ts +0 -2
- package/dist/src/lib/utils/aws/index.d.ts +6 -9
- package/dist/src/lib/utils/aws/index.js +7 -10
- package/dist/src/lib/utils/index.d.ts +6 -13
- package/dist/src/lib/utils/index.js +4 -12
- package/package.json +1 -1
- package/src/lib/common/construct.ts +4 -7
- package/src/lib/common/stack.ts +9 -13
- package/src/lib/common/types.ts +0 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/event.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target/main.ts +41 -68
- package/src/lib/construct/api-to-eventbridge-target/types.ts +13 -25
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +0 -3
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +44 -81
- package/src/lib/construct/api-to-eventbridge-target-with-sns/types.ts +1 -5
- package/src/lib/construct/api-to-lambda-target/api.ts +0 -3
- package/src/lib/construct/api-to-lambda-target/main.ts +7 -21
- package/src/lib/construct/api-to-lambda-target/types.ts +7 -13
- package/src/lib/construct/graphql-api-lambda/main.ts +1 -19
- package/src/lib/construct/graphql-api-lambda/types.ts +4 -8
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +1 -12
- package/src/lib/construct/graphql-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/lambda-with-iam-access/main.ts +2 -14
- package/src/lib/construct/rest-api-lambda/main.ts +1 -19
- package/src/lib/construct/rest-api-lambda/types.ts +6 -10
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +3 -14
- package/src/lib/construct/rest-api-lambda-with-cache/types.ts +1 -3
- package/src/lib/construct/site-with-ecs-backend/main.ts +31 -52
- package/src/lib/construct/site-with-ecs-backend/types.ts +10 -11
- package/src/lib/construct/static-asset-deployment/main.ts +0 -8
- package/src/lib/construct/static-asset-deployment/types.ts +1 -1
- package/src/lib/construct/static-site/main.ts +1 -18
- package/src/lib/construct/static-site/types.ts +9 -11
- package/src/lib/services/aws/api-gateway/main.ts +43 -47
- package/src/lib/services/aws/api-gateway/types.ts +0 -2
- package/src/lib/services/aws/appconfig/constants.ts +26 -32
- package/src/lib/services/aws/appconfig/main.ts +19 -22
- package/src/lib/services/aws/appconfig/types.ts +1 -3
- package/src/lib/services/aws/certificate-manager/main.ts +5 -10
- package/src/lib/services/aws/certificate-manager/types.ts +3 -5
- package/src/lib/services/aws/cloudfront/main.ts +56 -62
- package/src/lib/services/aws/cloudfront/types.ts +1 -7
- package/src/lib/services/aws/cloudtrail/main.ts +8 -12
- package/src/lib/services/aws/cloudtrail/types.ts +0 -2
- package/src/lib/services/aws/cloudwatch/logs.ts +15 -19
- package/src/lib/services/aws/cloudwatch/main.ts +116 -122
- package/src/lib/services/aws/cloudwatch/types.ts +20 -42
- package/src/lib/services/aws/codebuild/main.ts +3 -7
- package/src/lib/services/aws/dynamodb/main.ts +13 -17
- package/src/lib/services/aws/dynamodb/types.ts +0 -2
- package/src/lib/services/aws/elastic-container-registry/main.ts +3 -7
- package/src/lib/services/aws/elastic-container-service/main.ts +35 -39
- package/src/lib/services/aws/elastic-container-service/types.ts +1 -9
- package/src/lib/services/aws/elastic-file-system/main.ts +14 -18
- package/src/lib/services/aws/elastic-file-system/types.ts +1 -5
- package/src/lib/services/aws/elastic-kubernetes-service/main.ts +8 -12
- package/src/lib/services/aws/elastic-kubernetes-service/types.ts +1 -3
- package/src/lib/services/aws/elasticache/main.ts +35 -39
- package/src/lib/services/aws/elasticache/types.ts +0 -4
- package/src/lib/services/aws/eventbridge/main.ts +34 -38
- package/src/lib/services/aws/eventbridge/target.ts +8 -11
- package/src/lib/services/aws/eventbridge/types.ts +2 -10
- package/src/lib/services/aws/evidently/main.ts +19 -23
- package/src/lib/services/aws/evidently/types.ts +0 -10
- package/src/lib/services/aws/identity-access-management/main.ts +97 -101
- package/src/lib/services/aws/key-management-service/main.ts +6 -10
- package/src/lib/services/aws/key-management-service/types.ts +0 -2
- package/src/lib/services/aws/lambda/main.ts +64 -69
- package/src/lib/services/aws/lambda/types.ts +6 -16
- package/src/lib/services/aws/route53/main.ts +19 -23
- package/src/lib/services/aws/route53/types.ts +0 -2
- package/src/lib/services/aws/secrets-manager/main.ts +6 -28
- package/src/lib/services/aws/simple-notification-service/main.ts +10 -14
- package/src/lib/services/aws/simple-notification-service/types.ts +0 -2
- package/src/lib/services/aws/simple-queue-service/main.ts +19 -23
- package/src/lib/services/aws/simple-queue-service/types.ts +4 -6
- package/src/lib/services/aws/simple-storage-service/main.ts +32 -40
- package/src/lib/services/aws/simple-storage-service/types.ts +2 -8
- package/src/lib/services/aws/step-function/main.ts +91 -95
- package/src/lib/services/aws/step-function/types.ts +0 -32
- package/src/lib/services/aws/systems-manager/main.ts +13 -19
- package/src/lib/services/aws/systems-manager/types.ts +0 -2
- package/src/lib/services/aws/virtual-private-cloud/main.ts +10 -16
- package/src/lib/services/aws/web-application-firewall/main.ts +12 -16
- package/src/lib/services/aws/web-application-firewall/types.ts +0 -4
- package/src/lib/types/aws/index.ts +0 -2
- package/src/lib/utils/aws/index.ts +7 -10
- package/src/lib/utils/index.ts +4 -12
|
@@ -3,9 +3,6 @@ import * as cdk from 'aws-cdk-lib';
|
|
|
3
3
|
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
|
|
4
4
|
import { CommonConstruct } from '../../../common';
|
|
5
5
|
/**
|
|
6
|
-
* @stability experimental
|
|
7
|
-
* @category cdk-utils.secrets-manager
|
|
8
|
-
* @subcategory Construct
|
|
9
6
|
* @classdesc Provides operations on AWS Secrets Manager.
|
|
10
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -19,31 +16,21 @@ import { CommonConstruct } from '../../../common';
|
|
|
19
16
|
* this.secretsManager.loadSecret('MySecretName', 'eu-west-1')
|
|
20
17
|
* }
|
|
21
18
|
* }
|
|
22
|
-
*
|
|
23
19
|
* @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
|
|
24
20
|
*/
|
|
25
21
|
export declare class SecretsManager {
|
|
26
22
|
/**
|
|
27
23
|
*
|
|
28
|
-
* @param
|
|
24
|
+
* @param region
|
|
29
25
|
*/
|
|
30
26
|
getAwsSecretsManager(region: string): SM;
|
|
31
27
|
/**
|
|
32
|
-
* @stability experimental
|
|
33
28
|
* @summary Method to load a secret from secrets manager
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
29
|
+
* @param secretName
|
|
30
|
+
* @param region
|
|
36
31
|
*/
|
|
37
32
|
loadSecret(secretName: string, region: string): Promise<any>;
|
|
38
33
|
/**
|
|
39
|
-
* @stability experimental
|
|
40
|
-
* @summary Method to load secrets from secrets manager
|
|
41
|
-
* @param {string} secretNames
|
|
42
|
-
* @param {string} region
|
|
43
|
-
*/
|
|
44
|
-
loadSecrets(secretNames: string, region: string): Promise<{}>;
|
|
45
|
-
/**
|
|
46
|
-
* @stability stable
|
|
47
34
|
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
48
35
|
* @param id
|
|
49
36
|
* @param scope
|
|
@@ -53,9 +40,9 @@ export declare class SecretsManager {
|
|
|
53
40
|
retrieveSecretFromSecretsManager(id: string, scope: CommonConstruct, stackName: string, exportName: string): cdk.aws_secretsmanager.ISecret;
|
|
54
41
|
/**
|
|
55
42
|
* @summary Method to create a secret
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
43
|
+
* @param id scoped id of the resource
|
|
44
|
+
* @param scope scope in which this resource is defined
|
|
45
|
+
* @param props the secret properties
|
|
59
46
|
*/
|
|
60
47
|
createSecret(id: string, scope: CommonConstruct, props: secretsManager.SecretProps): cdk.aws_secretsmanager.Secret;
|
|
61
48
|
}
|
|
@@ -29,9 +29,6 @@ const cdk = __importStar(require("aws-cdk-lib"));
|
|
|
29
29
|
const secretsManager = __importStar(require("aws-cdk-lib/aws-secretsmanager"));
|
|
30
30
|
const utils = __importStar(require("../../../utils"));
|
|
31
31
|
/**
|
|
32
|
-
* @stability experimental
|
|
33
|
-
* @category cdk-utils.secrets-manager
|
|
34
|
-
* @subcategory Construct
|
|
35
32
|
* @classdesc Provides operations on AWS Secrets Manager.
|
|
36
33
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
37
34
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -45,22 +42,20 @@ const utils = __importStar(require("../../../utils"));
|
|
|
45
42
|
* this.secretsManager.loadSecret('MySecretName', 'eu-west-1')
|
|
46
43
|
* }
|
|
47
44
|
* }
|
|
48
|
-
*
|
|
49
45
|
* @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
|
|
50
46
|
*/
|
|
51
47
|
class SecretsManager {
|
|
52
48
|
/**
|
|
53
49
|
*
|
|
54
|
-
* @param
|
|
50
|
+
* @param region
|
|
55
51
|
*/
|
|
56
52
|
getAwsSecretsManager(region) {
|
|
57
53
|
return new client_secrets_manager_1.SecretsManager({ region: region });
|
|
58
54
|
}
|
|
59
55
|
/**
|
|
60
|
-
* @stability experimental
|
|
61
56
|
* @summary Method to load a secret from secrets manager
|
|
62
|
-
* @param
|
|
63
|
-
* @param
|
|
57
|
+
* @param secretName
|
|
58
|
+
* @param region
|
|
64
59
|
*/
|
|
65
60
|
async loadSecret(secretName, region) {
|
|
66
61
|
const secretsManager = this.getAwsSecretsManager(region);
|
|
@@ -68,20 +63,6 @@ class SecretsManager {
|
|
|
68
63
|
return secret ? JSON.parse(secret[0].SecretString) : {};
|
|
69
64
|
}
|
|
70
65
|
/**
|
|
71
|
-
* @stability experimental
|
|
72
|
-
* @summary Method to load secrets from secrets manager
|
|
73
|
-
* @param {string} secretNames
|
|
74
|
-
* @param {string} region
|
|
75
|
-
*/
|
|
76
|
-
async loadSecrets(secretNames, region) {
|
|
77
|
-
let secrets = {};
|
|
78
|
-
for (const secretName of secretNames.split(',')) {
|
|
79
|
-
secrets = { ...secrets, ...(await this.loadSecret(secretName, region)) };
|
|
80
|
-
}
|
|
81
|
-
return secrets;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @stability stable
|
|
85
66
|
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
86
67
|
* @param id
|
|
87
68
|
* @param scope
|
|
@@ -93,9 +74,9 @@ class SecretsManager {
|
|
|
93
74
|
}
|
|
94
75
|
/**
|
|
95
76
|
* @summary Method to create a secret
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
77
|
+
* @param id scoped id of the resource
|
|
78
|
+
* @param scope scope in which this resource is defined
|
|
79
|
+
* @param props the secret properties
|
|
99
80
|
*/
|
|
100
81
|
createSecret(id, scope, props) {
|
|
101
82
|
const secret = new secretsManager.Secret(scope, `${id}`, {
|
|
@@ -3,9 +3,6 @@ import * as sns from 'aws-cdk-lib/aws-sns';
|
|
|
3
3
|
import { CommonConstruct } from '../../../common';
|
|
4
4
|
import { SubscriptionProps } from './types';
|
|
5
5
|
/**
|
|
6
|
-
* @stability stable
|
|
7
|
-
* @category cdk-utils.sns-manager
|
|
8
|
-
* @subcategory Construct
|
|
9
6
|
* @classdesc Provides operations on AWS Simple Notification Service.
|
|
10
7
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
11
8
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -19,24 +16,23 @@ import { SubscriptionProps } from './types';
|
|
|
19
16
|
* this.snsManager.createEmailNotificationService('MySns', 'eu-west-1', ["test@example.com"])
|
|
20
17
|
* }
|
|
21
18
|
* }
|
|
22
|
-
*
|
|
23
19
|
* @see [CDK Simple Notification Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns-readme.html}
|
|
24
20
|
*/
|
|
25
21
|
export declare class SnsManager {
|
|
26
22
|
/**
|
|
27
23
|
* @summary Method to create an email notification service
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props
|
|
27
|
+
* @param emails
|
|
32
28
|
*/
|
|
33
29
|
createEmailNotificationService(id: string, scope: CommonConstruct, props: SubscriptionProps, emails: string[]): sns.Topic;
|
|
34
30
|
/**
|
|
35
31
|
* @summary Method to create a lambda notification service
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
32
|
+
* @param id scoped id of the resource
|
|
33
|
+
* @param scope scope in which this resource is defined
|
|
34
|
+
* @param props
|
|
35
|
+
* @param lambdaFunction
|
|
40
36
|
*/
|
|
41
37
|
createLambdaNotificationService(id: string, scope: CommonConstruct, props: SubscriptionProps, lambdaFunction: lambda.IFunction): sns.Topic;
|
|
42
38
|
}
|
|
@@ -28,9 +28,6 @@ const sns = __importStar(require("aws-cdk-lib/aws-sns"));
|
|
|
28
28
|
const subs = __importStar(require("aws-cdk-lib/aws-sns-subscriptions"));
|
|
29
29
|
const utils = __importStar(require("../../../utils"));
|
|
30
30
|
/**
|
|
31
|
-
* @stability stable
|
|
32
|
-
* @category cdk-utils.sns-manager
|
|
33
|
-
* @subcategory Construct
|
|
34
31
|
* @classdesc Provides operations on AWS Simple Notification Service.
|
|
35
32
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
36
33
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -44,24 +41,23 @@ const utils = __importStar(require("../../../utils"));
|
|
|
44
41
|
* this.snsManager.createEmailNotificationService('MySns', 'eu-west-1', ["test@example.com"])
|
|
45
42
|
* }
|
|
46
43
|
* }
|
|
47
|
-
*
|
|
48
44
|
* @see [CDK Simple Notification Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns-readme.html}
|
|
49
45
|
*/
|
|
50
46
|
class SnsManager {
|
|
51
47
|
/**
|
|
52
48
|
* @summary Method to create an email notification service
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props
|
|
52
|
+
* @param emails
|
|
57
53
|
*/
|
|
58
54
|
createEmailNotificationService(id, scope, props, emails) {
|
|
59
55
|
if (!props)
|
|
60
56
|
throw `Subscription props undefined for ${id}`;
|
|
61
57
|
const topic = new sns.Topic(scope, id, {
|
|
62
58
|
displayName: `${props.topicName}-${scope.props.stage}`,
|
|
63
|
-
topicName: `${props.topicName}-${scope.props.stage}`,
|
|
64
59
|
fifo: props.fifo,
|
|
60
|
+
topicName: `${props.topicName}-${scope.props.stage}`,
|
|
65
61
|
});
|
|
66
62
|
if (emails && emails.length > 0) {
|
|
67
63
|
emails.forEach((email) => topic.addSubscription(new subs.EmailSubscription(email)));
|
|
@@ -72,18 +68,18 @@ class SnsManager {
|
|
|
72
68
|
}
|
|
73
69
|
/**
|
|
74
70
|
* @summary Method to create a lambda notification service
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
71
|
+
* @param id scoped id of the resource
|
|
72
|
+
* @param scope scope in which this resource is defined
|
|
73
|
+
* @param props
|
|
74
|
+
* @param lambdaFunction
|
|
79
75
|
*/
|
|
80
76
|
createLambdaNotificationService(id, scope, props, lambdaFunction) {
|
|
81
77
|
if (!props)
|
|
82
78
|
throw `Subscription props undefined for ${id}`;
|
|
83
79
|
const topic = new sns.Topic(scope, id, {
|
|
84
80
|
displayName: `${props.topicName}-${scope.props.stage}`,
|
|
85
|
-
topicName: `${props.topicName}-${scope.props.stage}`,
|
|
86
81
|
fifo: props.fifo,
|
|
82
|
+
topicName: `${props.topicName}-${scope.props.stage}`,
|
|
87
83
|
});
|
|
88
84
|
topic.addSubscription(new subs.LambdaSubscription(lambdaFunction));
|
|
89
85
|
utils.createCfnOutput(`${id}-subscriptionArn`, scope, topic.topicArn);
|
|
@@ -4,9 +4,6 @@ import { CommonConstruct } from '../../../common';
|
|
|
4
4
|
import { QueueProps } from './types';
|
|
5
5
|
import { LambdaProps } from '../lambda';
|
|
6
6
|
/**
|
|
7
|
-
* @stability stable
|
|
8
|
-
* @category cdk-utils.sqs-manager
|
|
9
|
-
* @subcategory Construct
|
|
10
7
|
* @classdesc Provides operations on AWS Simple Queue Service.
|
|
11
8
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
12
9
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -20,31 +17,30 @@ import { LambdaProps } from '../lambda';
|
|
|
20
17
|
* this.sqsManager.createQueue('MySqs', this, {...})
|
|
21
18
|
* }
|
|
22
19
|
* }
|
|
23
|
-
*
|
|
24
20
|
* @see [CDK Simple Queue Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs-readme.html}
|
|
25
21
|
*/
|
|
26
22
|
export declare class SqsManager {
|
|
27
23
|
/**
|
|
28
24
|
* @summary Method to create a lambda queue service
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
25
|
+
* @param id scoped id of the resource
|
|
26
|
+
* @param scope scope in which this resource is defined
|
|
27
|
+
* @param props
|
|
28
|
+
* @param deadLetterQueue
|
|
33
29
|
*/
|
|
34
30
|
createQueue(id: string, scope: CommonConstruct, props: QueueProps, deadLetterQueue?: sqs.IQueue): cdk.aws_sqs.Queue;
|
|
35
31
|
/**
|
|
36
32
|
* @summary Method to create a redrive queue for a lambda function
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
33
|
+
* @param id scoped id of the resource
|
|
34
|
+
* @param scope scope in which this resource is defined
|
|
35
|
+
* @param props the lambda properties
|
|
40
36
|
*/
|
|
41
37
|
createRedriveQueueForLambda(id: string, scope: CommonConstruct, props: LambdaProps): cdk.aws_sqs.Queue;
|
|
42
38
|
/**
|
|
43
39
|
* @summary Method to create a dead letter queue for a lambda function
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
40
|
+
* @param id scoped id of the resource
|
|
41
|
+
* @param scope scope in which this resource is defined
|
|
42
|
+
* @param props the lambda properties
|
|
43
|
+
* @param deadLetterQueue
|
|
48
44
|
*/
|
|
49
45
|
createDeadLetterQueueForLambda(id: string, scope: CommonConstruct, props: LambdaProps, deadLetterQueue: sqs.IQueue): cdk.aws_sqs.Queue;
|
|
50
46
|
}
|
|
@@ -28,9 +28,6 @@ const cdk = __importStar(require("aws-cdk-lib"));
|
|
|
28
28
|
const sqs = __importStar(require("aws-cdk-lib/aws-sqs"));
|
|
29
29
|
const utils = __importStar(require("../../../utils"));
|
|
30
30
|
/**
|
|
31
|
-
* @stability stable
|
|
32
|
-
* @category cdk-utils.sqs-manager
|
|
33
|
-
* @subcategory Construct
|
|
34
31
|
* @classdesc Provides operations on AWS Simple Queue Service.
|
|
35
32
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
36
33
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -44,35 +41,27 @@ const utils = __importStar(require("../../../utils"));
|
|
|
44
41
|
* this.sqsManager.createQueue('MySqs', this, {...})
|
|
45
42
|
* }
|
|
46
43
|
* }
|
|
47
|
-
*
|
|
48
44
|
* @see [CDK Simple Queue Service Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs-readme.html}
|
|
49
45
|
*/
|
|
50
46
|
class SqsManager {
|
|
51
47
|
/**
|
|
52
48
|
* @summary Method to create a lambda queue service
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props
|
|
52
|
+
* @param deadLetterQueue
|
|
57
53
|
*/
|
|
58
54
|
createQueue(id, scope, props, deadLetterQueue) {
|
|
59
55
|
if (!props)
|
|
60
56
|
throw `Queue props undefined for ${id}`;
|
|
61
57
|
const queue = new sqs.Queue(scope, id, {
|
|
62
|
-
queueName: props.queueName,
|
|
63
|
-
visibilityTimeout: props.visibilityTimeoutInSecs
|
|
64
|
-
? cdk.Duration.seconds(props.visibilityTimeoutInSecs)
|
|
65
|
-
: props.visibilityTimeout,
|
|
66
|
-
receiveMessageWaitTime: props.receiveMessageWaitTimeInSecs
|
|
67
|
-
? cdk.Duration.seconds(props.receiveMessageWaitTimeInSecs)
|
|
68
|
-
: props.receiveMessageWaitTime,
|
|
69
58
|
contentBasedDeduplication: props.contentBasedDeduplication,
|
|
70
59
|
dataKeyReuse: props.dataKeyReuseInSecs ? cdk.Duration.seconds(props.dataKeyReuseInSecs) : props.dataKeyReuse,
|
|
71
60
|
deadLetterQueue: !deadLetterQueue
|
|
72
61
|
? undefined
|
|
73
62
|
: {
|
|
74
|
-
queue: deadLetterQueue,
|
|
75
63
|
maxReceiveCount: props.maxReceiveCount ?? 5,
|
|
64
|
+
queue: deadLetterQueue,
|
|
76
65
|
},
|
|
77
66
|
deduplicationScope: props.deduplicationScope,
|
|
78
67
|
deliveryDelay: props.deliveryDelayInSecs ? cdk.Duration.seconds(props.deliveryDelayInSecs) : undefined,
|
|
@@ -81,8 +70,15 @@ class SqsManager {
|
|
|
81
70
|
fifo: props.fifo,
|
|
82
71
|
fifoThroughputLimit: props.fifoThroughputLimit,
|
|
83
72
|
maxMessageSizeBytes: props.maxMessageSizeBytes,
|
|
73
|
+
queueName: props.queueName,
|
|
74
|
+
receiveMessageWaitTime: props.receiveMessageWaitTimeInSecs
|
|
75
|
+
? cdk.Duration.seconds(props.receiveMessageWaitTimeInSecs)
|
|
76
|
+
: props.receiveMessageWaitTime,
|
|
84
77
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
85
78
|
retentionPeriod: props.retentionInDays ? cdk.Duration.days(props.retentionInDays) : cdk.Duration.days(7),
|
|
79
|
+
visibilityTimeout: props.visibilityTimeoutInSecs
|
|
80
|
+
? cdk.Duration.seconds(props.visibilityTimeoutInSecs)
|
|
81
|
+
: props.visibilityTimeout,
|
|
86
82
|
});
|
|
87
83
|
if (props.tags && props.tags.length > 0) {
|
|
88
84
|
props.tags.forEach(tag => {
|
|
@@ -96,9 +92,9 @@ class SqsManager {
|
|
|
96
92
|
}
|
|
97
93
|
/**
|
|
98
94
|
* @summary Method to create a redrive queue for a lambda function
|
|
99
|
-
* @param
|
|
100
|
-
* @param
|
|
101
|
-
* @param
|
|
95
|
+
* @param id scoped id of the resource
|
|
96
|
+
* @param scope scope in which this resource is defined
|
|
97
|
+
* @param props the lambda properties
|
|
102
98
|
*/
|
|
103
99
|
createRedriveQueueForLambda(id, scope, props) {
|
|
104
100
|
return this.createQueue(`${id}`, scope, {
|
|
@@ -110,10 +106,10 @@ class SqsManager {
|
|
|
110
106
|
}
|
|
111
107
|
/**
|
|
112
108
|
* @summary Method to create a dead letter queue for a lambda function
|
|
113
|
-
* @param
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
109
|
+
* @param id scoped id of the resource
|
|
110
|
+
* @param scope scope in which this resource is defined
|
|
111
|
+
* @param props the lambda properties
|
|
112
|
+
* @param deadLetterQueue
|
|
117
113
|
*/
|
|
118
114
|
createDeadLetterQueueForLambda(id, scope, props, deadLetterQueue) {
|
|
119
115
|
let queueProps;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
2
2
|
import { TagProps } from '../../../types';
|
|
3
3
|
/**
|
|
4
|
-
* @category cdk-utils.sqs-manager
|
|
5
|
-
* @subcategory Properties
|
|
6
4
|
*/
|
|
7
5
|
export interface QueueProps extends sqs.QueueProps {
|
|
8
|
-
maxReceiveCount?: number;
|
|
9
|
-
visibilityTimeoutInSecs?: number;
|
|
10
|
-
receiveMessageWaitTimeInSecs?: number;
|
|
11
6
|
dataKeyReuseInSecs?: number;
|
|
12
7
|
deliveryDelayInSecs?: number;
|
|
8
|
+
maxReceiveCount?: number;
|
|
9
|
+
receiveMessageWaitTimeInSecs?: number;
|
|
13
10
|
retentionInDays?: number;
|
|
14
|
-
tags?: TagProps[];
|
|
15
11
|
retriesEnabled?: boolean;
|
|
16
12
|
retryBatchSize?: number;
|
|
13
|
+
tags?: TagProps[];
|
|
14
|
+
visibilityTimeoutInSecs?: number;
|
|
17
15
|
}
|
|
@@ -5,9 +5,6 @@ import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
|
5
5
|
import { LifecycleRule, S3BucketProps } from './types';
|
|
6
6
|
import { CommonConstruct } from '../../../common';
|
|
7
7
|
/**
|
|
8
|
-
* @stability stable
|
|
9
|
-
* @category cdk-utils.s3-manager
|
|
10
|
-
* @subcategory Construct
|
|
11
8
|
* @classdesc Provides operations on AWS S3.
|
|
12
9
|
* - A new instance of this class is injected into {@link CommonConstruct} constructor.
|
|
13
10
|
* - If a custom construct extends {@link CommonConstruct}, an instance is available within the context.
|
|
@@ -21,68 +18,63 @@ import { CommonConstruct } from '../../../common';
|
|
|
21
18
|
* this.s3Manager.createS3Bucket('MyBucket', this)
|
|
22
19
|
* }
|
|
23
20
|
* }
|
|
24
|
-
*
|
|
25
21
|
* @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
|
|
26
22
|
*/
|
|
27
23
|
export declare class S3Manager {
|
|
28
24
|
/**
|
|
29
25
|
* @summary Method to determine S3 Bucket lifecycle properties
|
|
30
|
-
* @param
|
|
31
|
-
* @private
|
|
26
|
+
* @param props bucket properties
|
|
32
27
|
*/
|
|
33
28
|
protected determineBucketLifecycleRules(props: S3BucketProps): LifecycleRule[] | undefined;
|
|
34
29
|
/**
|
|
35
30
|
* @summary Method to determine the bucket name using account and region
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @protected
|
|
31
|
+
* @param scope scope in which this resource is defined
|
|
32
|
+
* @param bucketName the bucket name
|
|
39
33
|
*/
|
|
40
34
|
protected static determineBucketNameByAccountAndRegion(scope: CommonConstruct, bucketName: string): string;
|
|
41
35
|
/**
|
|
42
36
|
* @summary Method to determine the bucket name using domain name
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @protected
|
|
37
|
+
* @param scope scope in which this resource is defined
|
|
38
|
+
* @param bucketName the bucket name
|
|
46
39
|
*/
|
|
47
40
|
protected static determineBucketNameByDomainName(scope: CommonConstruct, bucketName: string): string;
|
|
48
41
|
/**
|
|
49
42
|
* @summary Method to determine the bucket name
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @private
|
|
43
|
+
* @param scope scope in which this resource is defined
|
|
44
|
+
* @param bucketName the bucket name
|
|
53
45
|
*/
|
|
54
46
|
static determineBucketName(scope: CommonConstruct, bucketName: string): string;
|
|
55
47
|
/**
|
|
56
48
|
* @summary Method to create a s3 bucket
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
49
|
+
* @param id scoped id of the resource
|
|
50
|
+
* @param scope scope in which this resource is defined
|
|
51
|
+
* @param props bucket properties
|
|
60
52
|
*/
|
|
61
53
|
createS3Bucket(id: string, scope: CommonConstruct, props: S3BucketProps): cdk.aws_s3.IBucket;
|
|
62
54
|
/**
|
|
63
55
|
* @summary Method to create an iam bucket policy for cloudtrail
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @param
|
|
56
|
+
* @param id scoped id of the resource
|
|
57
|
+
* @param scope scope in which this resource is defined
|
|
58
|
+
* @param bucket
|
|
67
59
|
*/
|
|
68
60
|
createBucketPolicyForCloudTrail(id: string, scope: CommonConstruct, bucket: s3.IBucket): cdk.aws_s3.CfnBucketPolicy;
|
|
69
61
|
/**
|
|
70
62
|
* @summary Method to create a s3 bucket deployment
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @param
|
|
63
|
+
* @param id scoped id of the resource
|
|
64
|
+
* @param scope scope in which this resource is defined
|
|
65
|
+
* @param siteBucket
|
|
66
|
+
* @param distribution
|
|
67
|
+
* @param sources
|
|
68
|
+
* @param prefix
|
|
69
|
+
* @param prune
|
|
78
70
|
*/
|
|
79
71
|
doBucketDeployment(id: string, scope: CommonConstruct, siteBucket: s3.IBucket, distribution: cloudfront.IDistribution, sources: s3deploy.ISource[], prefix: string, prune?: boolean): void;
|
|
80
72
|
/**
|
|
81
73
|
*
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
74
|
+
* @param id scoped id of the resource
|
|
75
|
+
* @param scope scope in which this resource is defined
|
|
76
|
+
* @param bucket bucket to create the folders in
|
|
77
|
+
* @param folders list of folder names to be created in the bucket
|
|
86
78
|
*/
|
|
87
79
|
createBucketFolders(id: string, scope: CommonConstruct, bucket: s3.IBucket, folders: string[]): void;
|
|
88
80
|
}
|