From b0ff313ad544527fbef75f5f0a2b8204949c51e1 Mon Sep 17 00:00:00 2001 From: Justinon Date: Tue, 25 Oct 2022 14:57:46 -0700 Subject: [PATCH 1/4] feat(infra): Expose abstract Shard class [CLK-187171] --- src/Shard.ts | 29 ++++++++++++++++++++++++----- test/Shard.test.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 test/Shard.test.ts diff --git a/src/Shard.ts b/src/Shard.ts index 07d28c5..7029bc5 100644 --- a/src/Shard.ts +++ b/src/Shard.ts @@ -1,4 +1,4 @@ -export interface IShard { +export interface ShardProps { /** * The cidr for a shard's vpc. * Regions typically receive a 10.?.0.0/12 address space, @@ -10,13 +10,32 @@ export interface IShard { */ readonly region: string; /** - * The proper name for a shard (without numeric suffix). + * The shard-number within the region. */ - readonly name: string; + readonly number: number; +} + +export interface IShard extends ShardProps { /** - * The shard-number within the region. + * The proper name for a shard (without numeric suffix). */ + readonly name: string; +} + +export abstract class Shard implements IShard { + readonly cidr: string; + readonly region: string; readonly number: number; - toString(): string; + constructor(props: ShardProps) { + this.cidr = props.cidr; + this.region = props.region; + this.number = props.number; + } + + /** + * There are numerous different ways to name a shard. Pick one and stick with + * it. + */ + abstract get name(): string; } diff --git a/test/Shard.test.ts b/test/Shard.test.ts new file mode 100644 index 0000000..e4a1c42 --- /dev/null +++ b/test/Shard.test.ts @@ -0,0 +1,30 @@ +import { IShard, Shard, ShardProps } from '../src'; + +const env = 'QA'; +class TestShardImpl extends Shard { + get name(): string { + return `${env}_${this.region}_${this.number}`; + } +} + +const testShardProps: ShardProps = { cidr: '10.0.0.0/0', region: 'us-west-2', number: 1 }; + +let shard: IShard; +describe('Shard', () => { + beforeEach(() => { + shard = new TestShardImpl(testShardProps); + }); + + it('sets CIDR correctly', () => { + expect(shard.cidr).toEqual(testShardProps.cidr); + }); + it('sets region correctly', () => { + expect(shard.region).toEqual(testShardProps.region); + }); + it('sets number correctly', () => { + expect(shard.number).toEqual(testShardProps.number); + }); + it('sets name correctly', () => { + expect(shard.name).toEqual('QA_us-west-2_1'); + }); +}); From e0d30221d323b58a02c0649ef0f3ea165c44ba30 Mon Sep 17 00:00:00 2001 From: Justinon Date: Tue, 25 Oct 2022 15:19:15 -0700 Subject: [PATCH 2/4] fix(infra): Swap struct for interface for JSII compliance [CLK-187171] --- src/Shard.ts | 6 +++--- test/Shard.test.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Shard.ts b/src/Shard.ts index 7029bc5..2928460 100644 --- a/src/Shard.ts +++ b/src/Shard.ts @@ -1,4 +1,4 @@ -export interface ShardProps { +export interface IShardProps { /** * The cidr for a shard's vpc. * Regions typically receive a 10.?.0.0/12 address space, @@ -15,7 +15,7 @@ export interface ShardProps { readonly number: number; } -export interface IShard extends ShardProps { +export interface IShard extends IShardProps { /** * The proper name for a shard (without numeric suffix). */ @@ -27,7 +27,7 @@ export abstract class Shard implements IShard { readonly region: string; readonly number: number; - constructor(props: ShardProps) { + constructor(props: IShardProps) { this.cidr = props.cidr; this.region = props.region; this.number = props.number; diff --git a/test/Shard.test.ts b/test/Shard.test.ts index e4a1c42..3ac0477 100644 --- a/test/Shard.test.ts +++ b/test/Shard.test.ts @@ -1,4 +1,4 @@ -import { IShard, Shard, ShardProps } from '../src'; +import { IShard, Shard, IShardProps } from '../src'; const env = 'QA'; class TestShardImpl extends Shard { @@ -7,7 +7,7 @@ class TestShardImpl extends Shard { } } -const testShardProps: ShardProps = { cidr: '10.0.0.0/0', region: 'us-west-2', number: 1 }; +const testShardProps: IShardProps = { cidr: '10.0.0.0/0', region: 'us-west-2', number: 1 }; let shard: IShard; describe('Shard', () => { From 5ea7f8cc1aaef2f99dc00b69d72955bf064b7a78 Mon Sep 17 00:00:00 2001 From: Justinon Date: Wed, 26 Oct 2022 10:49:49 -0700 Subject: [PATCH 3/4] fix(infra): Remove module declaration, expose interface [CLK-187171] --- src/NamedEnv.ts | 160 +++++++++++++++++++++--------------------- test/NamedEnv.test.ts | 12 ++-- 2 files changed, 85 insertions(+), 87 deletions(-) diff --git a/src/NamedEnv.ts b/src/NamedEnv.ts index 2f1fe5b..3e6c448 100644 --- a/src/NamedEnv.ts +++ b/src/NamedEnv.ts @@ -1,94 +1,92 @@ import { Environment } from 'aws-cdk-lib'; import { IShard } from './Shard'; -export module environments { - export interface RegionalDetails { - readonly asn: number; - /** - * @deprecated you should probably be using the shard's cidr. - */ - readonly cidr: string; // in '0.0.0.0/32' format - } - - interface NamedEnvCommonProps { - /** - * If a region isn't specified, where should we default to. - * Also considered for centralized resources. - */ - readonly defaultRegion: string; - /** - * A map of region => { asn, cidr }, for each region of the environment. - */ - readonly regionDetails: Record; - /** - * The proper name of the environment in kebab-format. - */ - readonly name: string; - /** - * What kind of an account is this? - */ - readonly organizationalUnit: string; - /** - * In which region does SSO live in? - */ - readonly ssoRegion?: string; - /** - * Is this an SSO accessible account? If so, what's the start url? - */ - readonly ssoStartUrl?: string; - /** - * The DNS zone into which services should be deployed. - */ - readonly zoneName: string; - } - - export interface NamedEnv extends Environment, NamedEnvCommonProps { - /** - * The shard within a region. - */ - readonly shard: IShard; - } +export interface RegionalDetails { + readonly asn: number; + /** + * @deprecated you should probably be using the shard's cidr. + */ + readonly cidr: string; // in '0.0.0.0/32' format +} +export interface NamedEnvCommonProps { /** - * Used by newNamedEnvFactory. Is it used elsewhere? + * If a region isn't specified, where should we default to. + * Also considered for centralized resources. */ - export interface NamedEnvironmentProps extends NamedEnvCommonProps { - /** - * The numeric account id as used by cdk.Environment.account - */ - readonly account: string; - } + readonly defaultRegion: string; + /** + * A map of region => { asn, cidr }, for each region of the environment. + */ + readonly regionDetails: Record; + /** + * The proper name of the environment in kebab-format. + */ + readonly name: string; + /** + * What kind of an account is this? + */ + readonly organizationalUnit: string; + /** + * In which region does SSO live in? + */ + readonly ssoRegion?: string; + /** + * Is this an SSO accessible account? If so, what's the start url? + */ + readonly ssoStartUrl?: string; + /** + * The DNS zone into which services should be deployed. + */ + readonly zoneName: string; +} - export interface NamedEnvFactory { - // TODO: should we add shardDetails here? - readonly environmentName: string; - readonly regionDetails: Record; - (shard: IShard): NamedEnv; - } +export interface NamedEnv extends Environment, NamedEnvCommonProps { + /** + * The shard within a region. + */ + readonly shard: IShard; +} +/** + * Used by newNamedEnvFactory. Is it used elsewhere? + */ +export interface NamedEnvironmentProps extends NamedEnvCommonProps { /** - * Generates a function which creates a NamedEnv when given a region - * @param props - * @returns NamedEnv + * The numeric account id as used by cdk.Environment.account */ - export function newNamedEnvFactory(props: NamedEnvironmentProps): NamedEnvFactory { - if ((props.ssoStartUrl || props.ssoRegion) && !(props.ssoStartUrl && props.ssoRegion)) { - console.warn( - `Something is wrong for ${props.name}: ssoStartUrl = ${JSON.stringify(props.ssoStartUrl)} and ssoRegion = ${ - props.ssoRegion - }, but either both or neither of these should be set.`, - ); - } + readonly account: string; +} - const namedEnvFactory = function (shard: IShard): NamedEnv { - return { - ...props, - shard, - region: shard.region, - }; - }; - namedEnvFactory.environmentName = props.name; - namedEnvFactory.regionDetails = props.regionDetails; - return namedEnvFactory; +export interface NamedEnvFactory { + // TODO: should we add shardDetails here? + readonly environmentName: string; + readonly regionDetails: Record; + (shard: IShard): NamedEnv; +} + +/** + * Generates a function which creates a NamedEnv when given a region + * @param props + * @returns NamedEnv + */ +export function newNamedEnvFactory(props: NamedEnvironmentProps): NamedEnvFactory { + if ((props.ssoStartUrl || props.ssoRegion) && !(props.ssoStartUrl && props.ssoRegion)) { + console.warn( + `Something is wrong for ${props.name}: ssoStartUrl = ${JSON.stringify(props.ssoStartUrl)} and ssoRegion = ${ + props.ssoRegion + }, but either both or neither of these should be set.`, + ); } + + const namedEnvFactory = function (shard: IShard): NamedEnv { + return { + ...props, + shard, + region: shard.region, + }; + }; + namedEnvFactory.environmentName = props.name; + namedEnvFactory.regionDetails = props.regionDetails; + return namedEnvFactory; } diff --git a/test/NamedEnv.test.ts b/test/NamedEnv.test.ts index 55b34f0..c3074d3 100644 --- a/test/NamedEnv.test.ts +++ b/test/NamedEnv.test.ts @@ -1,12 +1,12 @@ import 'process'; import { IShard } from '../src'; -import { environments } from '../src/NamedEnv'; +import { newNamedEnvFactory, NamedEnvFactory, NamedEnvironmentProps } from '../src/NamedEnv'; enum TestOrganizationalUnit { Test = 'dev', } -let fakeEnvProps: environments.NamedEnvironmentProps; +let fakeEnvProps: NamedEnvironmentProps; describe('NamedEnv', () => { describe('functionality', () => { @@ -23,7 +23,7 @@ describe('NamedEnv', () => { it('warns when has ssoStartUrl, but not ssoRegion', () => { const fakeWarn = jest.spyOn(global.console, 'warn').mockImplementation(() => {}); - environments.newNamedEnvFactory({ ...fakeEnvProps, ssoStartUrl: 'fakeStartUrl' }); + newNamedEnvFactory({ ...fakeEnvProps, ssoStartUrl: 'fakeStartUrl' }); expect(fakeWarn).toHaveBeenCalledTimes(1); expect(fakeWarn).toHaveBeenCalledWith( 'Something is wrong for sandbox: ssoStartUrl = "fakeStartUrl" and ssoRegion = undefined, but either both or neither of these should be set.', @@ -31,7 +31,7 @@ describe('NamedEnv', () => { }); it('throws when has ssoRegion, but not ssoStartUrl', () => { const fakeWarn = jest.spyOn(global.console, 'warn').mockImplementation(() => {}); - environments.newNamedEnvFactory({ ...fakeEnvProps, ssoRegion: 'fakeSsoRegion' }); + newNamedEnvFactory({ ...fakeEnvProps, ssoRegion: 'fakeSsoRegion' }); expect(fakeWarn).toHaveBeenCalledTimes(1); expect(fakeWarn).toHaveBeenCalledWith( 'Something is wrong for sandbox: ssoStartUrl = undefined and ssoRegion = fakeSsoRegion, but either both or neither of these should be set.', @@ -39,7 +39,7 @@ describe('NamedEnv', () => { }); describe('namedEnvFactory', () => { let shard: IShard; - let factory: environments.NamedEnvFactory; + let factory: NamedEnvFactory; beforeEach(() => { fakeEnvProps = { name: 'sandbox', @@ -56,7 +56,7 @@ describe('NamedEnv', () => { name: 'TestShard', number: 1, }; - factory = environments.newNamedEnvFactory(fakeEnvProps); + factory = newNamedEnvFactory(fakeEnvProps); }); it('takes a shard as input', () => { const testEnv = factory(shard); From 000a5b75513fd90721adeecfe7c5ff2dc942679f Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 26 Oct 2022 17:52:23 +0000 Subject: [PATCH 4/4] chore: self mutation Signed-off-by: github-actions --- API.md | 420 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 334 insertions(+), 86 deletions(-) diff --git a/API.md b/API.md index 5b14174..9596e87 100644 --- a/API.md +++ b/API.md @@ -3,34 +3,34 @@ ## Structs -### NamedEnv +### NamedEnv -#### Initializer +#### Initializer ```typescript -import { environments } from '@time-loop/cdk-named-environments' +import { NamedEnv } from '@time-loop/cdk-named-environments' -const namedEnv: environments.NamedEnv = { ... } +const namedEnv: NamedEnv = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | -| account | string | The AWS account ID for this environment. | -| region | string | The AWS region for this environment. | -| defaultRegion | string | If a region isn't specified, where should we default to. | -| name | string | The proper name of the environment in kebab-format. | -| organizationalUnit | string | What kind of an account is this? | -| regionDetails | {[ key: string ]: @time-loop/cdk-named-environments.environments.RegionalDetails} | A map of region => { asn, cidr }, for each region of the environment. | -| shard | IShard | The shard within a region. | -| zoneName | string | The DNS zone into which services should be deployed. | -| ssoRegion | string | In which region does SSO live in? | -| ssoStartUrl | string | Is this an SSO accessible account? | +| account | string | The AWS account ID for this environment. | +| region | string | The AWS region for this environment. | +| defaultRegion | string | If a region isn't specified, where should we default to. | +| name | string | The proper name of the environment in kebab-format. | +| organizationalUnit | string | What kind of an account is this? | +| regionDetails | {[ key: string ]: RegionalDetails} | A map of region => { asn, cidr }, for each region of the environment. | +| zoneName | string | The DNS zone into which services should be deployed. | +| ssoRegion | string | In which region does SSO live in? | +| ssoStartUrl | string | Is this an SSO accessible account? | +| shard | IShard | The shard within a region. | --- -##### `account`Optional +##### `account`Optional ```typescript public readonly account: string; @@ -50,7 +50,7 @@ will cause this stack to emit synthesis errors. --- -##### `region`Optional +##### `region`Optional ```typescript public readonly region: string; @@ -70,7 +70,7 @@ will cause this stack to emit synthesis errors. --- -##### `defaultRegion`Required +##### `defaultRegion`Required ```typescript public readonly defaultRegion: string; @@ -84,7 +84,7 @@ Also considered for centralized resources. --- -##### `name`Required +##### `name`Required ```typescript public readonly name: string; @@ -96,7 +96,7 @@ The proper name of the environment in kebab-format. --- -##### `organizationalUnit`Required +##### `organizationalUnit`Required ```typescript public readonly organizationalUnit: string; @@ -108,19 +108,57 @@ What kind of an account is this? --- -##### `regionDetails`Required +##### `regionDetails`Required ```typescript public readonly regionDetails: {[ key: string ]: RegionalDetails}; ``` -- *Type:* {[ key: string ]: @time-loop/cdk-named-environments.environments.RegionalDetails} +- *Type:* {[ key: string ]: RegionalDetails} A map of region => { asn, cidr }, for each region of the environment. --- -##### `shard`Required +##### `zoneName`Required + +```typescript +public readonly zoneName: string; +``` + +- *Type:* string + +The DNS zone into which services should be deployed. + +--- + +##### `ssoRegion`Optional + +```typescript +public readonly ssoRegion: string; +``` + +- *Type:* string + +In which region does SSO live in? + +--- + +##### `ssoStartUrl`Optional + +```typescript +public readonly ssoStartUrl: string; +``` + +- *Type:* string + +Is this an SSO accessible account? + +If so, what's the start url? + +--- + +##### `shard`Required ```typescript public readonly shard: IShard; @@ -132,7 +170,81 @@ The shard within a region. --- -##### `zoneName`Required +### NamedEnvCommonProps + +#### Initializer + +```typescript +import { NamedEnvCommonProps } from '@time-loop/cdk-named-environments' + +const namedEnvCommonProps: NamedEnvCommonProps = { ... } +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| defaultRegion | string | If a region isn't specified, where should we default to. | +| name | string | The proper name of the environment in kebab-format. | +| organizationalUnit | string | What kind of an account is this? | +| regionDetails | {[ key: string ]: RegionalDetails} | A map of region => { asn, cidr }, for each region of the environment. | +| zoneName | string | The DNS zone into which services should be deployed. | +| ssoRegion | string | In which region does SSO live in? | +| ssoStartUrl | string | Is this an SSO accessible account? | + +--- + +##### `defaultRegion`Required + +```typescript +public readonly defaultRegion: string; +``` + +- *Type:* string + +If a region isn't specified, where should we default to. + +Also considered for centralized resources. + +--- + +##### `name`Required + +```typescript +public readonly name: string; +``` + +- *Type:* string + +The proper name of the environment in kebab-format. + +--- + +##### `organizationalUnit`Required + +```typescript +public readonly organizationalUnit: string; +``` + +- *Type:* string + +What kind of an account is this? + +--- + +##### `regionDetails`Required + +```typescript +public readonly regionDetails: {[ key: string ]: RegionalDetails}; +``` + +- *Type:* {[ key: string ]: RegionalDetails} + +A map of region => { asn, cidr }, for each region of the environment. + +--- + +##### `zoneName`Required ```typescript public readonly zoneName: string; @@ -144,7 +256,7 @@ The DNS zone into which services should be deployed. --- -##### `ssoRegion`Optional +##### `ssoRegion`Optional ```typescript public readonly ssoRegion: string; @@ -156,7 +268,7 @@ In which region does SSO live in? --- -##### `ssoStartUrl`Optional +##### `ssoStartUrl`Optional ```typescript public readonly ssoStartUrl: string; @@ -170,26 +282,26 @@ If so, what's the start url? --- -### NamedEnvFactory +### NamedEnvFactory -#### Initializer +#### Initializer ```typescript -import { environments } from '@time-loop/cdk-named-environments' +import { NamedEnvFactory } from '@time-loop/cdk-named-environments' -const namedEnvFactory: environments.NamedEnvFactory = { ... } +const namedEnvFactory: NamedEnvFactory = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | -| environmentName | string | *No description.* | -| regionDetails | {[ key: string ]: @time-loop/cdk-named-environments.environments.RegionalDetails} | *No description.* | +| environmentName | string | *No description.* | +| regionDetails | {[ key: string ]: RegionalDetails} | *No description.* | --- -##### `environmentName`Required +##### `environmentName`Required ```typescript public readonly environmentName: string; @@ -199,58 +311,46 @@ public readonly environmentName: string; --- -##### `regionDetails`Required +##### `regionDetails`Required ```typescript public readonly regionDetails: {[ key: string ]: RegionalDetails}; ``` -- *Type:* {[ key: string ]: @time-loop/cdk-named-environments.environments.RegionalDetails} +- *Type:* {[ key: string ]: RegionalDetails} --- -### NamedEnvironmentProps +### NamedEnvironmentProps Used by newNamedEnvFactory. Is it used elsewhere? -#### Initializer +#### Initializer ```typescript -import { environments } from '@time-loop/cdk-named-environments' +import { NamedEnvironmentProps } from '@time-loop/cdk-named-environments' -const namedEnvironmentProps: environments.NamedEnvironmentProps = { ... } +const namedEnvironmentProps: NamedEnvironmentProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | -| account | string | The numeric account id as used by cdk.Environment.account. | -| defaultRegion | string | If a region isn't specified, where should we default to. | -| name | string | The proper name of the environment in kebab-format. | -| organizationalUnit | string | What kind of an account is this? | -| regionDetails | {[ key: string ]: @time-loop/cdk-named-environments.environments.RegionalDetails} | A map of region => { asn, cidr }, for each region of the environment. | -| zoneName | string | The DNS zone into which services should be deployed. | -| ssoRegion | string | In which region does SSO live in? | -| ssoStartUrl | string | Is this an SSO accessible account? | +| defaultRegion | string | If a region isn't specified, where should we default to. | +| name | string | The proper name of the environment in kebab-format. | +| organizationalUnit | string | What kind of an account is this? | +| regionDetails | {[ key: string ]: RegionalDetails} | A map of region => { asn, cidr }, for each region of the environment. | +| zoneName | string | The DNS zone into which services should be deployed. | +| ssoRegion | string | In which region does SSO live in? | +| ssoStartUrl | string | Is this an SSO accessible account? | +| account | string | The numeric account id as used by cdk.Environment.account. | --- -##### `account`Required - -```typescript -public readonly account: string; -``` - -- *Type:* string - -The numeric account id as used by cdk.Environment.account. - ---- - -##### `defaultRegion`Required +##### `defaultRegion`Required ```typescript public readonly defaultRegion: string; @@ -264,7 +364,7 @@ Also considered for centralized resources. --- -##### `name`Required +##### `name`Required ```typescript public readonly name: string; @@ -276,7 +376,7 @@ The proper name of the environment in kebab-format. --- -##### `organizationalUnit`Required +##### `organizationalUnit`Required ```typescript public readonly organizationalUnit: string; @@ -288,19 +388,19 @@ What kind of an account is this? --- -##### `regionDetails`Required +##### `regionDetails`Required ```typescript public readonly regionDetails: {[ key: string ]: RegionalDetails}; ``` -- *Type:* {[ key: string ]: @time-loop/cdk-named-environments.environments.RegionalDetails} +- *Type:* {[ key: string ]: RegionalDetails} A map of region => { asn, cidr }, for each region of the environment. --- -##### `zoneName`Required +##### `zoneName`Required ```typescript public readonly zoneName: string; @@ -312,7 +412,7 @@ The DNS zone into which services should be deployed. --- -##### `ssoRegion`Optional +##### `ssoRegion`Optional ```typescript public readonly ssoRegion: string; @@ -324,7 +424,7 @@ In which region does SSO live in? --- -##### `ssoStartUrl`Optional +##### `ssoStartUrl`Optional ```typescript public readonly ssoStartUrl: string; @@ -338,26 +438,38 @@ If so, what's the start url? --- -### RegionalDetails +##### `account`Required -#### Initializer +```typescript +public readonly account: string; +``` + +- *Type:* string + +The numeric account id as used by cdk.Environment.account. + +--- + +### RegionalDetails + +#### Initializer ```typescript -import { environments } from '@time-loop/cdk-named-environments' +import { RegionalDetails } from '@time-loop/cdk-named-environments' -const regionalDetails: environments.RegionalDetails = { ... } +const regionalDetails: RegionalDetails = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | -| asn | number | *No description.* | -| cidr | string | *No description.* | +| asn | number | *No description.* | +| cidr | string | *No description.* | --- -##### `asn`Required +##### `asn`Required ```typescript public readonly asn: number; @@ -367,7 +479,7 @@ public readonly asn: number; --- -##### ~~`cidr`~~Required +##### ~~`cidr`~~Required - *Deprecated:* you should probably be using the shard's cidr. @@ -379,35 +491,117 @@ public readonly cidr: string; --- +## Classes -## Protocols +### Shard -### IShard +- *Implements:* IShard + +#### Initializers + +```typescript +import { Shard } from '@time-loop/cdk-named-environments' + +new Shard(props: IShardProps) +``` + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| props | IShardProps | *No description.* | + +--- + +##### `props`Required + +- *Type:* IShardProps + +--- + + + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| cidr | string | The cidr for a shard's vpc. | +| name | string | There are numerous different ways to name a shard. | +| number | number | The shard-number within the region. | +| region | string | The AWS region for a shard. | + +--- + +##### `cidr`Required + +```typescript +public readonly cidr: string; +``` + +- *Type:* string + +The cidr for a shard's vpc. -- *Implemented By:* IShard +Regions typically receive a 10.?.0.0/12 address space, +within which there are 16 /16 subnets for shards. + +--- + +##### `name`Required + +```typescript +public readonly name: string; +``` + +- *Type:* string + +There are numerous different ways to name a shard. + +Pick one and stick with +it. + +--- -#### Methods +##### `number`Required -| **Name** | **Description** | -| --- | --- | -| toString | *No description.* | +```typescript +public readonly number: number; +``` + +- *Type:* number + +The shard-number within the region. --- -##### `toString` +##### `region`Required ```typescript -public toString(): string +public readonly region: string; ``` +- *Type:* string + +The AWS region for a shard. + +--- + + +## Protocols + +### IShard + +- *Extends:* IShardProps + +- *Implemented By:* Shard, IShard + + #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | cidr | string | The cidr for a shard's vpc. | -| name | string | The proper name for a shard (without numeric suffix). | | number | number | The shard-number within the region. | | region | string | The AWS region for a shard. | +| name | string | The proper name for a shard (without numeric suffix). | --- @@ -426,6 +620,30 @@ within which there are 16 /16 subnets for shards. --- +##### `number`Required + +```typescript +public readonly number: number; +``` + +- *Type:* number + +The shard-number within the region. + +--- + +##### `region`Required + +```typescript +public readonly region: string; +``` + +- *Type:* string + +The AWS region for a shard. + +--- + ##### `name`Required ```typescript @@ -438,7 +656,37 @@ The proper name for a shard (without numeric suffix). --- -##### `number`Required +### IShardProps + +- *Implemented By:* Shard, IShard, IShardProps + + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| cidr | string | The cidr for a shard's vpc. | +| number | number | The shard-number within the region. | +| region | string | The AWS region for a shard. | + +--- + +##### `cidr`Required + +```typescript +public readonly cidr: string; +``` + +- *Type:* string + +The cidr for a shard's vpc. + +Regions typically receive a 10.?.0.0/12 address space, +within which there are 16 /16 subnets for shards. + +--- + +##### `number`Required ```typescript public readonly number: number; @@ -450,7 +698,7 @@ The shard-number within the region. --- -##### `region`Required +##### `region`Required ```typescript public readonly region: string;