@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.
- package/dist/src/lib/aws/services/dynamodb/main.d.ts +9 -2
- package/dist/src/lib/aws/services/dynamodb/main.js +17 -0
- package/dist/src/lib/aws/services/dynamodb/types.d.ts +2 -0
- package/dist/src/lib/aws/services/lambda/main.js +2 -0
- package/dist/src/lib/aws/services/lambda/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/lib/aws/services/dynamodb/main.ts +22 -2
- package/src/lib/aws/services/dynamodb/types.ts +2 -0
- package/src/lib/aws/services/lambda/main.ts +2 -0
- package/src/lib/aws/services/lambda/types.ts +1 -0
|
@@ -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;
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -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,
|