Skip to content

Commit 0e3ab2b

Browse files
committed
minor doc updates
1 parent 41387fb commit 0e3ab2b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

packages/@aws-cdk/cdk/lib/cloudformation/resource.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,36 @@ export class Resource extends Referenceable {
232232
}
233233
}
234234

235+
/**
236+
* Represents a CloudFormation resource which supports Tags
237+
*
238+
* The resource exposes `tags` as the `TagManager` for this resource. The
239+
* developer can set and remove tags from this point in the construct tree using
240+
* the tags object. For example:
241+
*
242+
* ```
243+
* const myResource = new MyTaggableResource(parent, id, props: {});
244+
* myResource.setTag('Mykey, 'MyValue');
245+
* // you can also configure behavior with `TagProps`
246+
* ```
247+
*/
235248
export class TaggableResource extends Resource implements ITaggable {
236249
/**
237250
* TagManager to manage the propagation and assignment of tags
238251
*/
239252
public readonly tags: TagManager;
240253

241-
constructor(parent: Construct, name: string, props: ResourceProps) {
242-
super(parent, name, props);
254+
constructor(parent: Construct, id: string, props: ResourceProps) {
255+
super(parent, id, props);
243256
// const initialTags = !!props.properties ? props.properties.tags || {} : {};
244257
this.tags = new TagManager(this);
245258
}
246259

260+
/**
261+
* Emits CloudFormation for this resource.
262+
*
263+
* This method calls super after resolving the cloudformation tags.
264+
*/
247265
public toCloudFormation(): object {
248266
const rawTags: Tag[] = resolve(this.properties.tags) || [];
249267
const managedTags: Tag[] = resolve(this.tags) || [];

0 commit comments

Comments
 (0)