CfnTagAssociationProps

class aws_cdk.aws_lakeformation.CfnTagAssociationProps(*, lf_tags, resource)

Bases: object

Properties for defining a CfnTagAssociation.

Parameters:
See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lakeformation-tagassociation.html

ExampleMetadata:

infused

Example:

import aws_cdk as cdk
from aws_cdk.aws_glue_alpha import S3Table, Database, DataFormat, Schema
from aws_cdk.aws_lakeformation import CfnDataLakeSettings, CfnTag, CfnTagAssociation

# stack: cdk.Stack
# account_id: str


tag_key = "aws"
tag_values = ["dev"]

database = Database(self, "Database")

table = S3Table(self, "Table",
    database=database,
    columns=[Column(
        name="col1",
        type=Schema.STRING
    ), Column(
        name="col2",
        type=Schema.STRING
    )
    ],
    data_format=DataFormat.CSV
)

synthesizer = stack.synthesizer
CfnDataLakeSettings(self, "DataLakeSettings",
    admins=[CfnDataLakeSettings.DataLakePrincipalProperty(
        data_lake_principal_identifier=stack.format_arn(
            service="iam",
            resource="role",
            region="",
            account=account_id,
            resource_name="Admin"
        )
    ), CfnDataLakeSettings.DataLakePrincipalProperty(
        # The CDK cloudformation execution role.
        data_lake_principal_identifier=synthesizer.cloud_formation_execution_role_arn.replace("${AWS::Partition}", "aws")
    )
    ]
)

tag = CfnTag(self, "Tag",
    catalog_id=account_id,
    tag_key=tag_key,
    tag_values=tag_values
)

lf_tag_pair_property = CfnTagAssociation.LFTagPairProperty(
    catalog_id=account_id,
    tag_key=tag_key,
    tag_values=tag_values
)

tag_association = CfnTagAssociation(self, "TagAssociation",
    lf_tags=[lf_tag_pair_property],
    resource=CfnTagAssociation.ResourceProperty(
        table_with_columns=CfnTagAssociation.TableWithColumnsResourceProperty(
            database_name=database.database_name,
            column_names=["col1", "col2"],
            catalog_id=account_id,
            name=table.table_name
        )
    )
)

tag_association.node.add_dependency(tag)
tag_association.node.add_dependency(table)

Attributes

lf_tags

A structure containing an LF-tag key-value pair.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lakeformation-tagassociation.html#cfn-lakeformation-tagassociation-lftags

resource

DATABASE | TABLE ).

The resource for which the LF-tag policy applies.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lakeformation-tagassociation.html#cfn-lakeformation-tagassociation-resource

Type:

UTF-8 string (valid values