This example shows how to assign a tag to a content library.

This example uses the steps that are described in the Assign the Tag to a Content Library procedure.

from com.vmware.vapi.std.DynamicID
from com.vmware.cis.tagging_client
 
# 1 - Create a dynamic type ID for the content library.
library_dynamic_id = DynamicID(type=Library.RESOURCE_TYPE,
                               id=my_library.id)
 
# 2- Attach the tag to the ClusterComputeResource managed object.
tag_association_stub = tagging_client.TagAssociationStub(my_stub_config)
tag_association_stub.attach(tag_id,
                            library_dynamic_id)