Skip to content

Commit

Permalink
minor doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
moofish32 committed Oct 28, 2018
1 parent 41387fb commit 0e3ab2b
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/@aws-cdk/cdk/lib/cloudformation/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,36 @@ export class Resource extends Referenceable {
}
}

/**
* Represents a CloudFormation resource which supports Tags
*
* The resource exposes `tags` as the `TagManager` for this resource. The
* developer can set and remove tags from this point in the construct tree using
* the tags object. For example:
*
* ```
* const myResource = new MyTaggableResource(parent, id, props: {});
* myResource.setTag('Mykey, 'MyValue');
* // you can also configure behavior with `TagProps`
* ```
*/
export class TaggableResource extends Resource implements ITaggable {
/**
* TagManager to manage the propagation and assignment of tags
*/
public readonly tags: TagManager;

constructor(parent: Construct, name: string, props: ResourceProps) {
super(parent, name, props);
constructor(parent: Construct, id: string, props: ResourceProps) {
super(parent, id, props);
// const initialTags = !!props.properties ? props.properties.tags || {} : {};
this.tags = new TagManager(this);
}

/**
* Emits CloudFormation for this resource.
*
* This method calls super after resolving the cloudformation tags.
*/
public toCloudFormation(): object {
const rawTags: Tag[] = resolve(this.properties.tags) || [];
const managedTags: Tag[] = resolve(this.tags) || [];
Expand Down

0 comments on commit 0e3ab2b

Please sign in to comment.