本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
連接表單
注意
商業內容和語意搜尋為 預覽版 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-identifierasset-id\ --attachment-name residencyInfo \ --form-type-id DataResidency \ --content '{"region":"us-east-1","complianceFramework":"SOC2","retentionDays":730}'
檢視資產的表單和附件
使用 GetAsset來擷取資產及其表單和附件。
下列命令會擷取資產:
aws glue get-asset --asset-identifierasset-id
將表單連接至資料欄
您可以將表單連接至資產的單一資料欄。
每個資料欄都是可columns重複格式的單一項目,其資料欄名稱為項目識別符。
下列命令會將表單連接至特定資料欄:
aws glue put-attachment \ --asset-identifierasset-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-identifierasset-id\ --iterable-form-name columns \ --max-results 20
使用其表單擷取特定資料欄
使用 BatchGetIterableForms 在單一請求中擷取資料欄和連接的表單。
aws glue batch-get-iterable-forms \ --asset-identifierasset-id\ --iterable-form-name columns \ --item-identifiers region email
刪除附件和表單類型
刪除連接
aws glue delete-attachment \ --asset-identifierasset-id\ --attachment-name residencyInfo
從特定資料欄刪除附件
若要移除連接至單一資料欄的表單,請執行下列命令。傳遞可重複的表單名稱、項目識別符和附件名稱:
aws glue delete-attachment \ --asset-identifierasset-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"} ] }