View a markdown version of this page

附加表单 - AWS Glue

附加表单

注意

业务上下文和语义搜索目前为预览 AWS Glue 状态,可能会发生更改。

您可以通过定义表单类型来标准化元数据,这些表单类型是可重复使用的结构化架构模板。然后,可以通过将这些表单的实例附加到资产来填充架构。

定义表单类型

表单类型使用 Smithy IDL 语法定义架构。名称必须以大写字母开头。

structure DataResidency { region: String complianceFramework: String retentionDays: Integer }

创建表单类型

使用 PutFormType 创建或更新表单类型。

aws glue put-form-type \ --name DataResidency \ --schema 'structure DataResidency { region: String complianceFramework: String retentionDays: Integer }'

输出示例:

{ "Id": "DataResidency", "Name": "DataResidency" }

检索表单类型

aws glue get-form-type --identifier DataResidency

将表单附加到资产

将表单附加到资产

使用 PutAttachment,并提供资产标识符、附件名称、表单类型 ID 以及符合相应架构的 JSON 数据内容。

aws glue put-attachment \ --asset-identifier asset-id \ --attachment-name residencyInfo \ --form-type-id DataResidency \ --content '{"region":"us-east-1","complianceFramework":"SOC2","retentionDays":730}'

查看资产的表单和附件

使用 GetAsset 来检索资产及其表单和附件。

以下命令用于检索资产:

aws glue get-asset --asset-identifier asset-id

将表单关联到列

您可以将表单关联到资产的单个列。

每个列都是 columns 可迭代结构中的单个项,其项标识符即为列名。

以下命令将表单关联到特定列:

aws glue put-attachment \ --asset-identifier asset-id \ --iterable-form-name columns \ --item-identifier region \ --attachment-name sensitivity \ --form-type-id DataClassification \ --content '{"classification":"PII","sensitivity":"HIGH"}'

关联表单后,使用 SearchAssets 通过表单上的任何可搜索字段查找该资产。

检索列元数据

列出资产的列

aws glue list-iterable-forms \ --asset-identifier asset-id \ --iterable-form-name columns \ --max-results 20

检索特定列及其表单

使用 BatchGetIterableForms 在单个请求中检索列和附加表单。

aws glue batch-get-iterable-forms \ --asset-identifier asset-id \ --iterable-form-name columns \ --item-identifiers region email

删除附件和表单类型

删除挂载

aws glue delete-attachment \ --asset-identifier asset-id \ --attachment-name residencyInfo

从特定列中删除附件

要删除关联到单个列的表单,请运行以下命令。传入可迭代的表单名称、项标识符和附件名称:

aws glue delete-attachment \ --asset-identifier asset-id \ --iterable-form-name columns \ --item-identifier region \ --attachment-name sensitivity

删除表单类型

您无法删除仍由资产类型引用的表单类型。

aws glue delete-form-type --identifier DataResidency

列出表单类型

aws glue list-form-types --max-results 20

输出示例:

{ "Items": [ {"Id": "DataResidency", "Name": "DataResidency"}, {"Id": "DataClassification", "Name": "DataClassification"} ] }