Skip to content

Commit

Permalink
fix: breaking change to deployment config props (#22567)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
MrArnoldPalmer committed Oct 20, 2022
1 parent 7b47f41 commit be6074a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
13 changes: 0 additions & 13 deletions packages/@aws-cdk/aws-codedeploy/lib/base-deployment-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,6 @@ export abstract class BaseDeploymentConfig extends Resource implements IBaseDepl
};
}

/**
* This method should be used only for static references to predefined deployment configurations,
* like EcsDeploymentConfig.ALL_AT_ONCE
* @param name the name of the referenced custom Deployment Configuration
* @returns a reference to an existing custom Deployment Configuration
*/
protected static deploymentConfig(name: string): IBaseDeploymentConfig {
return {
deploymentConfigName: name,
deploymentConfigArn: arnForDeploymentConfig(name),
};
}

/**
* The name of the deployment config
* @attribute
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Construct } from 'constructs';
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, ComputePlatform, IBaseDeploymentConfig } from '../base-deployment-config';
import { TrafficRouting } from '../traffic-routing-config';
import { deploymentConfig } from '../utils';

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

private static deploymentConfig(name: string): IEcsDeploymentConfig {
return deploymentConfig(name);
}

public constructor(scope: Construct, id: string, props?: EcsDeploymentConfigProps) {
super(scope, id, {
...props,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Construct } from 'constructs';
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, ComputePlatform, IBaseDeploymentConfig } from '../base-deployment-config';
import { TrafficRouting } from '../traffic-routing-config';
import { deploymentConfig } from '../utils';

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

private static deploymentConfig(name: string): ILambdaDeploymentConfig {
return deploymentConfig(name);
}

public constructor(scope: Construct, id: string, props?: LambdaDeploymentConfigProps) {
super(scope, id, {
...props,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Construct } from 'constructs';
import { BaseDeploymentConfig, BaseDeploymentConfigOptions, IBaseDeploymentConfig } from '../base-deployment-config';
import { MinimumHealthyHosts } from '../host-health-config';
import { deploymentConfig } from '../utils';

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

private static deploymentConfig(name: string): IServerDeploymentConfig {
return deploymentConfig(name);
}

constructor(scope: Construct, id: string, props: ServerDeploymentConfigProps) {
super(scope, id, props);
}
Expand Down
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-codedeploy/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import { Aws, Token } from '@aws-cdk/core';
import { IBaseDeploymentConfig } from './base-deployment-config';
import { CfnDeploymentGroup } from './codedeploy.generated';
import { AutoRollbackConfig } from './rollback-config';

Expand All @@ -26,6 +27,13 @@ CfnDeploymentGroup.AlarmConfigurationProperty | undefined {
};
}

export function deploymentConfig(name: string): IBaseDeploymentConfig {
return {
deploymentConfigName: name,
deploymentConfigArn: arnForDeploymentConfig(name),
};
}

enum AutoRollbackEvent {
DEPLOYMENT_FAILURE = 'DEPLOYMENT_FAILURE',
DEPLOYMENT_STOP_ON_ALARM = 'DEPLOYMENT_STOP_ON_ALARM',
Expand Down

0 comments on commit be6074a

Please sign in to comment.