Skip to content

Commit

Permalink
another round of feedback from go-to-k
Browse files Browse the repository at this point in the history
  • Loading branch information
msambol committed Nov 29, 2023
1 parent 0bbb6de commit 7c7fa54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { App, Stack } from 'aws-cdk-lib';
// eslint-disable-next-line import/no-extraneous-dependencies
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
import * as ga from 'aws-cdk-lib/aws-globalaccelerator';

Expand Down
13 changes: 9 additions & 4 deletions packages/aws-cdk-lib/aws-globalaccelerator/lib/accelerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ export interface AcceleratorProps {
/**
* IP addresses associated with the accelerator.
*
* Optionally, if you've added your own IP address pool to Global Accelerator (BYOIP), you can choose IP addresses from your own pool to use for the accelerator's static IP addresses when you create an accelerator. You can specify one or two addresses, separated by a comma. Do not include the /32 suffix.
* Optionally, if you've added your own IP address pool to Global Accelerator (BYOIP), you can choose IP
* addresses from your own pool to use for the accelerator's static IP addresses when you create an accelerator.
* You can specify one or two addresses, separated by a comma. Do not include the /32 suffix.
*
* Only one IP address from each of your IP address ranges can be used for each accelerator. If you specify only one IP address from your IP address range, Global Accelerator assigns a second static IP address for the accelerator from the AWS IP address pool.
* Only one IP address from each of your IP address ranges can be used for each accelerator. If you specify
* only one IP address from your IP address range, Global Accelerator assigns a second static IP address for
* the accelerator from the AWS IP address pool.
*
* Note that you can't update IP addresses for an existing accelerator. To change them, you must create a new accelerator with the new addresses.
* Note that you can't update IP addresses for an existing accelerator. To change them, you must create a
* new accelerator with the new addresses.
*
* @default - undefined. IP addresses will be from Amazon's pool of IP addresses.
*/
Expand Down Expand Up @@ -216,7 +221,7 @@ export class Accelerator extends cdk.Resource implements IAccelerator {

private validateIpAddresses(ipAddresses?: string[]) {
if (ipAddresses !== undefined && (ipAddresses.length < 1 || ipAddresses.length > 2)) {
throw new Error(`Invalid ipAddresses value [${ipAddresses}], you can specify one or two addresses separated by a comma.`);
throw new Error(`Invalid ipAddresses value [${ipAddresses}], you can specify one or two addresses, got: ${ipAddresses.length}`);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ test('should validate ipAddresses minimum and maximum length', () => {
new ga.Accelerator(stack, 'Acc4', {
ipAddresses: [],
});
}).toThrow('Invalid ipAddresses value [], you can specify one or two addresses separated by a comma.');
}).toThrow('Invalid ipAddresses value [], you can specify one or two addresses, got: 0');
expect(() => {
new ga.Accelerator(stack, 'Acc5', {
ipAddresses: ['1.1.1.1', '2.2.2.2', '3.3.3.3'],
});
}).toThrow('Invalid ipAddresses value [1.1.1.1,2.2.2.2,3.3.3.3], you can specify one or two addresses separated by a comma.');
}).toThrow('Invalid ipAddresses value [1.1.1.1,2.2.2.2,3.3.3.3], you can specify one or two addresses, got: 3');
});

0 comments on commit 7c7fa54

Please sign in to comment.