@gradientedge/cdk-utils 9.25.0 → 9.26.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/construct/application-configuration/main.d.ts +2 -2
- package/dist/src/lib/aws/construct/application-configuration/main.js +16 -6
- package/dist/src/lib/aws/services/appconfig/main.d.ts +9 -1
- package/dist/src/lib/aws/services/appconfig/main.js +21 -0
- package/dist/src/lib/aws/services/appconfig/types.d.ts +8 -2
- package/package.json +1 -1
- package/src/lib/aws/construct/application-configuration/main.ts +28 -10
- package/src/lib/aws/services/appconfig/main.ts +33 -1
- package/src/lib/aws/services/appconfig/types.ts +9 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CfnApplication, CfnConfigurationProfile,
|
|
1
|
+
import { CfnApplication, CfnConfigurationProfile, CfnEnvironment, CfnHostedConfigurationVersion, IDeploymentStrategy } from 'aws-cdk-lib/aws-appconfig';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
3
|
import { CommonConstruct } from '../../common';
|
|
4
4
|
import { ApplicationConfigurationProps } from './types';
|
|
@@ -9,7 +9,7 @@ export declare class ApplicationConfiguration extends CommonConstruct {
|
|
|
9
9
|
appConfigEnvironment: CfnEnvironment;
|
|
10
10
|
appConfigProfile: CfnConfigurationProfile;
|
|
11
11
|
appConfigVersion: CfnHostedConfigurationVersion;
|
|
12
|
-
appConfigDeploymentStrategy:
|
|
12
|
+
appConfigDeploymentStrategy: IDeploymentStrategy;
|
|
13
13
|
constructor(parent: Construct, id: string, props: ApplicationConfigurationProps);
|
|
14
14
|
initResources(): void;
|
|
15
15
|
protected createConfiguration(): void;
|
|
@@ -46,11 +46,21 @@ class ApplicationConfiguration extends common_1.CommonConstruct {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
createAppConfigDeploymentStrategy() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
if (!this.props.appConfig.deploymentStrategy)
|
|
50
|
+
return;
|
|
51
|
+
if (this.props.appConfig.deploymentStrategy?.deploymentStrategyArn) {
|
|
52
|
+
this.appConfigDeploymentStrategy = aws_appconfig_1.DeploymentStrategy.fromDeploymentStrategyArn(this, `${this.id}-ac-deployment-strategy`, this.props.appConfig.deploymentStrategy?.deploymentStrategyArn);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.appConfigDeploymentStrategy = new aws_appconfig_1.DeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
|
|
56
|
+
...this.props.appConfig.deploymentStrategy,
|
|
57
|
+
rolloutStrategy: this.props.appConfig.deploymentStrategy?.rolloutStrategy ??
|
|
58
|
+
aws_appconfig_1.RolloutStrategy.linear({
|
|
59
|
+
growthFactor: 100,
|
|
60
|
+
deploymentDuration: aws_cdk_lib_1.Duration.minutes(0),
|
|
61
|
+
finalBakeTime: aws_cdk_lib_1.Duration.minutes(0),
|
|
62
|
+
}),
|
|
63
|
+
deploymentStrategyName: this.resourceNameFormatter.format(this.props.appConfig.deploymentStrategy.deploymentStrategyName ?? 'common-deployment-strategy', this.props.resourceNameOptions?.appconfig),
|
|
54
64
|
});
|
|
55
65
|
}
|
|
56
66
|
createAppConfigDeployment() {
|
|
@@ -58,7 +68,7 @@ class ApplicationConfiguration extends common_1.CommonConstruct {
|
|
|
58
68
|
applicationId: aws_cdk_lib_1.Fn.ref(this.appConfigApplication.logicalId),
|
|
59
69
|
configurationProfileId: aws_cdk_lib_1.Fn.ref(this.appConfigProfile.logicalId),
|
|
60
70
|
configurationVersion: aws_cdk_lib_1.Fn.ref(this.appConfigVersion.logicalId),
|
|
61
|
-
deploymentStrategyId:
|
|
71
|
+
deploymentStrategyId: this.appConfigDeploymentStrategy.deploymentStrategyId,
|
|
62
72
|
environmentId: aws_cdk_lib_1.Fn.ref(this.appConfigEnvironment.logicalId),
|
|
63
73
|
});
|
|
64
74
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CfnApplication, CfnConfigurationProfile, CfnEnvironment } from 'aws-cdk-lib/aws-appconfig';
|
|
1
|
+
import { CfnApplication, CfnConfigurationProfile, CfnEnvironment, DeploymentStrategy } from 'aws-cdk-lib/aws-appconfig';
|
|
2
2
|
import { CommonConstruct } from '../../common';
|
|
3
3
|
import { Architecture } from '../constants';
|
|
4
4
|
import { AppConfigProps } from './types';
|
|
@@ -52,4 +52,12 @@ export declare class AppConfigManager {
|
|
|
52
52
|
* @returns the appconfig configuration profile
|
|
53
53
|
*/
|
|
54
54
|
createConfigurationProfile(id: string, scope: CommonConstruct, applicationId: string, props: AppConfigProps): CfnConfigurationProfile;
|
|
55
|
+
/**
|
|
56
|
+
* @summary Method to create an AppConfig Deployment Strategy
|
|
57
|
+
* @param id scoped id of the resource
|
|
58
|
+
* @param scope scope in which this resource is defined
|
|
59
|
+
* @param props
|
|
60
|
+
* @returns the appconfig deployment strategy
|
|
61
|
+
*/
|
|
62
|
+
createDeploymentStrategy(id: string, scope: CommonConstruct, props: AppConfigProps): DeploymentStrategy;
|
|
55
63
|
}
|
|
@@ -98,5 +98,26 @@ class AppConfigManager {
|
|
|
98
98
|
(0, utils_1.createCfnOutput)(`${id}-configurationProfileName`, scope, profile.name);
|
|
99
99
|
return profile;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* @summary Method to create an AppConfig Deployment Strategy
|
|
103
|
+
* @param id scoped id of the resource
|
|
104
|
+
* @param scope scope in which this resource is defined
|
|
105
|
+
* @param props
|
|
106
|
+
* @returns the appconfig deployment strategy
|
|
107
|
+
*/
|
|
108
|
+
createDeploymentStrategy(id, scope, props) {
|
|
109
|
+
if (!props)
|
|
110
|
+
throw `AppConfig props undefined for ${id}`;
|
|
111
|
+
if (!props.deploymentStrategy)
|
|
112
|
+
throw `AppConfig deploymentStrategy props undefined for ${id}`;
|
|
113
|
+
const deploymentStrategy = new aws_appconfig_1.DeploymentStrategy(scope, `${id}`, {
|
|
114
|
+
...props,
|
|
115
|
+
deploymentStrategyName: scope.resourceNameFormatter.format(props.deploymentStrategy.deploymentStrategyName ?? 'common-deployment-strategy', scope.props.resourceNameOptions?.appconfig),
|
|
116
|
+
rolloutStrategy: props.deploymentStrategy.rolloutStrategy ?? aws_appconfig_1.RolloutStrategy.ALL_AT_ONCE,
|
|
117
|
+
});
|
|
118
|
+
(0, utils_1.createCfnOutput)(`${id}-deploymentStrategyId`, scope, deploymentStrategy.deploymentStrategyId);
|
|
119
|
+
(0, utils_1.createCfnOutput)(`${id}-deploymentStrategyArn`, scope, deploymentStrategy.deploymentStrategyArn);
|
|
120
|
+
return deploymentStrategy;
|
|
121
|
+
}
|
|
101
122
|
}
|
|
102
123
|
exports.AppConfigManager = AppConfigManager;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { CfnApplicationProps, CfnConfigurationProfileProps, CfnDeploymentProps,
|
|
1
|
+
import { CfnApplicationProps, CfnConfigurationProfileProps, CfnDeploymentProps, CfnEnvironmentProps, DeploymentStrategyProps } from 'aws-cdk-lib/aws-appconfig';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export interface AppConfigDeploymentStrategyProps extends DeploymentStrategyProps {
|
|
6
|
+
deploymentStrategyArn?: string;
|
|
7
|
+
}
|
|
2
8
|
/**
|
|
3
9
|
*/
|
|
4
10
|
export interface AppConfigProps {
|
|
5
11
|
application: CfnApplicationProps;
|
|
6
12
|
configurationProfile: CfnConfigurationProfileProps;
|
|
7
13
|
deployment: CfnDeploymentProps;
|
|
8
|
-
deploymentStrategy:
|
|
14
|
+
deploymentStrategy: AppConfigDeploymentStrategyProps;
|
|
9
15
|
environment: CfnEnvironmentProps;
|
|
10
16
|
id: string;
|
|
11
17
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Fn } from 'aws-cdk-lib'
|
|
1
|
+
import { Duration, Fn } from 'aws-cdk-lib'
|
|
2
2
|
import {
|
|
3
3
|
CfnApplication,
|
|
4
4
|
CfnConfigurationProfile,
|
|
5
5
|
CfnDeployment,
|
|
6
|
-
CfnDeploymentStrategy,
|
|
7
6
|
CfnEnvironment,
|
|
8
7
|
CfnHostedConfigurationVersion,
|
|
8
|
+
DeploymentStrategy,
|
|
9
|
+
IDeploymentStrategy,
|
|
10
|
+
RolloutStrategy,
|
|
9
11
|
} from 'aws-cdk-lib/aws-appconfig'
|
|
10
12
|
import { Construct } from 'constructs'
|
|
11
13
|
import { CommonConstruct } from '../../common'
|
|
@@ -18,7 +20,7 @@ export class ApplicationConfiguration extends CommonConstruct {
|
|
|
18
20
|
appConfigEnvironment: CfnEnvironment
|
|
19
21
|
appConfigProfile: CfnConfigurationProfile
|
|
20
22
|
appConfigVersion: CfnHostedConfigurationVersion
|
|
21
|
-
appConfigDeploymentStrategy:
|
|
23
|
+
appConfigDeploymentStrategy: IDeploymentStrategy
|
|
22
24
|
|
|
23
25
|
constructor(parent: Construct, id: string, props: ApplicationConfigurationProps) {
|
|
24
26
|
super(parent, id, props)
|
|
@@ -76,14 +78,30 @@ export class ApplicationConfiguration extends CommonConstruct {
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
protected createAppConfigDeploymentStrategy() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this
|
|
81
|
+
if (!this.props.appConfig.deploymentStrategy) return
|
|
82
|
+
|
|
83
|
+
if (this.props.appConfig.deploymentStrategy?.deploymentStrategyArn) {
|
|
84
|
+
this.appConfigDeploymentStrategy = DeploymentStrategy.fromDeploymentStrategyArn(
|
|
85
|
+
this,
|
|
86
|
+
`${this.id}-ac-deployment-strategy`,
|
|
87
|
+
this.props.appConfig.deploymentStrategy?.deploymentStrategyArn
|
|
88
|
+
)
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.appConfigDeploymentStrategy = new DeploymentStrategy(this, `${this.id}-ac-deployment-strategy`, {
|
|
93
|
+
...this.props.appConfig.deploymentStrategy,
|
|
94
|
+
rolloutStrategy:
|
|
95
|
+
this.props.appConfig.deploymentStrategy?.rolloutStrategy ??
|
|
96
|
+
RolloutStrategy.linear({
|
|
97
|
+
growthFactor: 100,
|
|
98
|
+
deploymentDuration: Duration.minutes(0),
|
|
99
|
+
finalBakeTime: Duration.minutes(0),
|
|
100
|
+
}),
|
|
101
|
+
deploymentStrategyName: this.resourceNameFormatter.format(
|
|
102
|
+
this.props.appConfig.deploymentStrategy.deploymentStrategyName ?? 'common-deployment-strategy',
|
|
84
103
|
this.props.resourceNameOptions?.appconfig
|
|
85
104
|
),
|
|
86
|
-
replicateTo: this.props.appConfig.deploymentStrategy.replicateTo,
|
|
87
105
|
})
|
|
88
106
|
}
|
|
89
107
|
|
|
@@ -92,7 +110,7 @@ export class ApplicationConfiguration extends CommonConstruct {
|
|
|
92
110
|
applicationId: Fn.ref(this.appConfigApplication.logicalId),
|
|
93
111
|
configurationProfileId: Fn.ref(this.appConfigProfile.logicalId),
|
|
94
112
|
configurationVersion: Fn.ref(this.appConfigVersion.logicalId),
|
|
95
|
-
deploymentStrategyId:
|
|
113
|
+
deploymentStrategyId: this.appConfigDeploymentStrategy.deploymentStrategyId,
|
|
96
114
|
environmentId: Fn.ref(this.appConfigEnvironment.logicalId),
|
|
97
115
|
})
|
|
98
116
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Fn } from 'aws-cdk-lib'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CfnApplication,
|
|
4
|
+
CfnConfigurationProfile,
|
|
5
|
+
CfnEnvironment,
|
|
6
|
+
DeploymentStrategy,
|
|
7
|
+
RolloutStrategy,
|
|
8
|
+
} from 'aws-cdk-lib/aws-appconfig'
|
|
3
9
|
import { CommonConstruct } from '../../common'
|
|
4
10
|
import { createCfnOutput } from '../../utils'
|
|
5
11
|
import { Architecture } from '../constants'
|
|
@@ -120,4 +126,30 @@ export class AppConfigManager {
|
|
|
120
126
|
|
|
121
127
|
return profile
|
|
122
128
|
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @summary Method to create an AppConfig Deployment Strategy
|
|
132
|
+
* @param id scoped id of the resource
|
|
133
|
+
* @param scope scope in which this resource is defined
|
|
134
|
+
* @param props
|
|
135
|
+
* @returns the appconfig deployment strategy
|
|
136
|
+
*/
|
|
137
|
+
public createDeploymentStrategy(id: string, scope: CommonConstruct, props: AppConfigProps): DeploymentStrategy {
|
|
138
|
+
if (!props) throw `AppConfig props undefined for ${id}`
|
|
139
|
+
if (!props.deploymentStrategy) throw `AppConfig deploymentStrategy props undefined for ${id}`
|
|
140
|
+
|
|
141
|
+
const deploymentStrategy = new DeploymentStrategy(scope, `${id}`, {
|
|
142
|
+
...props,
|
|
143
|
+
deploymentStrategyName: scope.resourceNameFormatter.format(
|
|
144
|
+
props.deploymentStrategy.deploymentStrategyName ?? 'common-deployment-strategy',
|
|
145
|
+
scope.props.resourceNameOptions?.appconfig
|
|
146
|
+
),
|
|
147
|
+
rolloutStrategy: props.deploymentStrategy.rolloutStrategy ?? RolloutStrategy.ALL_AT_ONCE,
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
createCfnOutput(`${id}-deploymentStrategyId`, scope, deploymentStrategy.deploymentStrategyId)
|
|
151
|
+
createCfnOutput(`${id}-deploymentStrategyArn`, scope, deploymentStrategy.deploymentStrategyArn)
|
|
152
|
+
|
|
153
|
+
return deploymentStrategy
|
|
154
|
+
}
|
|
123
155
|
}
|
|
@@ -4,16 +4,24 @@ import {
|
|
|
4
4
|
CfnDeploymentProps,
|
|
5
5
|
CfnDeploymentStrategyProps,
|
|
6
6
|
CfnEnvironmentProps,
|
|
7
|
+
DeploymentStrategyProps,
|
|
7
8
|
} from 'aws-cdk-lib/aws-appconfig'
|
|
8
9
|
import { ResourceNameFormatterProps } from '../../common'
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export interface AppConfigDeploymentStrategyProps extends DeploymentStrategyProps {
|
|
15
|
+
deploymentStrategyArn?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
/**
|
|
11
19
|
*/
|
|
12
20
|
export interface AppConfigProps {
|
|
13
21
|
application: CfnApplicationProps
|
|
14
22
|
configurationProfile: CfnConfigurationProfileProps
|
|
15
23
|
deployment: CfnDeploymentProps
|
|
16
|
-
deploymentStrategy:
|
|
24
|
+
deploymentStrategy: AppConfigDeploymentStrategyProps
|
|
17
25
|
environment: CfnEnvironmentProps
|
|
18
26
|
id: string
|
|
19
27
|
}
|