@gradientedge/cdk-utils 8.166.0 → 9.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.
Files changed (27) hide show
  1. package/dist/src/lib/aws/construct/api-to-any-target/main.d.ts +1 -1
  2. package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.d.ts +1 -1
  3. package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.d.ts +1 -1
  4. package/dist/src/lib/aws/construct/api-to-lambda-target/main.d.ts +1 -1
  5. package/dist/src/lib/aws/construct/event-handler/main.d.ts +1 -1
  6. package/dist/src/lib/aws/construct/piped-event-handler/main.d.ts +1 -1
  7. package/dist/src/lib/aws/construct/rest-api-lambda/main.d.ts +1 -1
  8. package/dist/src/lib/aws/construct/rest-api-lambda-with-cache/main.d.ts +1 -1
  9. package/dist/src/lib/aws/construct/site-with-ecs-backend/main.d.ts +1 -1
  10. package/dist/src/lib/aws/construct/site-with-lambda-backend/main.d.ts +1 -1
  11. package/dist/src/lib/aws/construct/static-site/main.d.ts +1 -1
  12. package/dist/src/lib/aws/construct/static-site/main.js +2 -1
  13. package/dist/src/lib/aws/construct/static-site/types.d.ts +6 -0
  14. package/package.json +1 -1
  15. package/src/lib/aws/construct/api-to-any-target/main.ts +1 -1
  16. package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +1 -1
  17. package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +1 -1
  18. package/src/lib/aws/construct/api-to-lambda-target/main.ts +1 -1
  19. package/src/lib/aws/construct/application-configuration/main.ts +1 -1
  20. package/src/lib/aws/construct/event-handler/main.ts +1 -1
  21. package/src/lib/aws/construct/piped-event-handler/main.ts +1 -1
  22. package/src/lib/aws/construct/rest-api-lambda/main.ts +1 -1
  23. package/src/lib/aws/construct/rest-api-lambda-with-cache/main.ts +1 -1
  24. package/src/lib/aws/construct/site-with-ecs-backend/main.ts +1 -1
  25. package/src/lib/aws/construct/site-with-lambda-backend/main.ts +1 -1
  26. package/src/lib/aws/construct/static-site/main.ts +3 -2
  27. package/src/lib/aws/construct/static-site/types.ts +6 -0
