com.vmware.cis package

Submodules

com.vmware.cis.tagging_client module

The com.vmware.cis.tagging_client component provides methods and classes to attach metadata, by means of tags, to vSphere objects to make these objects more sortable and searchable. You can use it to create, manage, and enumerate tags and their categories (the group a tag belongs to). You can also query the attached tags and attached objects.

class com.vmware.cis.tagging_client.Category(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Category class provides methods to create, read, update, delete, and enumerate categories.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class CreateSpec(name=None, description=None, cardinality=None, associable_types=None, category_id=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Category.CreateSpec class is used to create a category.

Use the Category.create() method to create a category defined by the create specification.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • name (str) – The display name of the category.

  • description (str) – The description of the category.

  • cardinality (CategoryModel.Cardinality) – The associated cardinality (SINGLE, MULTIPLE) of the category.

  • associable_types (set of str) – Object types to which this category’s tags can be attached.

  • category_id (str or None) – This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Category. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Category. If None an identifier will be generated by the server

class UpdateSpec(name=None, description=None, cardinality=None, associable_types=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Category.UpdateSpec class describes the updates to be made to an existing category.

Use the Category.update() method to modify a category. When you call the method, specify the category identifier. You obtain the category identifier when you call the Category.create() method. You can also retrieve an identifier by using the Category.list() method.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • name (str or None) – The display name of the category. If None the name will not be modified.

  • description (str or None) – The description of the category. If None the description will not be modified.

  • cardinality (CategoryModel.Cardinality or None) – The associated cardinality (SINGLE, MULTIPLE) of the category. If None the cardinality will not be modified.

  • associable_types (set of str or None) –

    Object types to which this category’s tags can be attached.

    The set of associable types cannot be updated incrementally. For example, if Category.UpdateSpec.associable_types originally contains {A,B,C} and you want to add D, then you need to pass {A,B,C,D} in your update specification. You also cannot remove any item from this set. For example, if you have {A,B,C}, then you cannot remove say {A} from it. Similarly, if you start with an empty set, then that implies that you can tag any object and hence you cannot later pass say {A}, because that would be restricting the type of objects you want to tag. Thus, associable types can only grow and not shrink. If None the associable types will not be modified.

add_to_used_by(category_id, used_by_entity)

Adds the used_by_entity to the CategoryModel.used_by subscribers set for the specified category. If the used_by_entity is already in the set, then this becomes an idempotent no-op. To invoke this method, you need the modify CategoryModel.used_by privilege on the category.

Parameters
  • category_id (str) – The identifier of the input category. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

  • used_by_entity (str) – The name of the user to be added to the CategoryModel.used_by set.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to add an entity to the CategoryModel.used_by field.

create(create_spec)

Creates a category. To invoke this method, you need the create category privilege.

Parameters

create_spec (Category.CreateSpec) – Specification for the new category to be created.

Return type

str

Returns

The identifier of the created category. The return value will be an identifier for the resource type: com.vmware.cis.tagging.Category.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if the Category.CreateSpec.name provided in the create_spec is the name of an already existing category.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if any of the information in the create_spec is invalid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to create a category.

delete(category_id)

Deletes an existing category. To invoke this method, you need the delete privilege on the category.

Parameters

category_id (str) – The identifier of category to be deleted. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to delete the category.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

get(category_id)

Fetches the category information for the given category identifier. In order to view the category information, you need the read privilege on the category.

Parameters

category_id (str) – The identifier of the input category. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

Return type

CategoryModel

Returns

The CategoryModel that corresponds to category_id.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the category.

list()

Enumerates the categories in the system. To invoke this method, you need the read privilege on the individual categories. The list will only contain those categories for which you have read privileges.

Return type

list of str

Returns

The list of resource identifiers for the categories in the system. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Category.

list_used_categories(used_by_entity)

Enumerates all categories for which the used_by_entity is part of the CategoryModel.used_by subscribers set. To invoke this method, you need the read privilege on the individual categories.

Parameters

used_by_entity (str) – The field on which the results will be filtered.

Return type

list of str

Returns

The list of resource identifiers for the categories in the system that are used by used_by_entity. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Category.

remove_from_used_by(category_id, used_by_entity)

Removes the used_by_entity from the CategoryModel.used_by subscribers set. If the used_by_entity is not using this category, then this becomes a no-op. To invoke this method, you need the modify CategoryModel.used_by privilege on the category.

Parameters
  • category_id (str) – The identifier of the input category. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

  • used_by_entity (str) – The name of the user to be removed from the CategoryModel.used_by set.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to remove an entity from the CategoryModel.used_by field.

revoke_propagating_permissions(category_id)

Revokes all propagating permissions on the given category. You should then attach a direct permission with tagging privileges on the given category. To invoke this method, you need category related privileges (direct or propagating) on the concerned category.

Parameters

category_id (str) – The identifier of the input category. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to revoke propagating permissions on the category.

update(category_id, update_spec)

Updates an existing category. To invoke this method, you need the edit privilege on the category.

Parameters
  • category_id (str) – The identifier of the category to be updated. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

  • update_spec (Category.UpdateSpec) – Specification to update the category.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if the Category.UpdateSpec.name provided in the update_spec is the name of an already existing category.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if any of the information in the update_spec is invalid.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to update the category.

class com.vmware.cis.tagging_client.CategoryModel(id=None, name=None, description=None, cardinality=None, associable_types=None, used_by=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The CategoryModel class defines a category that is used to group one or more tags.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • id (str) – The unique identifier of the category. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Category. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Category.

  • name (str) – The display name of the category.

  • description (str) – The description of the category.

  • cardinality (CategoryModel.Cardinality) – The associated cardinality (SINGLE, MULTIPLE) of the category.

  • associable_types (set of str) – The types of objects that the tags in this category can be attached to. If the set is empty, then tags can be attached to all types of objects. This field works only for objects that reside in Inventory Service (IS). For non IS objects, this check is not performed today and hence a tag can be attached to any non IS object.

  • used_by (set of str) – The set of users that can use this category. To add users to this, you need to have the edit privilege on the category. Similarly, to unsubscribe from this category, you need the edit privilege on the category. You should not modify other users subscription from this set.

class Cardinality(string)

Bases: vmware.vapi.bindings.enum.Enum

The CategoryModel.Cardinality class defines the number of tags in a category that can be assigned to an object.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the Cardinality instance.

MULTIPLE = Cardinality(string='MULTIPLE')

An object can be assigned several of the tags in this category. For example, if a category is “Server”, then different tags of this category would be “AppServer”, “DatabaseServer” and so on. In this case a VM object can be assigned more than one of the above tags and hence the cardinality of the associated category here is multiple.

SINGLE = Cardinality(string='SINGLE')

An object can only be assigned one of the tags in this category. For example, if a category is “Operating System”, then different tags of this category would be “Windows”, “Linux”, and so on. In this case a VM object can be assigned only one of these tags and hence the cardinality of the associated category here is single.

class com.vmware.cis.tagging_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance

class com.vmware.cis.tagging_client.Tag(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The Tag class provides methods to create, read, update, delete, and enumerate tags.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class CreateSpec(name=None, description=None, category_id=None, tag_id=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Tag.CreateSpec class describes a tag.

Use the Tag.create() method to create a tag defined by the create specification.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • name (str) – The display name of the tag. The name must be unique within its category.

  • description (str) – The description of the tag.

  • category_id (str) – The unique identifier of the parent category in which this tag will be created. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Category. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Category.

  • tag_id (str or None) – This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Tag. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Tag. If None an identifier will be generated by the server

class UpdateSpec(name=None, description=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Tag.UpdateSpec class describes the updates to be made to an existing tag.

Use the Tag.update() method to modify a tag. When you call the method, you specify the tag identifier. You obtain the tag identifier when you call the Tag.create() method. You can also retrieve an identifier by using the Tag.list() method.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • name (str or None) – The display name of the tag. If None the name will not be modified.

  • description (str or None) – The description of the tag. If None the description will not be modified.

add_to_used_by(tag_id, used_by_entity)

Adds the used_by_entity to the TagModel.used_by subscribers set. If the used_by_entity is already in the set, then this becomes a no-op. To invoke this method, you need the modify TagModel.used_by privilege on the tag.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • used_by_entity (str) – The name of the user to be added to the TagModel.used_by set.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to add an entity to the TagModel.used_by field.

create(create_spec)

Creates a tag. To invoke this method, you need the create tag privilege on the input category.

Parameters

create_spec (Tag.CreateSpec) – Specification for the new tag to be created.

Return type

str

Returns

The identifier of the created tag. The return value will be an identifier for the resource type: com.vmware.cis.tagging.Tag.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if the Tag.CreateSpec.name provided in the create_spec is the name of an already existing tag in the input category.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if any of the input information in the create_spec is invalid.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for in the given create_spec does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to create tag.

delete(tag_id)

Deletes an existing tag. To invoke this method, you need the delete privilege on the tag.

Parameters

tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to delete the tag.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

get(tag_id)

Fetches the tag information for the given tag identifier. To invoke this method, you need the read privilege on the tag in order to view the tag info.

Parameters

tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

Return type

TagModel

Returns

The TagModel that corresponds to tag_id.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if the user does not have the privilege to read the tag.

list()

Enumerates the tags in the system. To invoke this method, you need read privilege on the individual tags. The list will only contain tags for which you have read privileges.

Return type

list of str

Returns

The list of resource identifiers for the tags in the system. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

list_tags_for_category(category_id)

Enumerates all tags for the given category. To invoke this method, you need the read privilege on the given category and the individual tags in that category.

Parameters

category_id (str) – The identifier of the input category. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Category.

Return type

list of str

Returns

The list of resource identifiers for the tags in the given input category. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

Raise

com.vmware.vapi.std.errors_client.NotFound if the category for the given category_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the category.

list_used_tags(used_by_entity)

Enumerates all tags for which the used_by_entity is part of the TagModel.used_by subscribers set. To invoke this method, you need the read privilege on the individual tags.

Parameters

used_by_entity (str) – The field on which the results will be filtered.

Return type

list of str

Returns

The list of resource identifiers for the tags in the system that are used by used_by_entity. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

remove_from_used_by(tag_id, used_by_entity)

Removes the used_by_entity from the TagModel.used_by subscribers set. If the used_by_entity is not using this tag, then this becomes a no-op. To invoke this method, you need modify TagModel.used_by privilege on the tag.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • used_by_entity (str) – The name of the user to be removed from the TagModel.used_by set.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to remove an entity from the TagModel.used_by field.

revoke_propagating_permissions(tag_id)

Revokes all propagating permissions on the given tag. You should then attach a direct permission with tagging privileges on the given tag. To invoke this method, you need tag related privileges (direct or propagating) on the concerned tag.

Parameters

tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to revoke propagating permissions on the tag.

update(tag_id, update_spec)

Updates an existing tag. To invoke this method, you need the edit privilege on the tag.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • update_spec (Tag.UpdateSpec) – Specification to update the tag.

Raise

com.vmware.vapi.std.errors_client.AlreadyExists if the Tag.UpdateSpec.name provided in the update_spec is the name of an already existing tag in the same category.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if any of the input information in the update_spec is invalid.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to update the tag.

class com.vmware.cis.tagging_client.TagAssociation(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The TagAssociation class provides methods to attach, detach, and query tags.

Parameters

config (vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.

class BatchResult(success=None, error_messages=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The TagAssociation.BatchResult class describes the result of performing the same method on several tags or objects in a single invocation. This class was added in vSphere API 6.5.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • success (bool) – This is true if the batch method completed without any errors. Otherwise it is false and all or some methods have failed. This attribute was added in vSphere API 6.5.

  • error_messages (list of com.vmware.vapi.std_client.LocalizableMessage) – The list of error messages. This attribute was added in vSphere API 6.5.

class ObjectToTags(object_id=None, tag_ids=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The TagAssociation.ObjectToTags class describes an object and its related tags. Use the TagAssociation.list_attached_tags_on_objects() method to retrieve a list with each element containing an object and the tags attached to it. This class was added in vSphere API 6.5.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the object. This attribute was added in vSphere API 6.5.

  • tag_ids (list of str) – The identifiers of the related tags. This attribute was added in vSphere API 6.5. When clients pass a value of this class as a parameter, the attribute must contain identifiers for the resource type: com.vmware.cis.tagging.Tag. When methods return a value of this class as a return value, the attribute will contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

class TagToObjects(tag_id=None, object_ids=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The TagAssociation.TagToObjects class describes a tag and its related objects. Use the TagAssociation.list_attached_objects_on_tags() method to retrieve a list with each element containing a tag and the objects to which it is attached. This class was added in vSphere API 6.5.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • tag_id (str) – The identifier of the tag. This attribute was added in vSphere API 6.5. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Tag. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • object_ids (list of com.vmware.vapi.std_client.DynamicID) – The identifiers of the related objects. This attribute was added in vSphere API 6.5.

attach(tag_id, object_id)

Attaches the given tag to the input object. The tag needs to meet the cardinality (CategoryModel.cardinality) and associability (CategoryModel.associable_types) criteria in order to be eligible for attachment. If the tag is already attached to the object, then this method is a no-op and an error will not be thrown. To invoke this method, you need the attach tag privilege on the tag and the read privilege on the object.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the input object.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.InvalidArgument if the input tag is not eligible to be attached to this object or if the object_id is not valid.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to attach the tag or do not have the privilege to read the object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

attach_multiple_tags_to_object(object_id, tag_ids)

Attaches the given tags to the input object. If a tag is already attached to the object, then the individual method is a no-op and an error will not be added to TagAssociation.BatchResult.error_messages. To invoke this method, you need the read privilege on the object and the attach tag privilege on each tag. This method was added in vSphere API 6.5.

Parameters
  • object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the input object.

  • tag_ids (list of str) – The identifiers of the input tags. The parameter must contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

Return type

TagAssociation.BatchResult

Returns

The outcome of the batch method and the list of error messages (TagAssociation.BatchResult.error_messages) describing attachment failures.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

attach_tag_to_multiple_objects(tag_id, object_ids)

Attaches the given tag to the input objects. If a tag is already attached to the object, then the individual method is a no-op and an error will not be added to TagAssociation.BatchResult.error_messages. To invoke this method, you need the attach tag privilege on the tag and the read privilege on each object. This method was added in vSphere API 6.5.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • object_ids (list of com.vmware.vapi.std_client.DynamicID) – The identifiers of the input objects.

Return type

TagAssociation.BatchResult

Returns

The outcome of the batch method and the list of error messages (TagAssociation.BatchResult.error_messages) describing attachment failures.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the attach tag privilege on the tag.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

detach(tag_id, object_id)

Detaches the tag from the given object. If the tag is already removed from the object, then this method is a no-op and an error will not be thrown. To invoke this method, you need the attach tag privilege on the tag and the read privilege on the object.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the input object.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to detach the tag or do not have the privilege to read the given object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

detach_multiple_tags_from_object(object_id, tag_ids)

Detaches the given tags from the input object. If a tag is already removed from the object, then the individual method is a no-op and an error will not be added to TagAssociation.BatchResult.error_messages. To invoke this method, you need the read privilege on the object and the attach tag privilege each tag. This method was added in vSphere API 6.5.

Parameters
  • object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the input object.

  • tag_ids (list of str) – The identifiers of the input tags. The parameter must contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

Return type

TagAssociation.BatchResult

Returns

The outcome of the batch method and the list of error messages (TagAssociation.BatchResult.error_messages) describing detachment failures.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

detach_tag_from_multiple_objects(tag_id, object_ids)

Detaches the given tag from the input objects. If a tag is already removed from the object, then the individual method is a no-op and an error will not be added to TagAssociation.BatchResult.error_messages. To invoke this method, you need the attach tag privilege on the tag and the read privilege on each object. This method was added in vSphere API 6.5.

Parameters
  • tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • object_ids (list of com.vmware.vapi.std_client.DynamicID) – The identifiers of the input objects.

Return type

TagAssociation.BatchResult

Returns

The outcome of the batch method and the list of error messages (TagAssociation.BatchResult.error_messages) describing detachment failures.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the attach tag privilege on the tag.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

list_attachable_tags(object_id)

Fetches the list of attachable tags for the given object, omitting the tags that have already been attached. Criteria for attachability is calculated based on tagging cardinality (CategoryModel.cardinality) and associability (CategoryModel.associable_types) constructs. To invoke this method, you need the read privilege on the input object. The list will only contain those tags for which you have read privileges.

Parameters

object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the input object.

Return type

list of str

Returns

The list of tag identifiers that are eligible to be attached to the given object. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

list_attached_objects(tag_id)

Fetches the list of attached objects for the given tag. To invoke this method, you need the read privilege on the input tag. Only those objects for which you have the read privilege will be returned.

Parameters

tag_id (str) – The identifier of the input tag. The parameter must be an identifier for the resource type: com.vmware.cis.tagging.Tag.

Return type

list of com.vmware.vapi.std_client.DynamicID

Returns

The list of attached object identifiers.

Raise

com.vmware.vapi.std.errors_client.NotFound if the tag for the given tag_id does not exist in the system.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the tag.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

list_attached_objects_on_tags(tag_ids)

Fetches the list of TagAssociation.TagToObjects describing the input tag identifiers and the objects they are attached to. To invoke this method, you need the read privilege on each input tag. The TagAssociation.TagToObjects.object_ids will only contain those objects for which you have the read privilege. This method was added in vSphere API 6.5.

Parameters

tag_ids (list of str) – The identifiers of the input tags. The parameter must contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

Return type

list of TagAssociation.TagToObjects

Returns

The list of the tag identifiers to all object identifiers that each tag is attached to.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

list_attached_tags(object_id)

Fetches the list of tags attached to the given object. To invoke this method, you need the read privilege on the input object. The list will only contain those tags for which you have the read privileges.

Parameters

object_id (com.vmware.vapi.std_client.DynamicID) – The identifier of the input object.

Return type

list of str

Returns

The list of all tag identifiers that correspond to the tags attached to the given object. The return value will contain identifiers for the resource type: com.vmware.cis.tagging.Tag.

Raise

com.vmware.vapi.std.errors_client.Unauthorized if you do not have the privilege to read the object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

list_attached_tags_on_objects(object_ids)

Fetches the list of TagAssociation.ObjectToTags describing the input object identifiers and the tags attached to each object. To invoke this method, you need the read privilege on each input object. The TagAssociation.ObjectToTags.tag_ids will only contain those tags for which you have the read privilege. This method was added in vSphere API 6.5.

Parameters

object_ids (list of com.vmware.vapi.std_client.DynamicID) – The identifiers of the input objects.

Return type

list of TagAssociation.ObjectToTags

Returns

The list of the object identifiers to all tag identifiers that are attached to that object.

Raise

com.vmware.vapi.std.errors_client.Unauthenticated if the user can not be authenticated.

class com.vmware.cis.tagging_client.TagModel(id=None, category_id=None, name=None, description=None, used_by=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The TagModel class defines a tag that can be attached to vSphere objects.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • id (str) – The unique identifier of the tag. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Tag. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Tag.

  • category_id (str) – The identifier of the parent category in which this tag will be created. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.tagging.Category. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.tagging.Category.

  • name (str) – The display name of the tag.

  • description (str) – The description of the tag.

  • used_by (set of str) – The set of users that can use this tag. To add users to this, you need to have the edit privilege on the tag. Similarly, to unsubscribe from this tag, you need the edit privilege on the tag. You should not modify other users subscription from this set.

com.vmware.cis.task_client module

The com.vmware.cis.task_client module provides classes and classes used for managing tasks.

class com.vmware.cis.task_client.CommonInfo(description=None, service=None, operation=None, parent=None, target=None, status=None, cancelable=None, error=None, start_time=None, end_time=None, user=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The CommonInfo class contains information common to all tasks. This class was added in vSphere API 6.7.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • description (com.vmware.vapi.std_client.LocalizableMessage) – Description of the operation associated with the task. This attribute was added in vSphere API 6.7.

  • service (str) – Identifier of the service containing the operation. This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.vapi.service. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.vapi.service.

  • operation (str) – Identifier of the operation associated with the task. This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.vapi.operation. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.vapi.operation.

  • parent (str or None) – Parent of the current task. This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.task. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.task. This attribute will be None if the task has no parent.

  • target (com.vmware.vapi.std_client.DynamicID or None) – Identifier of the target created by the operation or an existing one the operation performed on. This attribute was added in vSphere API 6.7. This attribute will be None if the operation has no target or multiple targets.

  • status (Status) – Status of the operation associated with the task. This attribute was added in vSphere API 6.7.

  • cancelable (bool) – Flag to indicate whether or not the operation can be cancelled. The value may change as the operation progresses. This attribute was added in vSphere API 6.7.

  • error (Exception or None) – Description of the error if the operation status is “FAILED”. This attribute was added in vSphere API 6.7. If None the description of why the operation failed will be included in the result of the operation (see Info.result).

  • start_time (datetime.datetime) – Time when the operation is started. This attribute was added in vSphere API 6.7. This attribute is optional and it is only relevant when the value of status is one of Status.RUNNING, Status.BLOCKED, Status.SUCCEEDED, or Status.FAILED.

  • end_time (datetime.datetime) – Time when the operation is completed. This attribute was added in vSphere API 6.7. This attribute is optional and it is only relevant when the value of status is one of Status.SUCCEEDED or Status.FAILED.

  • user (str or None) – Name of the user who performed the operation. This attribute was added in vSphere API 6.7. This attribute will be None if the operation is performed by the system.

class com.vmware.cis.task_client.Info(progress=None, result=None, description=None, service=None, operation=None, parent=None, target=None, status=None, cancelable=None, error=None, start_time=None, end_time=None, user=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Info class contains information about a task. This class was added in vSphere API 6.7.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • progress (Progress) – Progress of the operation. This attribute was added in vSphere API 6.7. This attribute is optional and it is only relevant when the value of status is one of Status.RUNNING, Status.BLOCKED, Status.SUCCEEDED, or Status.FAILED.

  • result (DataValue or None) – Result of the operation. If an operation reports partial results before it completes, this attribute could be set before the CommonInfo.status has the value Status.SUCCEEDED. The value could change as the operation progresses. This attribute was added in vSphere API 6.7. This attribute will be None if the operation does not return a result or if the result is not available at the current step of the operation.

  • description (com.vmware.vapi.std_client.LocalizableMessage) – Description of the operation associated with the task. This attribute was added in vSphere API 6.7.

  • service (str) – Identifier of the service containing the operation. This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.vapi.service. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.vapi.service.

  • operation (str) – Identifier of the operation associated with the task. This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.vapi.operation. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.vapi.operation.

  • parent (str or None) – Parent of the current task. This attribute was added in vSphere API 6.7. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type: com.vmware.cis.task. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type: com.vmware.cis.task. This attribute will be None if the task has no parent.

  • target (com.vmware.vapi.std_client.DynamicID or None) – Identifier of the target created by the operation or an existing one the operation performed on. This attribute was added in vSphere API 6.7. This attribute will be None if the operation has no target or multiple targets.

  • status (Status) – Status of the operation associated with the task. This attribute was added in vSphere API 6.7.

  • cancelable (bool) – Flag to indicate whether or not the operation can be cancelled. The value may change as the operation progresses. This attribute was added in vSphere API 6.7.

  • error (Exception or None) – Description of the error if the operation status is “FAILED”. This attribute was added in vSphere API 6.7. If None the description of why the operation failed will be included in the result of the operation (see Info.result).

  • start_time (datetime.datetime) – Time when the operation is started. This attribute was added in vSphere API 6.7. This attribute is optional and it is only relevant when the value of status is one of Status.RUNNING, Status.BLOCKED, Status.SUCCEEDED, or Status.FAILED.

  • end_time (datetime.datetime) – Time when the operation is completed. This attribute was added in vSphere API 6.7. This attribute is optional and it is only relevant when the value of status is one of Status.SUCCEEDED or Status.FAILED.

  • user (str or None) – Name of the user who performed the operation. This attribute was added in vSphere API 6.7. This attribute will be None if the operation is performed by the system.

class com.vmware.cis.task_client.Progress(total=None, completed=None, message=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Progress class contains information describe the progress of an operation. This class was added in vSphere API 6.7.

Tip

The arguments are used to initialize data attributes with the same names.

Parameters
  • total (long) – Total amount of the work for the operation. This attribute was added in vSphere API 6.7.

  • completed (long) – The amount of work completed for the operation. The value can only be incremented. This attribute was added in vSphere API 6.7.

  • message (com.vmware.vapi.std_client.LocalizableMessage) – Message about the work progress. This attribute was added in vSphere API 6.7.

class com.vmware.cis.task_client.Status(string)

Bases: vmware.vapi.bindings.enum.Enum

The Status class defines the status values that can be reported for an operation. This enumeration was added in vSphere API 6.7.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

Parameters

string (str) – String value for the Status instance.

BLOCKED = Status(string='BLOCKED')

The operation is blocked. This class attribute was added in vSphere API 6.7.

FAILED = Status(string='FAILED')

The operation failed. This class attribute was added in vSphere API 6.7.

PENDING = Status(string='PENDING')

The operation is in pending state. This class attribute was added in vSphere API 6.7.

RUNNING = Status(string='RUNNING')

The operation is in progress. This class attribute was added in vSphere API 6.7.

SUCCEEDED = Status(string='SUCCEEDED')

The operation completed successfully. This class attribute was added in vSphere API 6.7.

class com.vmware.cis.task_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

Initialize StubFactoryBase

Parameters

stub_config (vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance