This example is based on code in the tagging_workflow.py sample file.
This example creates a tag specification and then uses it to create the tag. The tag specification references the category identifier that was returned from the category create operation. Use the returned tag identifier for subsequent operations on the tag.
This example is based on the information that is provided in Creating 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.
... # Set up a tag create spec. tag_create_spec = tag_stub.CreateSpec(name=’red’, description=’My favorite color’, category_id=fav_category_id) # Create the tag. tag_stub = tagging_client.Tag(my_stub_config) tag_id = tag_stub.create(create_spec)