@gradientedge/cdk-utils 5.13.0 → 6.0.1

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 (38) hide show
  1. package/dist/src/lib/construct/api-to-eventbridge-target/index.d.ts +0 -3
  2. package/dist/src/lib/construct/api-to-eventbridge-target/index.js +0 -3
  3. package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +23 -68
  4. package/dist/src/lib/construct/api-to-eventbridge-target/main.js +124 -243
  5. package/dist/src/lib/construct/{api-to-eventbridge-target → api-to-eventbridge-target-with-sns}/api-destined-lambda.d.ts +1 -1
  6. package/dist/src/lib/construct/{api-to-eventbridge-target → api-to-eventbridge-target-with-sns}/api-destined-lambda.js +1 -1
  7. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/index.d.ts +2 -0
  8. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/index.js +18 -0
  9. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +193 -0
  10. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +631 -0
  11. package/dist/src/lib/construct/graphql-api-lambda/main.js +1 -1
  12. package/dist/src/lib/construct/index.d.ts +1 -0
  13. package/dist/src/lib/construct/index.js +1 -0
  14. package/dist/src/lib/construct/site-with-ecs-backend/main.js +1 -1
  15. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destination-event.d.ts → helper/api-to-eventbridge-target-event.d.ts} +5 -3
  16. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destination-event.js → helper/api-to-eventbridge-target-event.js} +6 -4
  17. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destined-rest-api.d.ts → helper/api-to-eventbridge-target-rest-api.d.ts} +4 -4
  18. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destined-rest-api.js → helper/api-to-eventbridge-target-rest-api.js} +5 -5
  19. package/dist/src/lib/helper/index.d.ts +2 -0
  20. package/dist/src/lib/helper/index.js +18 -0
  21. package/dist/src/lib/manager/aws/ecs-manager.js +5 -0
  22. package/dist/src/lib/manager/aws/sqs-manager.js +0 -1
  23. package/dist/src/lib/types/aws/index.d.ts +10 -5
  24. package/package.json +11 -11
  25. package/src/lib/construct/api-to-eventbridge-target/index.ts +0 -3
  26. package/src/lib/construct/api-to-eventbridge-target/main.ts +131 -280
  27. package/src/lib/construct/{api-to-eventbridge-target → api-to-eventbridge-target-with-sns}/api-destined-lambda.ts +1 -1
  28. package/src/lib/construct/api-to-eventbridge-target-with-sns/index.ts +2 -0
  29. package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +703 -0
  30. package/src/lib/construct/graphql-api-lambda/main.ts +1 -1
  31. package/src/lib/construct/index.ts +1 -0
  32. package/src/lib/construct/site-with-ecs-backend/main.ts +1 -1
  33. package/src/lib/{construct/api-to-eventbridge-target/api-destination-event.ts → helper/api-to-eventbridge-target-event.ts} +5 -3
  34. package/src/lib/{construct/api-to-eventbridge-target/api-destined-rest-api.ts → helper/api-to-eventbridge-target-rest-api.ts} +4 -4
  35. package/src/lib/helper/index.ts +2 -0
  36. package/src/lib/manager/aws/ecs-manager.ts +5 -0
  37. package/src/lib/manager/aws/sqs-manager.ts +0 -2
  38. package/src/lib/types/aws/index.ts +10 -5
