From 419a701d501ff39a2997216fc53e1305c33e37e8 Mon Sep 17 00:00:00 2001 From: Mike Cowgill Date: Sun, 13 Jan 2019 21:39:47 -0800 Subject: [PATCH] fixing public access to resource properties --- packages/@aws-cdk/cdk/lib/cloudformation/resource.ts | 2 +- packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts b/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts index 390b1dcd5175e..06dafb9b944fd 100644 --- a/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts +++ b/packages/@aws-cdk/cdk/lib/cloudformation/resource.ts @@ -67,7 +67,7 @@ export class Resource extends Referenceable { * * This object is rendered via a call to "renderProperties(this.properties)". */ - public readonly properties: any; + protected readonly properties: any; /** * AWS resource property overrides. diff --git a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts b/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts index e4b2909c6faf4..f8dda2abaff67 100644 --- a/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts +++ b/packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts @@ -3,13 +3,16 @@ import { RemoveTag, Resource, Stack, Tag, TagManager, TagType } from '../../lib' class TaggableResource extends Resource { public readonly tags = new TagManager(TagType.Standard); + public testProperties() { + return this.properties; + } } -class AsgTaggableResource extends Resource { +class AsgTaggableResource extends TaggableResource { public readonly tags = new TagManager(TagType.AutoScalingGroup); } -class MapTaggableResource extends Resource { +class MapTaggableResource extends TaggableResource { public readonly tags = new TagManager(TagType.Map); } @@ -127,7 +130,7 @@ export = { test.deepEqual(map.tags.renderTags(), undefined); test.deepEqual(res2.tags.renderTags(), undefined); test.deepEqual(asg.tags.renderTags(), [{key: 'foo', value: 'bar', propagateAtLaunch: true}]); - test.deepEqual(map.properties.tags, undefined); + test.deepEqual(map.testProperties().tags, undefined); test.done(); }, 'exclude prevents tag application to resource types in the list'(test: Test) { @@ -174,7 +177,7 @@ export = { aspectBranch.apply(new Tag('aspects', 'rule')); root.testInvokeAspects(); test.deepEqual(aspectBranch.tags.renderTags(), [{key: 'aspects', value: 'rule'}]); - test.deepEqual(cfnBranch.properties.tags, [{key: 'cfn', value: 'is cool'}]); + test.deepEqual(cfnBranch.testProperties().tags, [{key: 'cfn', value: 'is cool'}]); test.done(); }, };