@@ -232,18 +232,36 @@ export class Resource extends Referenceable {
232
232
}
233
233
}
234
234
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
+ */
235
248
export class TaggableResource extends Resource implements ITaggable {
236
249
/**
237
250
* TagManager to manage the propagation and assignment of tags
238
251
*/
239
252
public readonly tags : TagManager ;
240
253
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 ) ;
243
256
// const initialTags = !!props.properties ? props.properties.tags || {} : {};
244
257
this . tags = new TagManager ( this ) ;
245
258
}
246
259
260
+ /**
261
+ * Emits CloudFormation for this resource.
262
+ *
263
+ * This method calls super after resolving the cloudformation tags.
264
+ */
247
265
public toCloudFormation ( ) : object {
248
266
const rawTags : Tag [ ] = resolve ( this . properties . tags ) || [ ] ;
249
267
const managedTags : Tag [ ] = resolve ( this . tags ) || [ ] ;
0 commit comments