-
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.
refactor(elbv2): introduce ListenerCertificate (#5405)
Finally model certificates in a consistent way, using an `IListenerCertificate` interface (it has to be an interface to be able to maintain backwards compatibility with the erroneously introduced `INetworkListenerCertificateProps` interface) and an implemention of it called `ListenerCertificate`. `ListenerCertificate` can currently be created from an ACM certificate, and in the future should also be creatable from an IAM certificate. Make it the same for ALB and NLBs. Fixes #5330.
- Loading branch information
1 parent
e4309ab
commit 32b98a8
Showing
9 changed files
with
135 additions
and
19 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
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
39 changes: 39 additions & 0 deletions
39
packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/listener-certificate.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,39 @@ | ||
import acm = require('@aws-cdk/aws-certificatemanager'); | ||
|
||
/** | ||
* A certificate source for an ELBv2 listener | ||
*/ | ||
export interface IListenerCertificate { | ||
/** | ||
* The ARN of the certificate to use | ||
*/ | ||
readonly certificateArn: string; | ||
} | ||
|
||
/** | ||
* A certificate source for an ELBv2 listener | ||
*/ | ||
export class ListenerCertificate implements IListenerCertificate { | ||
/** | ||
* Use an ACM certificate as a listener certificate | ||
*/ | ||
public static fromCertificateManager(acmCertificate: acm.ICertificate) { | ||
return new ListenerCertificate(acmCertificate.certificateArn); | ||
} | ||
|
||
/** | ||
* Use any certificate, identified by its ARN, as a listener certificate | ||
*/ | ||
public static fromArn(certificateArn: string) { | ||
return new ListenerCertificate(certificateArn); | ||
} | ||
|
||
/** | ||
* The ARN of the certificate to use | ||
*/ | ||
public readonly certificateArn: string; | ||
|
||
protected constructor(certificateArn: string) { | ||
this.certificateArn = certificateArn; | ||
} | ||
} |
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