Skip to content

Commit 3960720

Browse files
authored
fix(appconfig): prefix names with resource name (#28742)
Linter rules caught that CDK standardizes resource name prop as `[resource]Name`. Previously this module only used `name` for the prop. Follow up from #28671. BREAKING CHANGE: `ApplicationProps.name` renamed to `ApplicationProps.applicationName` - **appconfig**: `EnvironmentProps.name` renamed to `EnvironmentProps.environmentName` - **appconfig**: `DeploymentStrategyProps.name` renamed to `DeploymentStrategyProps.deploymentStrategyName` - **appconfig**: `ExtensionProps.name` renamed to `ExtensionProps.extensionName` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent fc0a89a commit 3960720

14 files changed

+43
-47
lines changed

packages/@aws-cdk/aws-appconfig-alpha/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Create an application with a name and description:
3939

4040
```ts
4141
new appconfig.Application(this, 'MyApplication', {
42-
name: 'App1',
42+
applicationName: 'App1',
4343
description: 'This is my application created through CDK.',
4444
});
4545
```

packages/@aws-cdk/aws-appconfig-alpha/awslint.json

-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@
2727

2828
"no-unused-type:@aws-cdk/aws-appconfig-alpha.PredefinedDeploymentStrategyId",
2929
"ref-via-interface:@aws-cdk/aws-appconfig-alpha.Application.addAgentToEcs.taskDef",
30-
"props-physical-name:@aws-cdk/aws-appconfig-alpha.ApplicationProps",
31-
"props-physical-name:@aws-cdk/aws-appconfig-alpha.DeploymentStrategyProps",
32-
"props-physical-name:@aws-cdk/aws-appconfig-alpha.EnvironmentProps",
33-
"props-physical-name:@aws-cdk/aws-appconfig-alpha.ExtensionProps",
3430
"events-in-interface",
3531
"events-method-signature",
3632
"events-generic"

packages/@aws-cdk/aws-appconfig-alpha/lib/application.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export interface ApplicationProps {
8484
*
8585
* @default - A name is generated.
8686
*/
87-
readonly name?: string;
87+
readonly applicationName?: string;
8888

8989
/**
9090
* The description for the application.
@@ -336,7 +336,7 @@ export class Application extends ApplicationBase {
336336
super(scope, id);
337337

338338
this.description = props.description;
339-
this.name = props.name || Names.uniqueResourceName(this, {
339+
this.name = props.applicationName || Names.uniqueResourceName(this, {
340340
maxLength: 64,
341341
separator: '-',
342342
});

packages/@aws-cdk/aws-appconfig-alpha/lib/deployment-strategy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface DeploymentStrategyProps {
1818
*
1919
* @default - A name is generated.
2020
*/
21-
readonly name?: string;
21+
readonly deploymentStrategyName?: string;
2222

2323
/**
2424
* A description of the deployment strategy.
@@ -130,15 +130,15 @@ export class DeploymentStrategy extends Resource implements IDeploymentStrategy
130130

131131
constructor(scope: Construct, id: string, props: DeploymentStrategyProps) {
132132
super(scope, id, {
133-
physicalName: props.name,
133+
physicalName: props.deploymentStrategyName,
134134
});
135135

136136
this.deploymentDurationInMinutes = props.rolloutStrategy.deploymentDuration.toMinutes();
137137
this.growthFactor = props.rolloutStrategy.growthFactor;
138138
this.description = props.description;
139139
this.finalBakeTimeInMinutes = props.rolloutStrategy.finalBakeTime?.toMinutes();
140140
this.growthType = props.rolloutStrategy.growthType;
141-
this.name = props.name || Names.uniqueResourceName(this, {
141+
this.name = props.deploymentStrategyName || Names.uniqueResourceName(this, {
142142
maxLength: 64,
143143
separator: '-',
144144
});

packages/@aws-cdk/aws-appconfig-alpha/lib/environment.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export interface EnvironmentOptions {
9494
*
9595
* @default - A name is generated.
9696
*/
97-
readonly name?: string;
97+
readonly environmentName?: string;
9898

9999
/**
100100
* The description of the environment.
@@ -236,10 +236,10 @@ export class Environment extends EnvironmentBase {
236236

237237
constructor(scope: Construct, id: string, props: EnvironmentProps) {
238238
super(scope, id, {
239-
physicalName: props.name,
239+
physicalName: props.environmentName,
240240
});
241241

242-
this.name = props.name || Names.uniqueResourceName(this, {
242+
this.name = props.environmentName || Names.uniqueResourceName(this, {
243243
maxLength: 64,
244244
separator: '-',
245245
});

packages/@aws-cdk/aws-appconfig-alpha/lib/extension.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export interface ExtensionOptions {
338338
*
339339
* @default - A name is generated.
340340
*/
341-
readonly name?: string;
341+
readonly extensionName?: string;
342342

343343
/**
344344
* A description of the extension
@@ -493,11 +493,11 @@ export class Extension extends Resource implements IExtension {
493493

494494
constructor(scope: Construct, id: string, props: ExtensionProps) {
495495
super(scope, id, {
496-
physicalName: props.name,
496+
physicalName: props.extensionName,
497497
});
498498

499499
this.actions = props.actions;
500-
this.name = props.name || Names.uniqueResourceName(this, {
500+
this.name = props.extensionName || Names.uniqueResourceName(this, {
501501
maxLength: 64,
502502
separator: '-',
503503
});
@@ -662,7 +662,7 @@ export class ExtensibleBase implements IExtensible {
662662
}
663663

664664
private getExtensionForActionPoint(eventDestination: IEventDestination, actionPoint: ActionPoint, options?: ExtensionOptions) {
665-
const name = options?.name || this.getExtensionDefaultName();
665+
const name = options?.extensionName || this.getExtensionDefaultName();
666666
const versionNumber = options?.latestVersionNumber ? options?.latestVersionNumber + 1 : 1;
667667
const extension = new Extension(this.scope, `Extension${this.getExtensionHash(name, versionNumber)}`, {
668668
actions: [
@@ -673,7 +673,7 @@ export class ExtensibleBase implements IExtensible {
673673
],
674674
}),
675675
],
676-
name,
676+
extensionName: name,
677677
...(options?.description ? { description: options.description } : {}),
678678
...(options?.latestVersionNumber ? { latestVersionNumber: options.latestVersionNumber } : {}),
679679
...(options?.parameters ? { parameters: options.parameters } : {}),

packages/@aws-cdk/aws-appconfig-alpha/test/application.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('appconfig', () => {
2323
test('appconfig with name', () => {
2424
const stack = new cdk.Stack();
2525
new Application(stack, 'MyAppConfig', {
26-
name: 'TestApp',
26+
applicationName: 'TestApp',
2727
});
2828

2929
Template.fromStack(stack).hasResourceProperties('AWS::AppConfig::Application', {
@@ -121,7 +121,7 @@ describe('appconfig', () => {
121121
});
122122
appconfig.preCreateHostedConfigurationVersion(new LambdaDestination(func), {
123123
description: 'This is my description',
124-
name: 'MyExtension',
124+
extensionName: 'MyExtension',
125125
latestVersionNumber: 1,
126126
parameters: [
127127
Parameter.required('myparam', 'val'),

packages/@aws-cdk/aws-appconfig-alpha/test/configuration.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('configuration', () => {
5858
test('configuration with environments and no deployTo prop', () => {
5959
const stack = new cdk.Stack();
6060
const app = new Application(stack, 'MyAppConfig', {
61-
name: 'MyApplication',
61+
applicationName: 'MyApplication',
6262
});
6363
app.addEnvironment('MyEnv1');
6464
app.addEnvironment('MyEnv2');
@@ -96,7 +96,7 @@ describe('configuration', () => {
9696
test('configuration with environments and deployTo prop', () => {
9797
const stack = new cdk.Stack();
9898
const app = new Application(stack, 'MyAppConfig', {
99-
name: 'MyApplication',
99+
applicationName: 'MyApplication',
100100
});
101101
app.addEnvironment('MyEnv1');
102102
const env = app.addEnvironment('MyEnv2');
@@ -152,7 +152,7 @@ describe('configuration', () => {
152152
test('configuration using deploy method and no environment associated', () => {
153153
const stack = new cdk.Stack();
154154
const app = new Application(stack, 'MyAppConfig', {
155-
name: 'MyApplication',
155+
applicationName: 'MyApplication',
156156
});
157157
app.addEnvironment('MyEnv1');
158158
const env = app.addEnvironment('MyEnv2');
@@ -191,7 +191,7 @@ describe('configuration', () => {
191191
test('configuration using deploy method with environment associated', () => {
192192
const stack = new cdk.Stack();
193193
const app = new Application(stack, 'MyAppConfig', {
194-
name: 'MyApplication',
194+
applicationName: 'MyApplication',
195195
});
196196
const env1 = app.addEnvironment('MyEnv1');
197197
const env2 = app.addEnvironment('MyEnv2');
@@ -248,7 +248,7 @@ describe('configuration', () => {
248248
test('configuration with no environment associated and no deploy method used', () => {
249249
const stack = new cdk.Stack();
250250
const app = new Application(stack, 'MyAppConfig', {
251-
name: 'MyApplication',
251+
applicationName: 'MyApplication',
252252
});
253253
new HostedConfiguration(stack, 'MyHostedConfig', {
254254
content: ConfigurationContent.fromInlineText('This is my content'),
@@ -267,7 +267,7 @@ describe('configuration', () => {
267267
test('configuration with two configurations specified', () => {
268268
const stack = new cdk.Stack();
269269
const app = new Application(stack, 'MyAppConfig', {
270-
name: 'MyApplication',
270+
applicationName: 'MyApplication',
271271
});
272272
const env1 = app.addEnvironment('MyEnv1');
273273
const env2 = app.addEnvironment('MyEnv2');
@@ -382,7 +382,7 @@ describe('configuration', () => {
382382
test('configuration with two configurations and no deployment strategy specified', () => {
383383
const stack = new cdk.Stack();
384384
const app = new Application(stack, 'MyAppConfig', {
385-
name: 'MyApplication',
385+
applicationName: 'MyApplication',
386386
});
387387
const bucket = new Bucket(stack, 'MyBucket');
388388
new HostedConfiguration(stack, 'MyHostedConfig', {

packages/@aws-cdk/aws-appconfig-alpha/test/deployment-strategy.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('deployment strategy', () => {
2525
test('deployment strategy with name', () => {
2626
const stack = new cdk.Stack();
2727
new DeploymentStrategy(stack, 'MyDeploymentStrategy', {
28-
name: 'TestDeploymentStrategy',
28+
deploymentStrategyName: 'TestDeploymentStrategy',
2929
rolloutStrategy: RolloutStrategy.linear({
3030
growthFactor: 10,
3131
deploymentDuration: cdk.Duration.minutes(10),
@@ -44,7 +44,7 @@ describe('deployment strategy', () => {
4444
test('deployment strategy duration in seconds', () => {
4545
const stack = new cdk.Stack();
4646
new DeploymentStrategy(stack, 'MyDeploymentStrategy', {
47-
name: 'TestDeploymentStrategy',
47+
deploymentStrategyName: 'TestDeploymentStrategy',
4848
rolloutStrategy: RolloutStrategy.linear({
4949
growthFactor: 10,
5050
deploymentDuration: cdk.Duration.seconds(120),
@@ -63,7 +63,7 @@ describe('deployment strategy', () => {
6363
test('deployment strategy with description', () => {
6464
const stack = new cdk.Stack();
6565
new DeploymentStrategy(stack, 'MyDeploymentStrategy', {
66-
name: 'TestDeploymentStrategy',
66+
deploymentStrategyName: 'TestDeploymentStrategy',
6767
rolloutStrategy: RolloutStrategy.linear({
6868
growthFactor: 10,
6969
deploymentDuration: cdk.Duration.minutes(10),
@@ -84,7 +84,7 @@ describe('deployment strategy', () => {
8484
test('deployment strategy with final bake time', () => {
8585
const stack = new cdk.Stack();
8686
new DeploymentStrategy(stack, 'MyDeploymentStrategy', {
87-
name: 'TestDeploymentStrategy',
87+
deploymentStrategyName: 'TestDeploymentStrategy',
8888
rolloutStrategy: RolloutStrategy.linear({
8989
growthFactor: 10,
9090
deploymentDuration: cdk.Duration.minutes(10),
@@ -105,7 +105,7 @@ describe('deployment strategy', () => {
105105
test('deployment strategy with growth type', () => {
106106
const stack = new cdk.Stack();
107107
new DeploymentStrategy(stack, 'MyDeploymentStrategy', {
108-
name: 'TestDeploymentStrategy',
108+
deploymentStrategyName: 'TestDeploymentStrategy',
109109
rolloutStrategy: RolloutStrategy.exponential({
110110
growthFactor: 10,
111111
deploymentDuration: cdk.Duration.minutes(10),
@@ -124,7 +124,7 @@ describe('deployment strategy', () => {
124124
test('deployment strategy with replicate to', () => {
125125
const stack = new cdk.Stack();
126126
new DeploymentStrategy(stack, 'MyDeploymentStrategy', {
127-
name: 'TestDeploymentStrategy',
127+
deploymentStrategyName: 'TestDeploymentStrategy',
128128
rolloutStrategy: RolloutStrategy.linear({
129129
growthFactor: 10,
130130
deploymentDuration: cdk.Duration.minutes(10),

packages/@aws-cdk/aws-appconfig-alpha/test/environment.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('environment', () => {
2525
const stack = new cdk.Stack();
2626
const app = new Application(stack, 'MyAppConfig');
2727
new Environment(stack, 'MyEnvironment', {
28-
name: 'TestEnv',
28+
environmentName: 'TestEnv',
2929
application: app,
3030
});
3131

@@ -41,7 +41,7 @@ describe('environment', () => {
4141
const stack = new cdk.Stack();
4242
const app = new Application(stack, 'MyAppConfig');
4343
new Environment(stack, 'MyEnvironment', {
44-
name: 'TestEnv',
44+
environmentName: 'TestEnv',
4545
application: app,
4646
description: 'This is my description',
4747
});
@@ -72,7 +72,7 @@ describe('environment', () => {
7272
assumedBy: new iam.ServicePrincipal('appconfig.amazonaws.com'),
7373
});
7474
const env = new Environment(stack, 'MyEnvironment', {
75-
name: 'TestEnv',
75+
environmentName: 'TestEnv',
7676
application: app,
7777
monitors: [Monitor.fromCloudWatchAlarm(alarm, alarmRole)],
7878
});
@@ -118,7 +118,7 @@ describe('environment', () => {
118118
});
119119
const app = new Application(stack, 'MyAppConfig');
120120
const env = new Environment(stack, 'MyEnvironment', {
121-
name: 'TestEnv',
121+
environmentName: 'TestEnv',
122122
application: app,
123123
monitors: [Monitor.fromCloudWatchAlarm(alarm)],
124124
});
@@ -174,7 +174,7 @@ describe('environment', () => {
174174
const stack = new cdk.Stack();
175175
const app = new Application(stack, 'MyAppConfig');
176176
const env = new Environment(stack, 'MyEnvironment', {
177-
name: 'TestEnv',
177+
environmentName: 'TestEnv',
178178
application: app,
179179
monitors: [
180180
Monitor.fromCfnMonitorsProperty({
@@ -203,7 +203,7 @@ describe('environment', () => {
203203
const stack = new cdk.Stack();
204204
const app = new Application(stack, 'MyAppConfig');
205205
const env = new Environment(stack, 'MyEnvironment', {
206-
name: 'TestEnv',
206+
environmentName: 'TestEnv',
207207
application: app,
208208
monitors: [
209209
Monitor.fromCfnMonitorsProperty({
@@ -247,7 +247,7 @@ describe('environment', () => {
247247
alarmRule: alarm,
248248
});
249249
const env = new Environment(stack, 'MyEnvironment', {
250-
name: 'TestEnv',
250+
environmentName: 'TestEnv',
251251
application: app,
252252
monitors: [
253253
Monitor.fromCloudWatchAlarm(compositeAlarm),
@@ -330,7 +330,7 @@ describe('environment', () => {
330330
alarmRule: alarm,
331331
});
332332
const env = new Environment(stack, 'MyEnvironment', {
333-
name: 'TestEnv',
333+
environmentName: 'TestEnv',
334334
application: app,
335335
monitors: [
336336
Monitor.fromCloudWatchAlarm(compositeAlarm1),
@@ -433,7 +433,7 @@ describe('environment', () => {
433433
),
434434
});
435435
new Environment(stack, 'MyEnvironment', {
436-
name: 'TestEnv',
436+
environmentName: 'TestEnv',
437437
application: app,
438438
monitors: [
439439
Monitor.fromCloudWatchAlarm(alarm1),

packages/@aws-cdk/aws-appconfig-alpha/test/extension.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ describe('extension', () => {
185185
value: 'arn:lambda:us-east-1:123456789012:function:my-function',
186186
});
187187
const appconfig = new Application(stack, 'MyApplication', {
188-
name: 'MyApplication',
188+
applicationName: 'MyApplication',
189189
});
190190
const ext = new Extension(stack, 'MyExtension', {
191191
actions: [
@@ -196,7 +196,7 @@ describe('extension', () => {
196196
eventDestination: new LambdaDestination(func),
197197
}),
198198
],
199-
name: 'TestExtension',
199+
extensionName: 'TestExtension',
200200
description: 'This is my extension',
201201
parameters: [
202202
Parameter.required('testVariable', 'hello'),

packages/@aws-cdk/aws-appconfig-alpha/test/integ.configuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const stack = new Stack(app, 'aws-appconfig-configuration');
3838

3939
// create application for config profile
4040
const appConfigApp = new Application(stack, 'MyAppConfig', {
41-
name: 'AppForConfigTest',
41+
applicationName: 'AppForConfigTest',
4242
});
4343

4444
const deploymentStrategy = new DeploymentStrategy(stack, 'MyDeployStrategy', {

packages/@aws-cdk/aws-appconfig-alpha/test/integ.environment.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const stack = new Stack(app, 'aws-appconfig-environment');
1010

1111
// create resources needed for environment
1212
const appForEnv = new Application(stack, 'MyApplicationForEnv', {
13-
name: 'AppForEnvTest',
13+
applicationName: 'AppForEnvTest',
1414
});
1515
const alarm = new Alarm(stack, 'MyAlarm', {
1616
metric: new Metric({

packages/@aws-cdk/aws-appconfig-alpha/test/integ.extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const lambda = new Function(stack, 'MyFunction', {
3131
code: Code.fromInline('def handler(event, context):\n\tprint(\'The function has been invoked.\')'),
3232
});
3333
const app = new Application(stack, 'MyApplication', {
34-
name: 'AppForExtensionTest',
34+
applicationName: 'AppForExtensionTest',
3535
});
3636
const lambdaExtension = new Extension(stack, 'MyLambdaExtension', {
3737
actions: [

0 commit comments

Comments
 (0)