From ae291809ff6db5cd0a14ddadd9b6afd65576b9b9 Mon Sep 17 00:00:00 2001 From: Michael Sambol Date: Sat, 25 Nov 2023 04:06:59 -0800 Subject: [PATCH] add feedback from k.goto --- .../aws-globalaccelerator/lib/accelerator.ts | 59 ++++++++++++------- .../test/globalaccelerator.test.ts | 2 +- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/packages/aws-cdk-lib/aws-globalaccelerator/lib/accelerator.ts b/packages/aws-cdk-lib/aws-globalaccelerator/lib/accelerator.ts index a599884dc2233..69197a0a9fce1 100644 --- a/packages/aws-cdk-lib/aws-globalaccelerator/lib/accelerator.ts +++ b/packages/aws-cdk-lib/aws-globalaccelerator/lib/accelerator.ts @@ -23,20 +23,26 @@ export interface IAccelerator extends cdk.IResource { readonly dnsName: string; /** - * IP addresses associated with the accelerator. + * The DNS name that Global Accelerator creates that points to a dual-stack accelerator's four static IP addresses: + * two IPv4 addresses and two IPv6 addresses. * * @attribute */ - readonly ipAddresses?: string[]; + readonly dualStackDnsName: string; /** - * The IP address type that the accelerator supports. + * The array of IPv4 addresses in the IP address set. An IP address set can have a maximum of two IP addresses. * - * For a standard accelerator, the value can be IPV4 or DUAL_STACK. + * @attribute + */ + readonly ipv4Addresses: string[]; + + /** + * The array of IPv6 addresses in the IP address set. An IP address set can have a maximum of two IP addresses. * * @attribute */ - readonly ipAddressType?: IpAddressType; + readonly ipv6Addresses: string[]; } /** @@ -95,16 +101,19 @@ export interface AcceleratorAttributes { readonly dnsName: string; /** - * IP addresses associated with the accelerator. + * The DNS name that points to the dual-stack accelerator's four static IP addresses: two IPv4 addresses and two IPv6 addresses. */ - readonly ipAddresses?: string[]; + readonly dualStackDnsName: string; /** - * The IP address type that an accelerator supports. - * - * For a standard accelerator, the value can be IPV4 or DUAL_STACK. + * The array of IPv4 addresses in the IP address set */ - readonly ipAddressType?: IpAddressType; + readonly ipv4Addresses: string[]; + + /** + * The array of IPv6 addresses in the IP address set + */ + readonly ipv6Addresses: string[]; } /** @@ -133,8 +142,9 @@ export class Accelerator extends cdk.Resource implements IAccelerator { class Import extends cdk.Resource implements IAccelerator { public readonly acceleratorArn = attrs.acceleratorArn; public readonly dnsName = attrs.dnsName; - public readonly ipAddresses = attrs.ipAddresses?? undefined; - public readonly ipAddressType = attrs.ipAddressType ?? undefined; + public readonly dualStackDnsName = attrs.dualStackDnsName; + public readonly ipv4Addresses = attrs.ipv4Addresses; + public readonly ipv6Addresses = attrs.ipv6Addresses; } return new Import(scope, id); } @@ -150,16 +160,20 @@ export class Accelerator extends cdk.Resource implements IAccelerator { public readonly dnsName: string; /** - * IP addresses associated with the accelerator. + * The DNS name that points to the dual-stack accelerator's four static IP addresses: + * two IPv4 addresses and two IPv6 addresses. */ - public readonly ipAddresses?: string[]; + public readonly dualStackDnsName: string; /** - * The IP address type that an accelerator supports. - * - * For a standard accelerator, the value can be IPV4 or DUAL_STACK. - */ - public readonly ipAddressType?: IpAddressType; + * The array of IPv4 addresses in the IP address set + */ + public readonly ipv4Addresses: string[]; + + /** + * The array of IPv6 addresses in the IP address set + */ + public readonly ipv6Addresses: string[]; constructor(scope: Construct, id: string, props: AcceleratorProps = {}) { super(scope, id); @@ -177,8 +191,9 @@ export class Accelerator extends cdk.Resource implements IAccelerator { this.acceleratorArn = resource.attrAcceleratorArn; this.dnsName = resource.attrDnsName; - this.ipAddresses = props.ipAddresses ?? undefined; - this.ipAddressType = props.ipAddressType ?? undefined; + this.dualStackDnsName = resource.attrDualStackDnsName; + this.ipv4Addresses = resource.attrIpv4Addresses; + this.ipv6Addresses = resource.attrIpv6Addresses; } /** diff --git a/packages/aws-cdk-lib/aws-globalaccelerator/test/globalaccelerator.test.ts b/packages/aws-cdk-lib/aws-globalaccelerator/test/globalaccelerator.test.ts index 1866fcd0d6731..34fcb00c38a4e 100644 --- a/packages/aws-cdk-lib/aws-globalaccelerator/test/globalaccelerator.test.ts +++ b/packages/aws-cdk-lib/aws-globalaccelerator/test/globalaccelerator.test.ts @@ -230,7 +230,7 @@ test('create accelerator with IpAddresses and IpAddressType', () => { const { stack } = testFixture(); // WHEN - new ga.Accelerator(stack, 'Accelerator', { + const acc = new ga.Accelerator(stack, 'Accelerator', { ipAddresses: [ '1.1.1.1', '2.2.2.2',