-
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.
feat(route53-targets): Add aws-route53-targets/InterfaceVpcEndpointTa…
…rget (#4868) * Add InterfaceVpcEndpointTarget * Update RecordTarget * Revert yarn.lock * Fix tests * Revert integ json * Rename r53 to route53 * Rename r53 to route53 * Update tests, and README * Fix devDep * Remove newline * Fix grammar
- Loading branch information
1 parent
a1cd743
commit 6969562
Showing
7 changed files
with
807 additions
and
1 deletion.
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
20 changes: 20 additions & 0 deletions
20
packages/@aws-cdk/aws-route53-targets/lib/interface-vpc-endpoint-target.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,20 @@ | ||
import * as ec2 from '@aws-cdk/aws-ec2'; | ||
import * as route53 from '@aws-cdk/aws-route53'; | ||
import * as cdk from '@aws-cdk/core'; | ||
|
||
/** | ||
* Set an InterfaceVpcEndpoint as a target for an ARecord | ||
*/ | ||
export class InterfaceVpcEndpointTarget implements route53.IAliasRecordTarget { | ||
private readonly cfnVpcEndpoint: ec2.CfnVPCEndpoint; | ||
constructor(private readonly vpcEndpoint: ec2.IInterfaceVpcEndpoint) { | ||
this.cfnVpcEndpoint = this.vpcEndpoint.node.findChild('Resource') as ec2.CfnVPCEndpoint; | ||
} | ||
|
||
public bind(_record: route53.IRecordSet): route53.AliasRecordTargetConfig { | ||
return { | ||
dnsName: cdk.Fn.select(1, cdk.Fn.split(':', cdk.Fn.select(0, this.cfnVpcEndpoint.attrDnsEntries))), | ||
hostedZoneId: cdk.Fn.select(0, cdk.Fn.split(':', cdk.Fn.select(0, this.cfnVpcEndpoint.attrDnsEntries))), | ||
}; | ||
} | ||
} |
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.