-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codedeploy): change the load balancer API in server Deployment Gr…
…oup. BREAKING CHANGE: the type of the `loadBalancer` property in ServerDeploymentGroupProps has been changed. Fixes #2449
- Loading branch information
Showing
17 changed files
with
125 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
## AWS CodeDeploy Load Balancing API | ||
|
||
This package contains the abstract API of Load Balancers | ||
as required by the AWS CodeDeploy Construct Library. | ||
|
||
You should never need to depend on it directly - | ||
instead, depend on the `aws-codedeploy` package. | ||
This package has been deprecated, | ||
and will be removed in a future release of the Cloud Development Kit. | ||
Please remove if from your dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
export * from './load-balancer'; | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './application'; | ||
export * from './deployment-config'; | ||
export * from './deployment-group'; | ||
export * from './load-balancer'; |
90 changes: 90 additions & 0 deletions
90
packages/@aws-cdk/aws-codedeploy/lib/server/load-balancer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import elb = require('@aws-cdk/aws-elasticloadbalancing'); | ||
import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2'); | ||
|
||
/** | ||
* The generations of AWS load balancing solutions. | ||
*/ | ||
export enum LoadBalancerGeneration { | ||
/** | ||
* The first generation (ELB Classic). | ||
*/ | ||
FIRST = 0, | ||
|
||
/** | ||
* The second generation (ALB and NLB). | ||
*/ | ||
SECOND = 1 | ||
} | ||
|
||
/** | ||
* An interface of an abstract load balancer, as needed by CodeDeploy. | ||
* Create instances using the static factory methods: | ||
* {@link #classic}, {@link #application} and {@link #network}. | ||
*/ | ||
export abstract class LoadBalancer { | ||
/** | ||
* Creates a new CodeDeploy load balancer from a Classic ELB Load Balancer. | ||
* | ||
* @param loadBalancer a classic ELB Load Balancer | ||
*/ | ||
public static classic(loadBalancer: elb.LoadBalancer): LoadBalancer { | ||
return new ClassicLoadBalancer(loadBalancer); | ||
} | ||
|
||
/** | ||
* Creates a new CodeDeploy load balancer from an Application Load Balancer Target Group. | ||
* | ||
* @param albTargetGroup an ALB Target Group | ||
*/ | ||
public static application(albTargetGroup: elbv2.ApplicationTargetGroup): LoadBalancer { | ||
return new AlbLoadBalancer(albTargetGroup); | ||
} | ||
|
||
/** | ||
* Creates a new CodeDeploy load balancer from a Network Load Balancer Target Group. | ||
* | ||
* @param nlbTargetGroup an NLB Target Group | ||
*/ | ||
public static network(nlbTargetGroup: elbv2.NetworkTargetGroup): LoadBalancer { | ||
return new NlbLoadBalancer(nlbTargetGroup); | ||
} | ||
|
||
public abstract readonly generation: LoadBalancerGeneration; | ||
public abstract readonly name: string; | ||
} | ||
|
||
class ClassicLoadBalancer extends LoadBalancer { | ||
public readonly generation: LoadBalancerGeneration; | ||
public readonly name: string; | ||
|
||
constructor(loadBalancer: elb.LoadBalancer) { | ||
super(); | ||
|
||
this.generation = LoadBalancerGeneration.FIRST; | ||
this.name = loadBalancer.loadBalancerName; | ||
} | ||
} | ||
|
||
class AlbLoadBalancer extends LoadBalancer { | ||
public readonly generation: LoadBalancerGeneration; | ||
public readonly name: string; | ||
|
||
constructor(targetGroup: elbv2.ApplicationTargetGroup) { | ||
super(); | ||
|
||
this.generation = LoadBalancerGeneration.SECOND; | ||
this.name = targetGroup.targetGroupName; | ||
} | ||
} | ||
|
||
class NlbLoadBalancer extends LoadBalancer { | ||
public readonly generation: LoadBalancerGeneration; | ||
public readonly name: string; | ||
|
||
constructor(targetGroup: elbv2.NetworkTargetGroup) { | ||
super(); | ||
|
||
this.generation = LoadBalancerGeneration.SECOND; | ||
this.name = targetGroup.targetGroupName; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.