@@ -125,7 +125,7 @@ export class GraphQLApiLambda extends CommonConstruct {
125
125
  */
126
126
  protected createLambdaPolicy() {
127
127
  this.graphQLApiLambdaPolicy = new iam.PolicyDocument({
128
- statements: [this.iamManager.statementForReadSecrets(this)],
128
+ statements: [this.iamManager.statementForCreateAnyLogStream()],
129
129
  })
130
130
  }
131
131
 
@@ -1,4 +1,5 @@
1
1
  export * from './api-to-eventbridge-target'
2
+ export * from './api-to-eventbridge-target-with-sns'
2
3
  export * from './graphql-api-lambda'
3
4
  export * from './graphql-api-lambda-with-cache'
4
5
  export * from './site-with-ecs-backend'
@@ -177,7 +177,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
177
177
  */
178
178
  protected createEcsPolicy() {
179
179
  this.siteEcsPolicy = new iam.PolicyDocument({
180
- statements: [this.iamManager.statementForReadSecrets(this)],
180
+ statements: [this.iamManager.statementForCreateAnyLogStream()],
181
181
  })
182
182
  }
183
183
 
@@ -1,17 +1,19 @@
1
1
  import * as events from 'aws-cdk-lib/aws-events'
2
2
  import * as logs from 'aws-cdk-lib/aws-logs'
3
- import * as types from '../../types/aws'
3
+ import * as types from '../types/aws'
4
4
 
5
5
  /**
6
6
  * @stability stable
7
7
  * @category cdk-utils.api-to-eventbridge-target
8
8
  * @subcategory member
9
- * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTarget
9
+ * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
10
10
  */
11
- export class ApiDestinationEvent implements types.ApiDestinationEventType {
11
+ export class ApiToEventbridgeTargetEvent implements types.ApiToEventBridgeTargetEventType {
12
12
  eventBus: events.IEventBus
13
+ logGroup: logs.LogGroup
13
14
  logGroupFailure: logs.LogGroup
14
15
  logGroupSuccess: logs.LogGroup
16
+ rule: events.Rule
15
17
  ruleFailure: events.Rule
16
18
  ruleSuccess: events.Rule
17
19
  }
@@ -3,15 +3,15 @@ import * as acm from 'aws-cdk-lib/aws-certificatemanager'
3
3
  import * as iam from 'aws-cdk-lib/aws-iam'
4
4
  import * as route53 from 'aws-cdk-lib/aws-route53'
5
5
  import * as sns from 'aws-cdk-lib/aws-sns'
6
- import * as types from '../../types/aws'
6
+ import * as types from '../types/aws'
7
7
 
8
8
  /**
9
9
  * @stability stable
10
10
  * @category cdk-utils.api-to-eventbridge-target
11
11
  * @subcategory member
12
- * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTarget
12
+ * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
13
13
  */
14
- export class ApiDestinedRestApi implements types.ApiDestinedRestApiType {
14
+ export class ApiToEventbridgeTargetRestApi implements types.ApiToEventBridgeTargetRestApiType {
15
15
  api: apig.RestApi
16
16
  certificate: acm.ICertificate
17
17
  domain: apig.DomainName
@@ -28,5 +28,5 @@ export class ApiDestinedRestApi implements types.ApiDestinedRestApiType {
28
28
  resource: apig.Resource
29
29
  responseModel: apig.Model
30
30
  topic: sns.Topic
31
- topicRole: iam.Role
31
+ role: iam.Role
32
32
  }
@@ -0,0 +1,2 @@
1
+ export * from './api-to-eventbridge-target-event'
2
+ export * from './api-to-eventbridge-target-rest-api'
@@ -40,6 +40,11 @@ export class EcsManager {
40
40
  const ecsCluster = new ecs.Cluster(scope, `${id}`, {
41
41
  clusterName: `${props.clusterName}-${scope.props.stage}`,
42
42
  vpc: vpc,
43
+ defaultCloudMapNamespace: props.defaultCloudMapNamespace,
44
+ capacity: props.capacity,
45
+ enableFargateCapacityProviders: props.enableFargateCapacityProviders,
46
+ containerInsights: props.containerInsights,
47
+ executeCommandConfiguration: props.executeCommandConfiguration,
43
48
  })
44
49
 
45
50
  utils.createCfnOutput(`${id}-clusterArn`, scope, ecsCluster.clusterArn)
@@ -35,8 +35,6 @@ export class SqsManager {
35
35
  public createQueue(id: string, scope: common.CommonConstruct, props: types.QueueProps, deadLetterQueue?: sqs.IQueue) {
36
36
  if (!props) throw `Queue props undefined`
37
37
 
38
- console.log(props)
39
-
40
38
  const queue = new sqs.Queue(scope, id, {
41
39
  queueName: props.queueName,
42
40
  visibilityTimeout: props.visibilityTimeoutInSecs
@@ -242,10 +242,12 @@ export interface GraphQlApiLambdaWithCacheProps extends GraphQlApiLambdaProps {
242
242
  * @category cdk-utils.api-to-eventbridge-target
243
243
  * @subcategory Types
244
244
  */
245
- export interface ApiDestinationEventType {
245
+ export interface ApiToEventBridgeTargetEventType {
246
246
  eventBus: events.IEventBus
247
+ logGroup: logs.LogGroup
247
248
  logGroupFailure: logs.LogGroup
248
249
  logGroupSuccess: logs.LogGroup
250
+ rule: events.Rule
249
251
  ruleFailure: events.Rule
250
252
  ruleSuccess: events.Rule
251
253
  }
@@ -254,7 +256,7 @@ export interface ApiDestinationEventType {
254
256
  * @category cdk-utils.api-to-eventbridge-target
255
257
  * @subcategory Types
256
258
  */
257
- export interface ApiDestinedRestApiType {
259
+ export interface ApiToEventBridgeTargetRestApiType {
258
260
  api: apig.IRestApi
259
261
  authoriser?: apig.IAuthorizer
260
262
  certificate: acm.ICertificate
@@ -271,8 +273,9 @@ export interface ApiDestinedRestApiType {
271
273
  methodResponse: apig.MethodResponse
272
274
  resource: apig.Resource
273
275
  responseModel: apig.Model
274
- topic: sns.ITopic
275
- topicRole: iam.Role
276
+ topic?: sns.ITopic
277
+ role?: iam.Role
278
+ policy?: iam.PolicyDocument
276
279
  }
277
280
 
278
281
  /**
@@ -329,8 +332,10 @@ interface ApiToEventBridgeTargetLambdaProps {
329
332
  */
330
333
  interface ApiToEventBridgeTargetEventProps {
331
334
  eventBusName?: string
335
+ logGroup?: LogProps
332
336
  logGroupSuccess?: LogProps
333
337
  logGroupFailure?: LogProps
338
+ rule: EventRuleProps
334
339
  ruleSuccess: EventRuleProps
335
340
  ruleFailure: EventRuleProps
336
341
  }
@@ -344,7 +349,7 @@ export interface ApiToEventBridgeTargetProps extends CommonStackProps {
344
349
  apiSubDomain: string
345
350
  api: ApiToEventBridgeTargetRestApiProps
346
351
  event: ApiToEventBridgeTargetEventProps
347
- lambda: ApiToEventBridgeTargetLambdaProps
352
+ lambda?: ApiToEventBridgeTargetLambdaProps
348
353
  logLevel: string
349
354
  nodeEnv: string
350
355
  timezone: string