Skip to content

TagManager

TagManager facilitates a common implementation of tagging for Constructs.

Initializers

import { TagManager } from '@alicloud/ros-cdk-core'
new TagManager(tagType: TagType, resourceTypeName: string, tagStructure?: any, options?: TagManagerOptions)
Name Type Description
tagType TagType No description.
resourceTypeName string No description.
tagStructure any No description.
options TagManagerOptions No description.

tagTypeRequired


resourceTypeNameRequired

  • Type: string

tagStructureOptional

  • Type: any

optionsOptional


Methods

Name Description
applyTagAspectHere Determine if the aspect applies here.
hasTags Returns true if there are any tags defined.
removeTag Removes the specified tag from the array if it exists.
renderTags Renders tags into the proper format based on TagType.
setTag Adds the specified tag to the array of tags.
tagValues Render the tags in a readable format.

applyTagAspectHere

public applyTagAspectHere(include?: string[], exclude?: string[]): boolean

Determine if the aspect applies here.

Looks at the include and exclude resourceTypeName arrays to determine if the aspect applies here

includeOptional

  • Type: string[]

excludeOptional

  • Type: string[]

hasTags

public hasTags(): boolean

Returns true if there are any tags defined.

removeTag

public removeTag(key: string, priority: number): void

Removes the specified tag from the array if it exists.

keyRequired

  • Type: string

The tag to remove.


priorityRequired

  • Type: number

The priority of the remove operation.


renderTags

public renderTags(): any

Renders tags into the proper format based on TagType.

setTag

public setTag(key: string, value: string, priority?: number, applyToLaunchedInstances?: boolean): void

Adds the specified tag to the array of tags.

keyRequired

  • Type: string

valueRequired

  • Type: string

priorityOptional

  • Type: number

applyToLaunchedInstancesOptional

  • Type: boolean

tagValues

public tagValues(): {[ key: string ]: string}

Render the tags in a readable format.

Static Functions

Name Description
isTaggable Check whether the given construct is Taggable.

isTaggable

import { TagManager } from '@alicloud/ros-cdk-core'
TagManager.isTaggable(construct: any)

Check whether the given construct is Taggable.

constructRequired

  • Type: any

Properties

Name Type Description
tagPropertyName string The property name for tag values.

tagPropertyNameRequired

public readonly tagPropertyName: string;
  • Type: string

The property name for tag values.

Normally this is tags but some resources choose a different name. Cognito UserPool uses UserPoolTags