Skip to content

Commit

Permalink
fixing public access to resource properties
Browse files Browse the repository at this point in the history
  • Loading branch information
moofish32 committed Jan 16, 2019
1 parent 9a8c82b commit 419a701
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/cloudformation/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 7 additions & 4 deletions packages/@aws-cdk/cdk/test/aspects/test.tag-aspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
},
};

0 comments on commit 419a701

Please sign in to comment.