@@ -25,7 +25,7 @@ export declare class ApiToAnyTarget extends CommonConstruct {
25
25
  apiToAnyTargetRestApi: ApiToAnyTargetRestApiType;
26
26
  apiResource: string;
27
27
  constructor(parent: Construct, id: string, props: ApiToAnyTargetProps);
28
- protected initResources(): void;
28
+ initResources(): void;
29
29
  /**
30
30
  * @summary Method to resolve secrets from SecretsManager
31
31
  * - To be implemented in the overriding method in the implementation class
@@ -27,7 +27,7 @@ export declare class ApiToEventBridgeTarget extends CommonConstruct {
27
27
  apiToEventBridgeTargetRestApi: ApiToEventBridgeTargetRestApiType;
28
28
  apiResource: string;
29
29
  constructor(parent: Construct, id: string, props: ApiToEventBridgeTargetProps);
30
- protected initResources(): void;
30
+ initResources(): void;
31
31
  /**
32
32
  * @summary Method to resolve secrets from SecretsManager
33
33
  * - To be implemented in the overriding method in the implementation class
@@ -30,7 +30,7 @@ export declare class ApiToEventBridgeTargetWithSns extends CommonConstruct {
30
30
  apiDestinedRestApi: ApiToEventBridgeTargetRestApiType;
31
31
  apiResource: string;
32
32
  constructor(parent: Construct, id: string, props: ApiToEventBridgeTargetProps);
33
- protected initResources(): void;
33
+ initResources(): void;
34
34
  /**
35
35
  * @summary Method to resolve secrets from SecretsManager
36
36
  * - To be implemented in the overriding method in the implementation class
@@ -11,7 +11,7 @@ export declare class ApiToLambdaTarget extends CommonConstruct {
11
11
  apiToLambdaTargetRestApi: ApiToLambdaTargetRestApiType;
12
12
  apiResource: string;
13
13
  constructor(parent: Construct, id: string, props: ApiToLambdaTargetProps);
14
- protected initResources(): void;
14
+ initResources(): void;
15
15
  /**
16
16
  * @summary Method to resolve secrets from SecretsManager
17
17
  * - To be implemented in the overriding method in the implementation class
@@ -27,7 +27,7 @@ export declare class EventHandler extends CommonConstruct {
27
27
  useMapState: boolean;
28
28
  vpc: IVpc;
29
29
  constructor(parent: Construct, id: string, props: EventHandlerProps);
30
- protected initResources(): void;
30
+ initResources(): void;
31
31
  /**
32
32
  * @summary Method to resolve common vpc or create a new one.
33
33
  */
@@ -22,7 +22,7 @@ export declare class PipedEventHandler extends EventHandler {
22
22
  pipedDlq: IQueue;
23
23
  pipedQueue: IQueue;
24
24
  protected constructor(parent: Construct, id: string, props: PipedEventHandlerProps);
25
- protected initResources(): void;
25
+ initResources(): void;
26
26
  /**
27
27
  * @summary Method to create the piped queue and dlq.
28
28
  */
@@ -42,7 +42,7 @@ export declare abstract class RestApiLambda extends CommonConstruct {
42
42
  /**
43
43
  * @summary Initialise and provision resources
44
44
  */
45
- protected initResources(): void;
45
+ initResources(): void;
46
46
  /**
47
47
  * @summary Method to resolve secrets from SecretsManager
48
48
  * - To be implemented in the overriding method in the implementation class
@@ -28,7 +28,7 @@ export declare abstract class RestApiLambdaWithCache extends RestApiLambda {
28
28
  restApiSecurityGroup: ISecurityGroup;
29
29
  restApiSecurityGroupExportName: string;
30
30
  protected constructor(parent: Construct, id: string, props: RestApiLambdaWithCacheProps);
31
- protected initResources(): void;
31
+ initResources(): void;
32
32
  /**
33
33
  * Create VPC
34
34
  */
@@ -65,7 +65,7 @@ export declare class SiteWithEcsBackend extends CommonConstruct {
65
65
  /**
66
66
  * @summary Initialise and provision resources
67
67
  */
68
- protected initResources(): void;
68
+ initResources(): void;
69
69
  /**
70
70
  * @summary Method to resolve a hosted zone based on domain attributes
71
71
  */
@@ -54,7 +54,7 @@ export declare class SiteWithLambdaBackend extends CommonConstruct {
54
54
  /**
55
55
  * @summary Initialise and provision resources
56
56
  */
57
- protected initResources(): void;
57
+ initResources(): void;
58
58
  /**
59
59
  * @summary Method to resolve a hosted zone based on domain attributes
60
60
  */
@@ -38,7 +38,7 @@ export declare class StaticSite extends CommonConstruct {
38
38
  /**
39
39
  * @summary Initialise and provision resources
40
40
  */
41
- protected initResources(): void;
41
+ initResources(): void;
42
42
  /**
43
43
  * @summary Method to resolve a hosted zone based on domain attributes
44
44
  */
@@ -131,7 +131,8 @@ class StaticSite extends common_1.CommonConstruct {
131
131
  * @summary Method to deploy the static assets into s3 bucket for static site
132
132
  */
133
133
  deploySite() {
134
- this.s3Manager.doBucketDeployment(`${this.id}-deployment`, this, this.siteBucket, this.siteDistribution, [this.props.siteSource], '', true);
134
+ const prune = this.props.pruneOnDeployment ?? true;
135
+ this.s3Manager.doBucketDeployment(`${this.id}-deployment`, this, this.siteBucket, this.siteDistribution, [this.props.siteSource], '', prune);
135
136
  }
136
137
  /**
137
138
  * Method to invalidation the cloudfront distribution cache after a deployment
@@ -20,5 +20,11 @@ export interface StaticSiteProps extends CommonStackProps {
20
20
  siteSource: ISource;
21
21
  siteSubDomain?: string;
22
22
  timezone: string;
23
+ /**
24
+ * Whether to prune the contents of the bucket when deploying assets.
25
+ *
26
+ * @default true
27
+ */
28
+ pruneOnDeployment?: boolean;
23
29
  useExistingHostedZone: boolean;
24
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.166.0",
3
+ "version": "9.0.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -49,7 +49,7 @@ export class ApiToAnyTarget extends CommonConstruct {
49
49
  this.apiToAnyTargetRestApi = new ApiToAnyTargetRestApi()
50
50
  }
51
51
 
52
- protected initResources() {
52
+ public initResources() {
53
53
  /* application related resources */
54
54
  this.resolveSecrets()
55
55
 
@@ -71,7 +71,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
71
71
  this.apiResource = 'notify'
72
72
  }
73
73
 
74
- protected initResources() {
74
+ public initResources() {
75
75
  /* application related resources */
76
76
  this.resolveSecrets()
77
77
 
@@ -80,7 +80,7 @@ export class ApiToEventBridgeTargetWithSns extends CommonConstruct {
80
80
  this.apiResource = 'notify'
81
81
  }
82
82
 
83
- protected initResources() {
83
+ public initResources() {
84
84
  /* application related resources */
85
85
  this.resolveSecrets()
86
86
 
@@ -36,7 +36,7 @@ export class ApiToLambdaTarget extends CommonConstruct {
36
36
  this.apiToLambdaTargetRestApi = new ApiToLambdaTargetRestApi()
37
37
  }
38
38
 
39
- protected initResources() {
39
+ public initResources() {
40
40
  this.resolveSecrets()
41
41
  this.resolveHostedZone()
42
42
  this.resolveCertificate()
@@ -26,7 +26,7 @@ export class ApplicationConfiguration extends CommonConstruct {
26
26
  this.id = id
27
27
  }
28
28
 
29
- initResources() {
29
+ public initResources() {
30
30
  this.createConfiguration()
31
31
  this.resolveEnvironmentVariables()
32
32
  }
@@ -41,7 +41,7 @@ export class EventHandler extends CommonConstruct {
41
41
  this.handler = new Handler()
42
42
  }
43
43
 
44
- protected initResources() {
44
+ public initResources() {
45
45
  this.createSQSEventSource()
46
46
  this.createWorkflow()
47
47
  this.createEventRulePattern()
@@ -33,7 +33,7 @@ export class PipedEventHandler extends EventHandler {
33
33
  this.provisionTarget = false
34
34
  }
35
35
 
36
- protected initResources() {
36
+ public initResources() {
37
37
  this.createPipedQueue()
38
38
  this.handler.sqsTargets = [new SqsQueue(this.pipedQueue)]
39
39
  super.initResources()
@@ -54,7 +54,7 @@ export abstract class RestApiLambda extends CommonConstruct {
54
54
  /**
55
55
  * @summary Initialise and provision resources
56
56
  */
57
- protected initResources() {
57
+ public initResources() {
58
58
  this.resolveSecrets()
59
59
  this.resolveHostedZone()
60
60
  this.resolveCertificate()
@@ -43,7 +43,7 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
43
43
  this.id = id
44
44
  }
45
45
 
46
- protected initResources() {
46
+ public initResources() {
47
47
  this.resolveVpc()
48
48
  this.resolveSecurityGroup()
49
49
  this.createElastiCache()
@@ -97,7 +97,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
97
97
  /**
98
98
  * @summary Initialise and provision resources
99
99
  */
100
- protected initResources() {
100
+ public initResources() {
101
101
  this.resolveHostedZone()
102
102
  this.resolveCertificate()
103
103
  this.resolveSiteSecrets()
@@ -80,7 +80,7 @@ export class SiteWithLambdaBackend extends CommonConstruct {
80
80
  /**
81
81
  * @summary Initialise and provision resources
82
82
  */
83
- protected initResources() {
83
+ public initResources() {
84
84
  this.resolveHostedZone()
85
85
  this.resolveCertificate()
86
86
  this.resolveSiteSecrets()
@@ -55,7 +55,7 @@ export class StaticSite extends CommonConstruct {
55
55
  /**
56
56
  * @summary Initialise and provision resources
57
57
  */
58
- protected initResources() {
58
+ public initResources() {
59
59
  this.resolveHostedZone()
60
60
  this.resolveCertificate()
61
61
  this.createSiteLogBucket()
@@ -192,6 +192,7 @@ export class StaticSite extends CommonConstruct {
192
192
  * @summary Method to deploy the static assets into s3 bucket for static site
193
193
  */
194
194
  protected deploySite() {
195
+ const prune = this.props.pruneOnDeployment ?? true
195
196
  this.s3Manager.doBucketDeployment(
196
197
  `${this.id}-deployment`,
197
198
  this,
@@ -199,7 +200,7 @@ export class StaticSite extends CommonConstruct {
199
200
  this.siteDistribution,
200
201
  [this.props.siteSource],
201
202
  '',
202
- true
203
+ prune
203
204
  )
204
205
  }
205
206
 
@@ -21,5 +21,11 @@ export interface StaticSiteProps extends CommonStackProps {
21
21
  siteSource: ISource
22
22
  siteSubDomain?: string
23
23
  timezone: string
24
+ /**
25
+ * Whether to prune the contents of the bucket when deploying assets.
26
+ *
27
+ * @default true
28
+ */
29
+ pruneOnDeployment?: boolean
24
30
  useExistingHostedZone: boolean
25
31
  }