Class CfnTag
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.lakeformation.CfnTag
- All Implemented Interfaces:
IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-12-06T14:43:21.122Z")
@Stability(Stable)
public class CfnTag
extends CfnResource
implements IInspectable
The
AWS::LakeFormation::Tag
resource represents an LF-tag, which consists of a key and one or more possible values for the key.
During a stack operation, AWS CloudFormation calls the AWS Lake Formation CreateLFTag
API to create a tag, and UpdateLFTag
API to update a tag resource, and a DeleteLFTag
to delete it.
Example:
import software.amazon.awscdk.*; import software.amazon.awscdk.services.glue.alpha.S3Table; import software.amazon.awscdk.services.glue.alpha.Database; import software.amazon.awscdk.services.glue.alpha.DataFormat; import software.amazon.awscdk.services.glue.alpha.Schema; import software.amazon.awscdk.services.lakeformation.CfnDataLakeSettings; import software.amazon.awscdk.services.lakeformation.CfnTag; import software.amazon.awscdk.services.lakeformation.CfnTagAssociation; Stack stack; String accountId; String tagKey = "aws"; String[] tagValues = List.of("dev"); Database database = new Database(this, "Database"); S3Table table = S3Table.Builder.create(this, "Table") .database(database) .columns(List.of(Column.builder() .name("col1") .type(Schema.STRING) .build(), Column.builder() .name("col2") .type(Schema.STRING) .build())) .dataFormat(DataFormat.CSV) .build(); DefaultStackSynthesizer synthesizer = (DefaultStackSynthesizer)stack.getSynthesizer(); CfnDataLakeSettings.Builder.create(this, "DataLakeSettings") .admins(List.of(DataLakePrincipalProperty.builder() .dataLakePrincipalIdentifier(stack.formatArn(ArnComponents.builder() .service("iam") .resource("role") .region("") .account(accountId) .resourceName("Admin") .build())) .build(), DataLakePrincipalProperty.builder() // The CDK cloudformation execution role. .dataLakePrincipalIdentifier(synthesizer.cloudFormationExecutionRoleArn.replace("${AWS::Partition}", "aws")) .build())) .build(); CfnTag tag = CfnTag.Builder.create(this, "Tag") .catalogId(accountId) .tagKey(tagKey) .tagValues(tagValues) .build(); LFTagPairProperty lfTagPairProperty = LFTagPairProperty.builder() .catalogId(accountId) .tagKey(tagKey) .tagValues(tagValues) .build(); CfnTagAssociation tagAssociation = CfnTagAssociation.Builder.create(this, "TagAssociation") .lfTags(List.of(lfTagPairProperty)) .resource(ResourceProperty.builder() .tableWithColumns(TableWithColumnsResourceProperty.builder() .databaseName(database.getDatabaseName()) .columnNames(List.of("col1", "col2")) .catalogId(accountId) .name(table.getTableName()) .build()) .build()) .build(); tagAssociation.node.addDependency(tag); tagAssociation.node.addDependency(table);
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnTag
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnTag
(software.amazon.jsii.JsiiObjectRef objRef) CfnTag
(software.constructs.Construct scope, String id, CfnTagProps props) -
Method Summary
Modifier and TypeMethodDescriptionCatalog id string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .UTF-8 string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .An array of UTF-8 strings, not less than 1 or more than 50 strings.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setCatalogId
(String value) Catalog id string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .void
UTF-8 string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .void
setTagValues
(List<String> value) An array of UTF-8 strings, not less than 1 or more than 50 strings.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnTag
protected CfnTag(software.amazon.jsii.JsiiObjectRef objRef) -
CfnTag
protected CfnTag(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnTag
@Stability(Stable) public CfnTag(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnTagProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTagKey
UTF-8 string, not less than 1 or more than 255 bytes long, matching the single-line string pattern . -
setTagKey
UTF-8 string, not less than 1 or more than 255 bytes long, matching the single-line string pattern . -
getTagValues
An array of UTF-8 strings, not less than 1 or more than 50 strings. -
setTagValues
An array of UTF-8 strings, not less than 1 or more than 50 strings. -
getCatalogId
Catalog id string, not less than 1 or more than 255 bytes long, matching the single-line string pattern . -
setCatalogId
Catalog id string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .
-