From db981bfd68a56ad7851d6eccd2886a5e711bdab3 Mon Sep 17 00:00:00 2001 From: Yenlin Chen <3822365+hencrice@users.noreply.github.com> Date: Fri, 21 Jun 2019 04:46:47 -0700 Subject: [PATCH] refactor(ecs): rename `serviceDiscovery` to `cloudMap` (#2979) Streamline the term "service discovery" to "AWS CloudMap" so that they are consistent. Closes #2978. BREAKING CHANGES: * **ecs**: `serviceDiscovery` has been replaced with `cloudMap` in all methods and types. --- packages/@aws-cdk/aws-ecs/lib/base/base-service.ts | 12 ++++++------ .../aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts | 2 +- .../aws-ecs/test/ec2/integ.sd-bridge-nw.ts | 2 +- .../@aws-cdk/aws-ecs/test/ec2/test.ec2-service.ts | 14 +++++++------- .../aws-ecs/test/fargate/test.fargate-service.ts | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts b/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts index 06606b9678bd0..2c0a084597f34 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts @@ -72,7 +72,7 @@ export interface BaseServiceProps { * * @default - AWS Cloud Map service discovery is not enabled. */ - readonly serviceDiscoveryOptions?: ServiceDiscoveryOptions; + readonly cloudMapOptions?: CloudMapOptions; /** * Whether the new long ARN format has been enabled on ECS services. @@ -178,8 +178,8 @@ export abstract class BaseService extends Resource this.cluster = props.cluster; - if (props.serviceDiscoveryOptions) { - this.enableServiceDiscovery(props.serviceDiscoveryOptions); + if (props.cloudMapOptions) { + this.enableCloudMap(props.cloudMapOptions); } } @@ -333,7 +333,7 @@ export abstract class BaseService extends Resource /** * Enable CloudMap service discovery for the service */ - private enableServiceDiscovery(options: ServiceDiscoveryOptions): cloudmap.Service { + private enableCloudMap(options: CloudMapOptions): cloudmap.Service { const sdNamespace = this.cluster.defaultNamespace; if (sdNamespace === undefined) { throw new Error("Cannot enable service discovery if a Cloudmap Namespace has not been created in the cluster."); @@ -409,9 +409,9 @@ export abstract class BaseService extends Resource const EPHEMERAL_PORT_RANGE = ec2.Port.tcpRange(32768, 65535); /** - * Options for enabling service discovery on an ECS service + * Options for enabling CloudMap on an ECS service */ -export interface ServiceDiscoveryOptions { +export interface CloudMapOptions { /** * Name of the cloudmap service to attach to the ECS Service * diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts index acdc57a6f07af..49628588dd28d 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts +++ b/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts @@ -39,7 +39,7 @@ frontend.addPortMappings({ new ecs.Ec2Service(stack, "FrontendService", { cluster, taskDefinition: frontendTD, - serviceDiscoveryOptions: { + cloudMapOptions: { name: "frontend" } }); diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts index fb5add39517f3..b915e8d3f383b 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts +++ b/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts @@ -37,7 +37,7 @@ frontend.addPortMappings({ new ecs.Ec2Service(stack, "FrontendService", { cluster, taskDefinition: frontendTD, - serviceDiscoveryOptions: { + cloudMapOptions: { name: "frontend" } }); diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-service.ts b/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-service.ts index f266c28e9b88e..a01775e6c06ec 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-service.ts +++ b/packages/@aws-cdk/aws-ecs/test/ec2/test.ec2-service.ts @@ -632,7 +632,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', } }); @@ -663,7 +663,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', } }); @@ -696,7 +696,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', } }); @@ -773,7 +773,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', } }); @@ -849,7 +849,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', dnsRecordType: cloudmap.DnsRecordType.A } @@ -884,7 +884,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', } }); @@ -959,7 +959,7 @@ export = { new ecs.Ec2Service(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', dnsRecordType: cloudmap.DnsRecordType.SRV } diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/test.fargate-service.ts b/packages/@aws-cdk/aws-ecs/test/fargate/test.fargate-service.ts index 398ca470136b5..8c52f4391e351 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/test.fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs/test/fargate/test.fargate-service.ts @@ -344,7 +344,7 @@ export = { new ecs.FargateService(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', } }); @@ -373,7 +373,7 @@ export = { new ecs.FargateService(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp' } }); @@ -433,7 +433,7 @@ export = { new ecs.FargateService(stack, 'Service', { cluster, taskDefinition, - serviceDiscoveryOptions: { + cloudMapOptions: { name: 'myApp', dnsRecordType: cloudmap.DnsRecordType.SRV }