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-11-21T06:34:10.277Z")
@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 ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnTag(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnTag(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.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetCatalogId(String value) Catalog id string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .voidUTF-8 string, not less than 1 or more than 255 bytes long, matching the single-line string pattern .voidsetTagValues(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, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods 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, wait, wait, waitMethods 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:
inspectin 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getCfnProperties
- Overrides:
getCfnPropertiesin 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 .
-