@gradientedge/cdk-utils 8.130.0 → 8.132.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.
@@ -1,6 +1,6 @@
1
- import { Table } from 'aws-cdk-lib/aws-dynamodb';
1
+ import { Table, TableV2 } from 'aws-cdk-lib/aws-dynamodb';
2
2
  import { CommonConstruct } from '../../common';
3
- import { TableProps } from './types';
3
+ import { TableProps, TablePropsV2 } from './types';
4
4
  /**
5
5
  * @classdesc Provides operations on AWS DynamoDB
6
6
  * - A new instance of this class is injected into {@link CommonConstruct} constructor.
@@ -25,4 +25,11 @@ export declare class DynamodbManager {
25
25
  * @param props table props
26
26
  */
27
27
  createTable(id: string, scope: CommonConstruct, props: TableProps): Table;
28
+ /**
29
+ * @summary Method to create a table
30
+ * @param id scoped id of the resource
31
+ * @param scope scope in which this resource is defined
32
+ * @param props table props
33
+ */
34
+ createTableV2(id: string, scope: CommonConstruct, props: TablePropsV2): TableV2;
28
35
  }
@@ -47,5 +47,22 @@ class DynamodbManager {
47
47
  (0, utils_1.createCfnOutput)(`${id}-tableArn`, scope, table.tableArn);
48
48
  return table;
49
49
  }
50
+ /**
51
+ * @summary Method to create a table
52
+ * @param id scoped id of the resource
53
+ * @param scope scope in which this resource is defined
54
+ * @param props table props
55
+ */
56
+ createTableV2(id, scope, props) {
57
+ if (!props)
58
+ throw `Table props undefined for ${id}`;
59
+ const table = new aws_dynamodb_1.TableV2(scope, `${id}`, {
60
+ ...props,
61
+ tableName: `${props.tableName}-${scope.props.stage}`,
62
+ });
63
+ (0, utils_1.createCfnOutput)(`${id}-tableName`, scope, table.tableName);
64
+ (0, utils_1.createCfnOutput)(`${id}-tableArn`, scope, table.tableArn);
65
+ return table;
66
+ }
50
67
  }
51
68
  exports.DynamodbManager = DynamodbManager;
@@ -5,3 +5,5 @@ import { TagProps } from '../../types';
5
5
  export interface TableProps extends dynamodb.TableProps {
6
6
  tags?: TagProps[];
7
7
  }
8
+ export interface TablePropsV2 extends dynamodb.TablePropsV2 {
9
+ }
@@ -89,6 +89,7 @@ class LambdaManager {
89
89
  LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
90
90
  ? ''
91
91
  : scope.ssmManager.readStringParameter(`${id}-sm-ts`, scope, `${systems_manager_1.SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`),
92
+ LOG_LEVEL: props.logLevel,
92
93
  REGION: scope.props.region,
93
94
  STAGE: scope.props.stage,
94
95
  ...environment,
@@ -186,6 +187,7 @@ class LambdaManager {
186
187
  LAST_MODIFIED_TS: props.excludeLastModifiedTimestamp
187
188
  ? ''
188
189
  : scope.ssmManager.readStringParameter(`${id}-sm-ts`, scope, `${systems_manager_1.SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`),
190
+ LOG_LEVEL: props.logLevel,
189
191
  REGION: scope.props.region,
190
192
  STAGE: scope.props.stage,
191
193
  ...environment,
@@ -15,6 +15,7 @@ export interface LambdaProps extends FunctionProps {
15
15
  dlq?: QueueProps;
16
16
  excludeLastModifiedTimestamp?: boolean;
17
17
  lambdaAliases?: LambdaAliasProps[];
18
+ logLevel?: string;
18
19
  redriveq?: QueueProps;
19
20
  tags?: TagProps[];
20
21
  timeoutInSecs?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.130.0",
3
+ "version": "8.132.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -1,9 +1,9 @@
1
1
  import { Tags } from 'aws-cdk-lib'
2
- import { Table } from 'aws-cdk-lib/aws-dynamodb'
2
+ import { Table, TableV2 } from 'aws-cdk-lib/aws-dynamodb'
3
3
  import _ from 'lodash'
4
4
  import { CommonConstruct } from '../../common'
5
5
  import { createCfnOutput } from '../../utils'
6
- import { TableProps } from './types'
6
+ import { TableProps, TablePropsV2 } from './types'
7
7
 
8
8
  /**
9
9
  * @classdesc Provides operations on AWS DynamoDB
@@ -47,4 +47,24 @@ export class DynamodbManager {
47
47
 
48
48
  return table
49
49
  }
50
+
51
+ /**
52
+ * @summary Method to create a table
53
+ * @param id scoped id of the resource
54
+ * @param scope scope in which this resource is defined
55
+ * @param props table props
56
+ */
57
+ public createTableV2(id: string, scope: CommonConstruct, props: TablePropsV2) {
58
+ if (!props) throw `Table props undefined for ${id}`
59
+
60
+ const table = new TableV2(scope, `${id}`, {
61
+ ...props,
62
+ tableName: `${props.tableName}-${scope.props.stage}`,
63
+ })
64
+
65
+ createCfnOutput(`${id}-tableName`, scope, table.tableName)
66
+ createCfnOutput(`${id}-tableArn`, scope, table.tableArn)
67
+
68
+ return table
69
+ }
50
70
  }
@@ -6,3 +6,5 @@ import { TagProps } from '../../types'
6
6
  export interface TableProps extends dynamodb.TableProps {
7
7
  tags?: TagProps[]
8
8
  }
9
+
10
+ export interface TablePropsV2 extends dynamodb.TablePropsV2 {}
@@ -130,6 +130,7 @@ export class LambdaManager {
130
130
  scope,
131
131
  `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
132
132
  ),
133
+ LOG_LEVEL: props.logLevel,
133
134
  REGION: scope.props.region,
134
135
  STAGE: scope.props.stage,
135
136
  ...environment,
@@ -280,6 +281,7 @@ export class LambdaManager {
280
281
  scope,
281
282
  `${SsmManager.SECRETS_MODIFIED_TIMESTAMP_PARAM}-${scope.props.stage}`
282
283
  ),
284
+ LOG_LEVEL: props.logLevel,
283
285
  REGION: scope.props.region,
284
286
  STAGE: scope.props.stage,
285
287
  ...environment,
@@ -17,6 +17,7 @@ export interface LambdaProps extends FunctionProps {
17
17
  dlq?: QueueProps
18
18
  excludeLastModifiedTimestamp?: boolean
19
19
  lambdaAliases?: LambdaAliasProps[]
20
+ logLevel?: string
20
21
  redriveq?: QueueProps
21
22
  tags?: TagProps[]
22
23
  timeoutInSecs?: number