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.

This example is based on code in the tagging_workflow.py sample file. This file is located in the following vCloud Suite SDK for Python directory: client/samples/src/com/vmware/vcloud/suite/sample/workflow

import com.vmware.cis.tagging_client
 
# 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)