- Newest
- Most votes
- Most comments
Why the Error Occurs:
**Asset-Specific Requirements: ** Different assets may have different required forms or fields. The GlueTableForm is mandatory for certain asset types, but not for others, which is why your code works for some assets and fails for others.
Possible Solutions:
Conditional Logic Based on Asset Type:
You can modify your code to include the GlueTableForm for assets that require it. You would need to detect the type of asset before making the API call and adjust the formsInput accordingly.
Content = f'{{"is_pii": true}}'
formsInput = [
{
"content": Content,
"formName": "Sensitive_Data",
"typeIdentifier": "Sensitive_Data"
}
]
# Check the asset type and add GlueTableForm if necessary
asset_type = "specific_type_that_requires_glue_table_form" # Replace with actual logic
if asset_type == "requires_glue_table_form":
GlueTableFormContent = f'{{"glue_table_data": "your_data_here"}}' # Replace with actual GlueTableForm content
formsInput.append({
"content": GlueTableFormContent,
"formName": "GlueTableForm",
"typeIdentifier": "GlueTableForm"
})
response = client.create_asset_revision(
domainIdentifier="dzd_c2gdn1vjw8kc2v",
formsInput=formsInput,
identifier="ankza84706gl2f",
name="macie_usecase_csv"
)
Consult the Documentation or API Reference:
Review the documentation for the create_asset_revision API to understand the required fields for different asset types. This will give you a clearer idea of what forms are mandatory based on the asset.
Dynamic Form Construction:
If the asset type or required forms vary widely, consider constructing the formsInput dynamically based on asset metadata.
Next Steps:
Identify Asset Type: Determine how to identify the asset type in your script so you can conditionally add required forms.
**Add Required Forms: **Implement the conditional logic to add the GlueTableForm only when required.
Relevant content
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago