Tag¶
-
class
aws_cdk.core.
Tag
(key, value, *, apply_to_launched_instances=None, exclude_resource_types=None, include_resource_types=None, priority=None)¶ Bases:
object
The Tag Aspect will handle adding a tag to this node and cascading tags to children.
- Parameters
key (
str
) –value (
str
) –apply_to_launched_instances (
Optional
[bool
]) – Whether the tag should be applied to instances in an AutoScalingGroup. Default: trueexclude_resource_types (
Optional
[List
[str
]]) – An array of Resource Types that will not receive this tag. An empty array will allow this tag to be applied to all resources. A non-empty array will apply this tag only if the Resource type is not in this array. Default: []include_resource_types (
Optional
[List
[str
]]) – An array of Resource Types that will receive this tag. An empty array will match any Resource. A non-empty array will apply this tag only to Resource types that are included in this array. Default: []priority (
Union
[int
,float
,None
]) – Priority of the tag operation. Higher or equal priority tags will take precedence. Setting priority will enable the user to control tags when they need to not follow the default precedence pattern of last applied and closest to the construct in the tree. Default: Default priorities: - 100 for {@link SetTag} - 200 for {@link RemoveTag} - 50 for tags added directly to CloudFormation resources
Methods
-
visit
(construct)¶ All aspects can visit an IConstruct.
- Parameters
construct (
IConstruct
) –- Return type
None
Attributes
-
key
¶ The string key for the tag.
- Return type
str
-
value
¶ The string value of the tag.
- Return type
str
Static Methods
-
classmethod
add
(scope, key, value, *, apply_to_launched_instances=None, exclude_resource_types=None, include_resource_types=None, priority=None)¶ (deprecated) DEPRECATED: add tags to the node of a construct and all its the taggable children.
- Parameters
scope (
Construct
) –key (
str
) –value (
str
) –apply_to_launched_instances (
Optional
[bool
]) – Whether the tag should be applied to instances in an AutoScalingGroup. Default: trueexclude_resource_types (
Optional
[List
[str
]]) – An array of Resource Types that will not receive this tag. An empty array will allow this tag to be applied to all resources. A non-empty array will apply this tag only if the Resource type is not in this array. Default: []include_resource_types (
Optional
[List
[str
]]) – An array of Resource Types that will receive this tag. An empty array will match any Resource. A non-empty array will apply this tag only to Resource types that are included in this array. Default: []priority (
Union
[int
,float
,None
]) – Priority of the tag operation. Higher or equal priority tags will take precedence. Setting priority will enable the user to control tags when they need to not follow the default precedence pattern of last applied and closest to the construct in the tree. Default: Default priorities: - 100 for {@link SetTag} - 200 for {@link RemoveTag} - 50 for tags added directly to CloudFormation resources
- Deprecated
use
Tags.of(scope).add()
- Stability
deprecated
- Return type
None
-
classmethod
remove
(scope, key, *, apply_to_launched_instances=None, exclude_resource_types=None, include_resource_types=None, priority=None)¶ (deprecated) DEPRECATED: remove tags to the node of a construct and all its the taggable children.
- Parameters
scope (
Construct
) –key (
str
) –apply_to_launched_instances (
Optional
[bool
]) – Whether the tag should be applied to instances in an AutoScalingGroup. Default: trueexclude_resource_types (
Optional
[List
[str
]]) – An array of Resource Types that will not receive this tag. An empty array will allow this tag to be applied to all resources. A non-empty array will apply this tag only if the Resource type is not in this array. Default: []include_resource_types (
Optional
[List
[str
]]) – An array of Resource Types that will receive this tag. An empty array will match any Resource. A non-empty array will apply this tag only to Resource types that are included in this array. Default: []priority (
Union
[int
,float
,None
]) – Priority of the tag operation. Higher or equal priority tags will take precedence. Setting priority will enable the user to control tags when they need to not follow the default precedence pattern of last applied and closest to the construct in the tree. Default: Default priorities: - 100 for {@link SetTag} - 200 for {@link RemoveTag} - 50 for tags added directly to CloudFormation resources
- Deprecated
use
Tags.of(scope).remove()
- Stability
deprecated
- Return type
None