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
ofstr
) – Object types to which this category’s tags can be attached.category_id (
str
orNone
) – 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 theCategory.create()
method. You can also retrieve an identifier by using theCategory.list()
method.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
name (
str
orNone
) – The display name of the category. If None the name will not be modified.description (
str
orNone
) – The description of the category. If None the description will not be modified.cardinality (
CategoryModel.Cardinality
orNone
) – The associated cardinality (SINGLE, MULTIPLE) of the category. If None the cardinality will not be modified.associable_types (
set
ofstr
orNone
) –Object types to which this category’s tags can be attached.
The
set
of associable types cannot be updated incrementally. For example, ifCategory.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 thisset
. For example, if you have {A,B,C}, then you cannot remove say {A} from it. Similarly, if you start with an emptyset
, 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 theCategoryModel.used_by
subscribersset
for the specified category. If theused_by_entity
is already in theset
, then this becomes an idempotent no-op. To invoke this method, you need the modifyCategoryModel.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 theCategoryModel.used_by
set
.
- Raise
com.vmware.vapi.std.errors_client.NotFound
if the category for the givencategory_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 theCategoryModel.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 theCategory.CreateSpec.name
provided in thecreate_spec
is the name of an already existing category.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if any of the information in thecreate_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 givencategory_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
- Returns
The
CategoryModel
that corresponds tocategory_id
.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the category for the givencategory_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.
-
list_used_categories
(used_by_entity)¶ Enumerates all categories for which the
used_by_entity
is part of theCategoryModel.used_by
subscribersset
. 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
ofstr
- Returns
The
list
of resource identifiers for the categories in the system that are used byused_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 theCategoryModel.used_by
subscribersset
. If theused_by_entity
is not using this category, then this becomes a no-op. To invoke this method, you need the modifyCategoryModel.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 theCategoryModel.used_by
set
.
- Raise
com.vmware.vapi.std.errors_client.NotFound
if the category for the givencategory_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 theCategoryModel.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 givencategory_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 theCategory.UpdateSpec.name
provided in theupdate_spec
is the name of an already existing category.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if any of the information in theupdate_spec
is invalid.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the category for the givencategory_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
ofstr
) – The types of objects that the tags in this category can be attached to. If theset
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
ofstr
) – Theset
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 thisset
.
-
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 theCardinality
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
orNone
) – 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 theTag.create()
method. You can also retrieve an identifier by using theTag.list()
method.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
name (
str
orNone
) – The display name of the tag. If None the name will not be modified.description (
str
orNone
) – 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 theTagModel.used_by
subscribersset
. If theused_by_entity
is already in theset
, then this becomes a no-op. To invoke this method, you need the modifyTagModel.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 theTagModel.used_by
set
.
- Raise
com.vmware.vapi.std.errors_client.NotFound
if the tag for the giventag_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 theTagModel.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 theTag.CreateSpec.name
provided in thecreate_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 thecreate_spec
is invalid.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the category for in the givencreate_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 giventag_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
- Returns
The
TagModel
that corresponds totag_id
.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the tag for the giventag_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.
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
ofstr
- 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 givencategory_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.
Enumerates all tags for which the
used_by_entity
is part of theTagModel.used_by
subscribersset
. 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
ofstr
- Returns
The
list
of resource identifiers for the tags in the system that are used byused_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 theTagModel.used_by
subscribers set. If theused_by_entity
is not using this tag, then this becomes a no-op. To invoke this method, you need modifyTagModel.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 theTagModel.used_by
set
.
- Raise
com.vmware.vapi.std.errors_client.NotFound
if the tag for the giventag_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 theTagModel.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 giventag_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 theTag.UpdateSpec.name
provided in theupdate_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 theupdate_spec
is invalid.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the tag for the giventag_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
ofcom.vmware.vapi.std_client.LocalizableMessage
) – Thelist
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 theTagAssociation.list_attached_tags_on_objects()
method to retrieve alist
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
ofstr
) – 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 theTagAssociation.list_attached_objects_on_tags()
method to retrieve alist
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
ofcom.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 giventag_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 theobject_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.
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
ofstr
) – The identifiers of the input tags. The parameter must contain identifiers for the resource type:com.vmware.cis.tagging.Tag
.
- Return type
- 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
ofcom.vmware.vapi.std_client.DynamicID
) – The identifiers of the input objects.
- Return type
- 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 giventag_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 giventag_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.
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
ofstr
) – The identifiers of the input tags. The parameter must contain identifiers for the resource type:com.vmware.cis.tagging.Tag
.
- Return type
- 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
ofcom.vmware.vapi.std_client.DynamicID
) – The identifiers of the input objects.
- Return type
- 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.
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. Thelist
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
ofstr
- 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
- Returns
The
list
of attached object identifiers.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the tag for the giventag_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.
Fetches the
list
ofTagAssociation.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. TheTagAssociation.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
ofstr
) – The identifiers of the input tags. The parameter must contain identifiers for the resource type:com.vmware.cis.tagging.Tag
.- Return type
list
ofTagAssociation.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.
Fetches the
list
of tags attached to the given object. To invoke this method, you need the read privilege on the input object. Thelist
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
ofstr
- 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.
Fetches the
list
ofTagAssociation.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. TheTagAssociation.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
ofcom.vmware.vapi.std_client.DynamicID
) – The identifiers of the input objects.- Return type
list
ofTagAssociation.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
ofstr
) – Theset
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 thisset
.
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
orNone
) – 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
orNone
) – 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
orNone
) – 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 (seeInfo.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 ofstatus
is one ofStatus.RUNNING
,Status.BLOCKED
,Status.SUCCEEDED
, orStatus.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 ofstatus
is one ofStatus.SUCCEEDED
orStatus.FAILED
.user (
str
orNone
) – 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 ofStatus.RUNNING
,Status.BLOCKED
,Status.SUCCEEDED
, orStatus.FAILED
.result (
DataValue
orNone
) – Result of the operation. If an operation reports partial results before it completes, this attribute could beset
before theCommonInfo.status
has the valueStatus.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
orNone
) – 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
orNone
) – 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
orNone
) – 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 (seeInfo.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 ofstatus
is one ofStatus.RUNNING
,Status.BLOCKED
,Status.SUCCEEDED
, orStatus.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 ofstatus
is one ofStatus.SUCCEEDED
orStatus.FAILED
.user (
str
orNone
) – 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 theStatus
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