in src/modules/s3/deploy-utils/patch_document_content.py [0:0]
def main():
args = parse_args()
if args.usage is not None:
print_usage()
region = args.region
endpoint_url = args.endpoint_url
workspace_id = args.workspace_id
entity_id = args.entity_id
document_name = args.document_name
external_url = args.external_url
session = boto3.session.Session()
iottwinmaker = session.client(service_name='iottwinmaker', region_name=region)
update_entity = iottwinmaker.update_entity(
componentUpdates={
"ExternalDocumentLink": {
"updateType": "CREATE",
"componentTypeId": "com.amazon.iottwinmaker.documents",
"propertyUpdates": {
"documents": {
"updateType": "UPDATE",
"value": {
"mapValue": {
document_name : {
"stringValue": external_url
}
}
}
}
}
}
},
entityId = entity_id,
workspaceId = workspace_id)
print(update_entity)
state = update_entity['state']
while state == 'UPDATING':
time.sleep(1)
entity_description = iottwinmaker.get_entity(entityId= entity_id, workspaceId=workspace_id)
state = entity_description['status']['state']
print(f'{state}')