This example shows how to assign a tag to ClusterComputeResource.
from pyvmomi import vim from com.vmware.vapi.std_client import DynamicID import com.vmware.cis.tagging_client # 1 - Determine the MOID of the ClusterComputeResource from its name. cluster_object = get_obj(service_content, [vim.ClusterComputeResource], my_cluster_name) cluster_moid = cluster_obj._GetMoId() # 2 - Create a dynamic type ID for the cluster. dynamic_id = DynamicID(type='ClusterComputeResource', id=cluster_moid) # 3 - Attach the tag to the ClusterComputeResource managed object. tag_association_stub = tagging_client.TagAssociation(my_stub_config) tag_association_stub.attach(tag_id=tag_id, object_id=dynamic_id)