From 52af87074a8bad54707530df078fc559a6fbeb92 Mon Sep 17 00:00:00 2001 From: Hsing-Hui Hsu Date: Mon, 6 May 2019 02:10:24 -0700 Subject: [PATCH] fix(aws-ecs): expose readonly service on LoadBalancedEc2Service (#2395) Fixes #2378. --- packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts | 7 +++++++ .../@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts | 3 +++ 2 files changed, 10 insertions(+) diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts index 0d25fe4fa204f..3bcf1f7ae890c 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-ecs-service.ts @@ -34,6 +34,12 @@ export interface LoadBalancedEc2ServiceProps extends LoadBalancedServiceBaseProp * A single task running on an ECS cluster fronted by a load balancer */ export class LoadBalancedEc2Service extends LoadBalancedServiceBase { + + /** + * The ECS service in this construct + */ + public readonly service: Ec2Service; + constructor(scope: cdk.Construct, id: string, props: LoadBalancedEc2ServiceProps) { super(scope, id, props); @@ -56,6 +62,7 @@ export class LoadBalancedEc2Service extends LoadBalancedServiceBase { taskDefinition }); + this.service = service; this.addServiceAsTarget(service); } } diff --git a/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts b/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts index afdf4151af5e1..713bd335736b5 100644 --- a/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs/lib/load-balanced-fargate-service.ts @@ -76,6 +76,9 @@ export interface LoadBalancedFargateServiceProps extends LoadBalancedServiceBase */ export class LoadBalancedFargateService extends LoadBalancedServiceBase { + /** + * The Fargate service in this construct + */ public readonly service: FargateService; constructor(scope: cdk.Construct, id: string, props: LoadBalancedFargateServiceProps) {