@gradientedge/cdk-utils 8.99.0 → 8.99.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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
1
2
|
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
|
|
2
3
|
import { CommonConstruct } from '../../../common';
|
|
3
4
|
/**
|
|
@@ -23,7 +24,15 @@ export declare class SecretsManager {
|
|
|
23
24
|
* @param scope scope in which this resource is defined
|
|
24
25
|
* @param props the secret properties
|
|
25
26
|
*/
|
|
26
|
-
createSecret(id: string, scope: CommonConstruct, props: secretsManager.SecretProps):
|
|
27
|
+
createSecret(id: string, scope: CommonConstruct, props: secretsManager.SecretProps): cdk.aws_secretsmanager.Secret;
|
|
28
|
+
/**
|
|
29
|
+
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
30
|
+
* @param id
|
|
31
|
+
* @param scope
|
|
32
|
+
* @param stackName
|
|
33
|
+
* @param exportName
|
|
34
|
+
*/
|
|
35
|
+
retrieveSecretFromSecretsManager(id: string, scope: CommonConstruct, stackName: string, exportName: string): cdk.aws_secretsmanager.ISecret;
|
|
27
36
|
/**
|
|
28
37
|
* @summary Method to resolve secret value from a secret using AWS SDK
|
|
29
38
|
* @param scope scope in which this resource is defined
|
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.SecretsManager = void 0;
|
|
27
27
|
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
28
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
28
29
|
const secretsManager = __importStar(require("aws-cdk-lib/aws-secretsmanager"));
|
|
29
30
|
const utils = __importStar(require("../../../utils"));
|
|
30
31
|
/**
|
|
@@ -59,6 +60,16 @@ class SecretsManager {
|
|
|
59
60
|
utils.createCfnOutput(`${id}-secretArn`, scope, secret.secretArn);
|
|
60
61
|
return secret;
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
65
|
+
* @param id
|
|
66
|
+
* @param scope
|
|
67
|
+
* @param stackName
|
|
68
|
+
* @param exportName
|
|
69
|
+
*/
|
|
70
|
+
retrieveSecretFromSecretsManager(id, scope, stackName, exportName) {
|
|
71
|
+
return secretsManager.Secret.fromSecretNameV2(scope, `${id}`, cdk.Fn.importValue(`${stackName}-${scope.props.stage}-${exportName}`));
|
|
72
|
+
}
|
|
62
73
|
/**
|
|
63
74
|
* @summary Method to resolve secret value from a secret using AWS SDK
|
|
64
75
|
* @param scope scope in which this resource is defined
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GetSecretValueCommand, SecretsManagerClient } from '@aws-sdk/client-secrets-manager'
|
|
2
|
+
import * as cdk from 'aws-cdk-lib'
|
|
2
3
|
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
|
|
3
4
|
import * as utils from '../../../utils'
|
|
4
5
|
import { CommonConstruct } from '../../../common'
|
|
@@ -38,6 +39,21 @@ export class SecretsManager {
|
|
|
38
39
|
return secret
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
44
|
+
* @param id
|
|
45
|
+
* @param scope
|
|
46
|
+
* @param stackName
|
|
47
|
+
* @param exportName
|
|
48
|
+
*/
|
|
49
|
+
public retrieveSecretFromSecretsManager(id: string, scope: CommonConstruct, stackName: string, exportName: string) {
|
|
50
|
+
return secretsManager.Secret.fromSecretNameV2(
|
|
51
|
+
scope,
|
|
52
|
+
`${id}`,
|
|
53
|
+
cdk.Fn.importValue(`${stackName}-${scope.props.stage}-${exportName}`)
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
/**
|
|
42
58
|
* @summary Method to resolve secret value from a secret using AWS SDK
|
|
43
59
|
* @param scope scope in which this resource is defined
|