Skip to content

Commit be6074a

Browse files
fix: breaking change to deployment config props (#22567)
Change all `deploymentConfig` static method implementations on `EcsDeploymentConfig`, `LambdaDeploymentConfig`, and `ServerDeploymentConfig` to return their corresponding specific interfaces instead of `IBaseDeploymentConfig`. This reverts breaking changes to Java users introduced in #22159 Fixes #22566 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 7b47f41 commit be6074a

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

Diff for: packages/@aws-cdk/aws-codedeploy/lib/base-deployment-config.ts

-13
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,6 @@ export abstract class BaseDeploymentConfig extends Resource implements IBaseDepl
109109
};
110110
}
111111

112-
/**
113-
* This method should be used only for static references to predefined deployment configurations,
114-
* like EcsDeploymentConfig.ALL_AT_ONCE
115-
* @param name the name of the referenced custom Deployment Configuration
116-
* @returns a reference to an existing custom Deployment Configuration
117-
*/
118-
protected static deploymentConfig(name: string): IBaseDeploymentConfig {
119-
return {
120-
deploymentConfigName: name,
121-
deploymentConfigArn: arnForDeploymentConfig(name),
122-
};
123-
}
124-
125112
/**
126113
* The name of the deployment config
127114
* @attribute

Diff for: packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Construct } from 'constructs';
22
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, ComputePlatform, IBaseDeploymentConfig } from '../base-deployment-config';
33
import { TrafficRouting } from '../traffic-routing-config';
4+
import { deploymentConfig } from '../utils';
45

56
/**
67
* The Deployment Configuration of an ECS Deployment Group.
@@ -59,6 +60,10 @@ export class EcsDeploymentConfig extends BaseDeploymentConfig implements IEcsDep
5960
return this.fromDeploymentConfigName(scope, id, ecsDeploymentConfigName);
6061
}
6162

63+
private static deploymentConfig(name: string): IEcsDeploymentConfig {
64+
return deploymentConfig(name);
65+
}
66+
6267
public constructor(scope: Construct, id: string, props?: EcsDeploymentConfigProps) {
6368
super(scope, id, {
6469
...props,

Diff for: packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Construct } from 'constructs';
22
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, ComputePlatform, IBaseDeploymentConfig } from '../base-deployment-config';
33
import { TrafficRouting } from '../traffic-routing-config';
4+
import { deploymentConfig } from '../utils';
45

56
/**
67
* The Deployment Configuration of a Lambda Deployment Group.
@@ -92,6 +93,10 @@ export class LambdaDeploymentConfig extends BaseDeploymentConfig implements ILam
9293
return this.fromLambdaDeploymentConfigName(_scope, _id, props.deploymentConfigName);
9394
}
9495

96+
private static deploymentConfig(name: string): ILambdaDeploymentConfig {
97+
return deploymentConfig(name);
98+
}
99+
95100
public constructor(scope: Construct, id: string, props?: LambdaDeploymentConfigProps) {
96101
super(scope, id, {
97102
...props,

Diff for: packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Construct } from 'constructs';
22
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, IBaseDeploymentConfig } from '../base-deployment-config';
33
import { MinimumHealthyHosts } from '../host-health-config';
4+
import { deploymentConfig } from '../utils';
45

56
/**
67
* The Deployment Configuration of an EC2/on-premise Deployment Group.
@@ -63,6 +64,10 @@ export class ServerDeploymentConfig extends BaseDeploymentConfig implements ISer
6364
return this.fromDeploymentConfigName(scope, id, serverDeploymentConfigName);
6465
}
6566

67+
private static deploymentConfig(name: string): IServerDeploymentConfig {
68+
return deploymentConfig(name);
69+
}
70+
6671
constructor(scope: Construct, id: string, props: ServerDeploymentConfigProps) {
6772
super(scope, id, props);
6873
}

Diff for: packages/@aws-cdk/aws-codedeploy/lib/utils.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
22
import { Aws, Token } from '@aws-cdk/core';
3+
import { IBaseDeploymentConfig } from './base-deployment-config';
34
import { CfnDeploymentGroup } from './codedeploy.generated';
45
import { AutoRollbackConfig } from './rollback-config';
56

@@ -26,6 +27,13 @@ CfnDeploymentGroup.AlarmConfigurationProperty | undefined {
2627
};
2728
}
2829

30+
export function deploymentConfig(name: string): IBaseDeploymentConfig {
31+
return {
32+
deploymentConfigName: name,
33+
deploymentConfigArn: arnForDeploymentConfig(name),
34+
};
35+
}
36+
2937
enum AutoRollbackEvent {
3038
DEPLOYMENT_FAILURE = 'DEPLOYMENT_FAILURE',
3139
DEPLOYMENT_STOP_ON_ALARM = 'DEPLOYMENT_STOP_ON_ALARM',

0 commit comments

Comments
 (0)