@gradientedge/cdk-utils 8.83.0 → 8.84.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.
@@ -105,6 +105,7 @@ export declare class ApiToEventBridgeTarget extends CommonConstruct {
105
105
  * @protected
106
106
  */
107
107
  protected createApiToEventBridgeTargetMethodErrorResponse(): void;
108
+ protected createApiToEventBridgeTargetRestApiLogGroup(): void;
108
109
  /**
109
110
  * @summary Method to create rest restApi for Api
110
111
  * @protected
@@ -90,6 +90,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
90
90
  this.createApiToEventBridgeTargetIntegrationResponse();
91
91
  this.createApiToEventBridgeTargetIntegrationErrorResponse();
92
92
  this.createApiToEventBridgeTargetIntegration();
93
+ this.createApiToEventBridgeTargetRestApiLogGroup();
93
94
  this.createApiToEventBridgeTargetRestApi();
94
95
  this.createApiToEventBridgeTargetResource();
95
96
  this.createApiToEventBridgeTargetResponseModel();
@@ -339,6 +340,12 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
339
340
  ...this.props.api.methodErrorResponse,
340
341
  };
341
342
  }
343
+ createApiToEventBridgeTargetRestApiLogGroup() {
344
+ this.apiToEventBridgeTargetRestApi.accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
345
+ logGroupName: `/custom/api/${this.id}-rest-api-access`,
346
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
347
+ });
348
+ }
342
349
  /**
343
350
  * @summary Method to create rest restApi for Api
344
351
  * @protected
@@ -348,10 +355,6 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
348
355
  this.apiToEventBridgeTargetRestApi.api = apig.RestApi.fromRestApiId(this, `${this.id}-rest-api`, cdk.Fn.importValue(this.props.api.importedRestApiRef));
349
356
  return;
350
357
  }
351
- const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
352
- logGroupName: `/custom/api/${this.id}-rest-api-access`,
353
- removalPolicy: cdk.RemovalPolicy.DESTROY,
354
- });
355
358
  this.apiToEventBridgeTargetRestApi.api = new apig.RestApi(this, `${this.id}-rest-api`, {
356
359
  ...{
357
360
  cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
@@ -370,7 +373,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
370
373
  loggingLevel: apig.MethodLoggingLevel.INFO,
371
374
  metricsEnabled: true,
372
375
  stageName: this.props.stage,
373
- accessLogDestination: new apig.LogGroupLogDestination(accessLogGroup),
376
+ accessLogDestination: new apig.LogGroupLogDestination(this.apiToEventBridgeTargetRestApi.accessLogGroup),
374
377
  accessLogFormat: apig.AccessLogFormat.jsonWithStandardFields(),
375
378
  },
376
379
  endpointConfiguration: {
@@ -1,6 +1,7 @@
1
1
  import * as apig from 'aws-cdk-lib/aws-apigateway';
2
2
  import * as acm from 'aws-cdk-lib/aws-certificatemanager';
3
3
  import * as iam from 'aws-cdk-lib/aws-iam';
4
+ import * as logs from 'aws-cdk-lib/aws-logs';
4
5
  import * as route53 from 'aws-cdk-lib/aws-route53';
5
6
  import * as sns from 'aws-cdk-lib/aws-sns';
6
7
  import * as types from '../types/aws';
@@ -11,6 +12,7 @@ import * as types from '../types/aws';
11
12
  * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
12
13
  */
13
14
  export declare class ApiToEventbridgeTargetRestApi implements types.ApiToEventBridgeTargetRestApiType {
15
+ accessLogGroup: logs.LogGroup;
14
16
  api: apig.RestApi;
15
17
  certificate: acm.ICertificate;
16
18
  domain: apig.DomainName;
@@ -8,6 +8,7 @@ exports.ApiToEventbridgeTargetRestApi = void 0;
8
8
  * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
9
9
  */
10
10
  class ApiToEventbridgeTargetRestApi {
11
+ accessLogGroup;
11
12
  api;
12
13
  certificate;
13
14
  domain;
@@ -340,6 +340,7 @@ export interface ApiToEventBridgeTargetEventType {
340
340
  * @subcategory Types
341
341
  */
342
342
  export interface ApiToEventBridgeTargetRestApiType {
343
+ accessLogGroup: logs.LogGroup;
343
344
  api: apig.IRestApi;
344
345
  authoriser?: apig.IAuthorizer;
345
346
  certificate: acm.ICertificate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.83.0",
3
+ "version": "8.84.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -79,6 +79,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
79
79
  this.createApiToEventBridgeTargetIntegrationResponse()
80
80
  this.createApiToEventBridgeTargetIntegrationErrorResponse()
81
81
  this.createApiToEventBridgeTargetIntegration()
82
+ this.createApiToEventBridgeTargetRestApiLogGroup()
82
83
  this.createApiToEventBridgeTargetRestApi()
83
84
  this.createApiToEventBridgeTargetResource()
84
85
  this.createApiToEventBridgeTargetResponseModel()
@@ -360,6 +361,17 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
360
361
  }
361
362
  }
362
363
 
364
+ protected createApiToEventBridgeTargetRestApiLogGroup() {
365
+ this.apiToEventBridgeTargetRestApi.accessLogGroup = this.logManager.createLogGroup(
366
+ `${this.id}-rest-api-access-log`,
367
+ this,
368
+ {
369
+ logGroupName: `/custom/api/${this.id}-rest-api-access`,
370
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
371
+ }
372
+ )
373
+ }
374
+
363
375
  /**
364
376
  * @summary Method to create rest restApi for Api
365
377
  * @protected
@@ -374,11 +386,6 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
374
386
  return
375
387
  }
376
388
 
377
- const accessLogGroup = this.logManager.createLogGroup(`${this.id}-rest-api-access-log`, this, {
378
- logGroupName: `/custom/api/${this.id}-rest-api-access`,
379
- removalPolicy: cdk.RemovalPolicy.DESTROY,
380
- })
381
-
382
389
  this.apiToEventBridgeTargetRestApi.api = new apig.RestApi(this, `${this.id}-rest-api`, {
383
390
  ...{
384
391
  cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
@@ -397,7 +404,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
397
404
  loggingLevel: apig.MethodLoggingLevel.INFO,
398
405
  metricsEnabled: true,
399
406
  stageName: this.props.stage,
400
- accessLogDestination: new apig.LogGroupLogDestination(accessLogGroup),
407
+ accessLogDestination: new apig.LogGroupLogDestination(this.apiToEventBridgeTargetRestApi.accessLogGroup),
401
408
  accessLogFormat: apig.AccessLogFormat.jsonWithStandardFields(),
402
409
  },
403
410
  endpointConfiguration: {
@@ -1,6 +1,7 @@
1
1
  import * as apig from 'aws-cdk-lib/aws-apigateway'
2
2
  import * as acm from 'aws-cdk-lib/aws-certificatemanager'
3
3
  import * as iam from 'aws-cdk-lib/aws-iam'
4
+ import * as logs from 'aws-cdk-lib/aws-logs'
4
5
  import * as route53 from 'aws-cdk-lib/aws-route53'
5
6
  import * as sns from 'aws-cdk-lib/aws-sns'
6
7
  import * as types from '../types/aws'
@@ -12,6 +13,7 @@ import * as types from '../types/aws'
12
13
  * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
13
14
  */
14
15
  export class ApiToEventbridgeTargetRestApi implements types.ApiToEventBridgeTargetRestApiType {
16
+ accessLogGroup: logs.LogGroup
15
17
  api: apig.RestApi
16
18
  certificate: acm.ICertificate
17
19
  domain: apig.DomainName
@@ -366,6 +366,7 @@ export interface ApiToEventBridgeTargetEventType {
366
366
  * @subcategory Types
367
367
  */
368
368
  export interface ApiToEventBridgeTargetRestApiType {
369
+ accessLogGroup: logs.LogGroup
369
370
  api: apig.IRestApi
370
371
  authoriser?: apig.IAuthorizer
371
372
  certificate: acm.ICertificate