This example is based on code in the tagging_workflow.py sample file.
This example adds timestamp in a tag description to identify when a resource was last reconfigured. The tag description is updated with the timestamp after the resources is reconfigured.
This example is based on the information that is provided in Updating a Tag.
Note: For a complete and up-to-date version of the sample code, see the
vsphere-automation-sdk-python VMware repository at GitHub.
... tag_stub = tagging_client.Tag(my_stub_config # 1 - Format the current time. date_time = time.strftime(‘%d/%m/%Y %H:%M:%S’) description = ‘Server tag updated at ‘ + date_time # 2 - Set up a tag update spec. tag_update_spec = tag_stub.UpdateSpec() tag_update_spec.description = description # 3 - Apply the update spec to change the tag description. tag_stub.update(tag_id, tag_update_spec)