Class CfnTagAssociation
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.CfnTagAssociation
- All Implemented Interfaces:
IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.110.0 (build 336b265)",
date="2025-04-24T21:15:55.378Z")
@Stability(Stable)
public class CfnTagAssociation
extends CfnResource
implements IInspectable
The
AWS::LakeFormation::TagAssociation
resource represents an assignment of an LF-tag to a Data Catalog resource (database, table, or column).
During a stack operation, CloudFormation calls AWS Lake Formation AddLFTagsToResource
API to create a TagAssociation
resource and calls the RemoveLFTagsToResource
API 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 ClassesModifier and TypeClassDescriptionstatic final class
A fluent builder forCfnTagAssociation
.static interface
A structure for the database object.static interface
A structure containing the catalog ID, tag key, and tag values of an LF-tag key-value pair.static interface
A structure for the resource.static interface
A structure for the table object.static interface
A structure for a table with columns object.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
FieldsModifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CfnTagAssociation
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnTagAssociation
(software.amazon.jsii.JsiiObjectRef objRef) CfnTagAssociation
(software.constructs.Construct scope, String id, CfnTagAssociationProps props) -
Method Summary
Modifier and TypeMethodDescriptionJson encoding of the input resource.Json encoding of the input LFTags list.A structure containing an LF-tag key-value pair.UTF-8 string (valid values:DATABASE | TABLE
).void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
A structure containing an LF-tag key-value pair.void
setLfTags
(IResolvable value) A structure containing an LF-tag key-value pair.void
setResource
(IResolvable value) UTF-8 string (valid values:DATABASE | TABLE
).void
UTF-8 string (valid values:DATABASE | TABLE
).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
-
CfnTagAssociation
protected CfnTagAssociation(software.amazon.jsii.JsiiObjectRef objRef) -
CfnTagAssociation
protected CfnTagAssociation(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnTagAssociation
@Stability(Stable) public CfnTagAssociation(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnTagAssociationProps 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.
-
getAttrResourceIdentifier
Json encoding of the input resource.Examples - Database:
{"Catalog":null,"Database":{"CatalogId":"123456789012","Name":"ExampleDbName"},"Table":null,"TableWithColumns":null}
- Table:
{"Catalog":null,"Database":null,"Table":{"CatalogId":"123456789012","DatabaseName":"ExampleDbName","Name":"ExampleTableName","TableWildcard":null},"TableWithColumns":null}
- Columns:
{"Catalog":null,"Database":null,"Table":null,"TableWithColumns":{"CatalogId":"123456789012","DatabaseName":"ExampleDbName","Name":"ExampleTableName","ColumnNames":["ExampleColName1","ExampleColName2"]}}
- Table:
-
getAttrTagsIdentifier
Json encoding of the input LFTags list.For example:
[{"CatalogId":null,"TagKey":"tagKey1","TagValues":null},{"CatalogId":null,"TagKey":"tagKey2","TagValues":null}]
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getLfTags
A structure containing an LF-tag key-value pair. -
setLfTags
A structure containing an LF-tag key-value pair. -
setLfTags
A structure containing an LF-tag key-value pair. -
getResource
UTF-8 string (valid values:DATABASE | TABLE
). -
setResource
UTF-8 string (valid values:DATABASE | TABLE
). -
setResource
UTF-8 string (valid values:DATABASE | TABLE
).
-