Class TagManager
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Normally, you do not need to use this class, as the CloudFormation specification
will indicate which resources are taggable. However, sometimes you will need this
to make custom resources taggable. Used tagManager.renderedTags to obtain a
value that will resolve to the tags at synthesis time.
Example:
public class MyConstruct extends Resource implements ITaggable {
public final Object tags;
public MyConstruct(Construct scope, String id) {
super(scope, id);
CfnResource.Builder.create(this, "Resource")
.type("Whatever::The::Type")
.properties(Map.of(
// ...
"Tags", this.tags.getRenderedTags()))
.build();
}
}
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionTagManager(TagType tagType, String resourceTypeName) TagManager(TagType tagType, String resourceTypeName, Object initialTags) TagManager(TagType tagType, String resourceTypeName, Object initialTags, TagManagerOptions options) protectedTagManager(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedTagManager(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionDetermine if the aspect applies here.applyTagAspectHere(List<String> include) Determine if the aspect applies here.applyTagAspectHere(List<String> include, List<String> exclude) Determine if the aspect applies here.A lazy value that represents the rendered tags at synthesis time.The property name for tag values.hasTags()Returns true if there are any tags defined.static BooleanisTaggable(Object construct) Check whether the given construct is Taggable.static BooleanisTaggableV2(Object construct) Check whether the given construct is ITaggableV2.static TagManagerReturn the TagManager associated with the given construct, if any.voidRemoves the specified tag from the array if it exists.Renders tags into the proper format based on TagType.renderTags(Object combineWithTags) Renders tags into the proper format based on TagType.voidAdds the specified tag to the array of tags.voidAdds the specified tag to the array of tags.voidAdds the specified tag to the array of tags.Render the tags in a readable format.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
TagManager
protected TagManager(software.amazon.jsii.JsiiObjectRef objRef) -
TagManager
protected TagManager(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
TagManager
@Stability(Stable) public TagManager(@NotNull TagType tagType, @NotNull String resourceTypeName, @Nullable Object initialTags, @Nullable TagManagerOptions options) - Parameters:
tagType- This parameter is required.resourceTypeName- This parameter is required.initialTags-options-
-
TagManager
@Stability(Stable) public TagManager(@NotNull TagType tagType, @NotNull String resourceTypeName, @Nullable Object initialTags) - Parameters:
tagType- This parameter is required.resourceTypeName- This parameter is required.initialTags-
-
TagManager
- Parameters:
tagType- This parameter is required.resourceTypeName- This parameter is required.
-
-
Method Details
-
isTaggable
Check whether the given construct is Taggable.- Parameters:
construct- This parameter is required.
-
isTaggableV2
Check whether the given construct is ITaggableV2.- Parameters:
construct- This parameter is required.
-
of
Return the TagManager associated with the given construct, if any.- Parameters:
construct- This parameter is required.
-
applyTagAspectHere
@Stability(Stable) @NotNull public Boolean applyTagAspectHere(@Nullable List<String> include, @Nullable List<String> exclude) Determine if the aspect applies here.Looks at the include and exclude resourceTypeName arrays to determine if the aspect applies here
- Parameters:
include-exclude-
-
applyTagAspectHere
Determine if the aspect applies here.Looks at the include and exclude resourceTypeName arrays to determine if the aspect applies here
- Parameters:
include-
-
applyTagAspectHere
Determine if the aspect applies here.Looks at the include and exclude resourceTypeName arrays to 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.- Parameters:
key- The tag to remove. This parameter is required.priority- The priority of the remove operation. This parameter is required.
-
renderTags
Renders tags into the proper format based on TagType.This method will eagerly render the tags currently applied. In most cases, you should be using
tagManager.renderedTagsinstead, which will return aLazyvalue that will resolve to the correct tags at synthesis time.- Parameters:
combineWithTags-
-
renderTags
Renders tags into the proper format based on TagType.This method will eagerly render the tags currently applied. In most cases, you should be using
tagManager.renderedTagsinstead, which will return aLazyvalue that will resolve to the correct tags at synthesis time. -
setTag
@Stability(Stable) public void setTag(@NotNull String key, @NotNull String value, @Nullable Number priority, @Nullable Boolean applyToLaunchedInstances) Adds the specified tag to the array of tags.- Parameters:
key- This parameter is required.value- This parameter is required.priority-applyToLaunchedInstances-
-
setTag
@Stability(Stable) public void setTag(@NotNull String key, @NotNull String value, @Nullable Number priority) Adds the specified tag to the array of tags.- Parameters:
key- This parameter is required.value- This parameter is required.priority-
-
setTag
Adds the specified tag to the array of tags.- Parameters:
key- This parameter is required.value- This parameter is required.
-
tagValues
Render the tags in a readable format. -
getRenderedTags
A lazy value that represents the rendered tags at synthesis time.If you need to make a custom construct taggable, use the value of this property to pass to the
tagsproperty of the underlying construct. -
getTagPropertyName
The property name for tag values.Normally this is
tagsbut some resources choose a different name. Cognito UserPool uses UserPoolTags
-