VMware vSphere Automation SDK Perl The VMware vSphere Automation SDK for Perl supports the client-side vSphere Automation API for access to vSphere services and capabilities

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions
Classes | List of all members
Com::Vmware::Cis::Tagging::TagAssociation Class Reference
Inheritance diagram for Com::Vmware::Cis::Tagging::TagAssociation:

## Classes
class | BatchResult
class | ObjectToTags
class | TagToObjects

## Avaliable Methods
public method | list_attached_tags_on_objects ()
public method | list_attached_tags ()
public method | detach ()
public method | list_attached_objects ()
public method | attach_multiple_tags_to_object ()
public method | list_attached_objects_on_tags ()
public method | attach_tag_to_multiple_objects ()
public method | list_attachable_tags ()
public method | new ()
public method | attach ()
public method | detach_multiple_tags_from_object ()
public method | detach_tag_from_multiple_objects ()

## Detailed Description

The `Com::Vmware::Cis::Tagging::TagAssociation` interface provides methods to attach, detach, and query tags.

## Member Function Documentation

public method Com::Vmware::Cis::Tagging::TagAssociation::attach | ( |  | ) |

Attaches the given tag to the input object. The tag needs to meet the cardinality ( :attr:`Com::Vmware::Cis::Tagging::CategoryModel.cardinality` ) and associability ( :attr:`Com::Vmware::Cis::Tagging::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 | [REQUIRED] The identifier of the input tag. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be str.
  object_id | [REQUIRED] The identifier of the input object. . The value must be Com::Vmware::Vapi::Std::DynamicID.

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the tag for the given `tag_id` does not exist in the system.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if the input tag is not eligible to be attached to this object or if the `object_id` is not valid.
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to attach the tag or do not have the privilege to read the object.

Code:
click to view
# Number of lines of code in attach: 11
sub attach {
my ($self, %args) = @_;
my $tag_id = $args {tag_id};
my $object_id = $args {object_id};
$self->validate_args (method_name => 'attach',
method_args => \%args);
return $self->invoke (method_name => 'attach',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::attach_multiple_tags_to_object | ( |  | ) |

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 :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` . To invoke this method , you need the read privilege on the object and the attach tag privilege on each tag.

Parameters

  object_id | [REQUIRED] The identifier of the input object. . The value must be Com::Vmware::Vapi::Std::DynamicID.
  tag_ids | [REQUIRED] The identifiers of the input tags. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be Array of str.

Return values

  The | outcome of the batch method and the list of error messages ( :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` ) describing attachment failures. The return type will be Com::Vmware::Cis::Tagging::TagAssociation::BatchResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to read the object.

Code:
click to view
# Number of lines of code in attach_multiple_tags_to_object: 11
sub attach_multiple_tags_to_object {
my ($self, %args) = @_;
my $object_id = $args {object_id};
my $tag_ids = $args {tag_ids};
$self->validate_args (method_name => 'attach_multiple_tags_to_object',
method_args => \%args);
return $self->invoke (method_name => 'attach_multiple_tags_to_object',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::attach_tag_to_multiple_objects | ( |  | ) |

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 :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` . To invoke this method , you need the attach tag privilege on the tag and the read privilege on each object.

Parameters

  tag_id | [REQUIRED] The identifier of the input tag. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be str.
  object_ids | [REQUIRED] The identifiers of the input objects. . The value must be Array of Com::Vmware::Vapi::Std::DynamicID.

Return values

  The | outcome of the batch method and the list of error messages ( :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` ) describing attachment failures. The return type will be Com::Vmware::Cis::Tagging::TagAssociation::BatchResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the tag for the given `tag_id` does not exist in the system.
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the attach tag privilege on the tag.

Code:
click to view
# Number of lines of code in attach_tag_to_multiple_objects: 11
sub attach_tag_to_multiple_objects {
my ($self, %args) = @_;
my $tag_id = $args {tag_id};
my $object_ids = $args {object_ids};
$self->validate_args (method_name => 'attach_tag_to_multiple_objects',
method_args => \%args);
return $self->invoke (method_name => 'attach_tag_to_multiple_objects',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::detach | ( |  | ) |

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 | [REQUIRED] The identifier of the input tag. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be str.
  object_id | [REQUIRED] The identifier of the input object. . The value must be Com::Vmware::Vapi::Std::DynamicID.

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the tag for the given `tag_id` does not exist in the system.
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to detach the tag or do not have the privilege to read the given object.

Code:
click to view
# Number of lines of code in detach: 11
sub detach {
my ($self, %args) = @_;
my $tag_id = $args {tag_id};
my $object_id = $args {object_id};
$self->validate_args (method_name => 'detach',
method_args => \%args);
return $self->invoke (method_name => 'detach',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::detach_multiple_tags_from_object | ( |  | ) |

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 :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` . To invoke this method , you need the read privilege on the object and the attach tag privilege each tag.

Parameters

  object_id | [REQUIRED] The identifier of the input object. . The value must be Com::Vmware::Vapi::Std::DynamicID.
  tag_ids | [REQUIRED] The identifiers of the input tags. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be Array of str.

Return values

  The | outcome of the batch method and the list of error messages ( :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` ) describing detachment failures. The return type will be Com::Vmware::Cis::Tagging::TagAssociation::BatchResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to read the object.

Code:
click to view
# Number of lines of code in detach_multiple_tags_from_object: 11
sub detach_multiple_tags_from_object {
my ($self, %args) = @_;
my $object_id = $args {object_id};
my $tag_ids = $args {tag_ids};
$self->validate_args (method_name => 'detach_multiple_tags_from_object',
method_args => \%args);
return $self->invoke (method_name => 'detach_multiple_tags_from_object',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::detach_tag_from_multiple_objects | ( |  | ) |

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 :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` . To invoke this method , you need the attach tag privilege on the tag and the read privilege on each object.

Parameters

  tag_id | [REQUIRED] The identifier of the input tag. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be str.
  object_ids | [REQUIRED] The identifiers of the input objects. . The value must be Array of Com::Vmware::Vapi::Std::DynamicID.

Return values

  The | outcome of the batch method and the list of error messages ( :attr:`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult.error_messages` ) describing detachment failures. The return type will be Com::Vmware::Cis::Tagging::TagAssociation::BatchResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the tag for the given tag does not exist in the system.
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the attach tag privilege on the tag.

Code:
click to view
# Number of lines of code in detach_tag_from_multiple_objects: 11
sub detach_tag_from_multiple_objects {
my ($self, %args) = @_;
my $tag_id = $args {tag_id};
my $object_ids = $args {object_ids};
$self->validate_args (method_name => 'detach_tag_from_multiple_objects',
method_args => \%args);
return $self->invoke (method_name => 'detach_tag_from_multiple_objects',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::list_attachable_tags | ( |  | ) |

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 ( :attr:`Com::Vmware::Cis::Tagging::CategoryModel.cardinality` ) and associability ( :attr:`Com::Vmware::Cis::Tagging::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 | [REQUIRED] The identifier of the input object. . The value must be Com::Vmware::Vapi::Std::DynamicID.

Return values

  The | list of tag identifiers that are eligible to be attached to the given object. The value will be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). The return type will be Array of str

Exceptions

  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to read the object.

Code:
click to view
# Number of lines of code in list_attachable_tags: 10
sub list_attachable_tags {
my ($self, %args) = @_;
my $object_id = $args {object_id};
$self->validate_args (method_name => 'list_attachable_tags',
method_args => \%args);
return $self->invoke (method_name => 'list_attachable_tags',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::list_attached_objects | ( |  | ) |

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 | [REQUIRED] The identifier of the input tag. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be str.

Return values

  The | list of attached object identifiers. The return type will be Array of Com::Vmware::Vapi::Std::DynamicID

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the tag for the given `tag_id` does not exist in the system.
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to read the tag.

Code:
click to view
# Number of lines of code in list_attached_objects: 10
sub list_attached_objects {
my ($self, %args) = @_;
my $tag_id = $args {tag_id};
$self->validate_args (method_name => 'list_attached_objects',
method_args => \%args);
return $self->invoke (method_name => 'list_attached_objects',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::list_attached_objects_on_tags | ( |  | ) |

Fetches the list of class Com::Vmware::Cis::Tagging::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 :attr:`Com::Vmware::Cis::Tagging::TagAssociation::TagToObjects.object_ids` will only contain those objects for which you have the read privilege.

Parameters

  tag_ids | [REQUIRED] The identifiers of the input tags. The value must be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). . The value must be Array of str.

Return values

  The | list of the tag identifiers to all object identifiers that each tag is attached to. The return type will be Array of Com::Vmware::Cis::Tagging::TagAssociation::TagToObjects

Code:
click to view
# Number of lines of code in list_attached_objects_on_tags: 10
sub list_attached_objects_on_tags {
my ($self, %args) = @_;
my $tag_ids = $args {tag_ids};
$self->validate_args (method_name => 'list_attached_objects_on_tags',
method_args => \%args);
return $self->invoke (method_name => 'list_attached_objects_on_tags',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::list_attached_tags | ( |  | ) |

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 | [REQUIRED] The identifier of the input object. . The value must be Com::Vmware::Vapi::Std::DynamicID.

Return values

  The | list of all tag identifiers that correspond to the tags attached to the given object. The value will be an identifier for the resource type getQualifiedName(com.vmware.cis.tagging.Tag). The return type will be Array of str

Exceptions

  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have the privilege to read the object.

Code:
click to view
# Number of lines of code in list_attached_tags: 10
sub list_attached_tags {
my ($self, %args) = @_;
my $object_id = $args {object_id};
$self->validate_args (method_name => 'list_attached_tags',
method_args => \%args);
return $self->invoke (method_name => 'list_attached_tags',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::list_attached_tags_on_objects | ( |  | ) |

Fetches the list of class Com::Vmware::Cis::Tagging::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 :attr:`Com::Vmware::Cis::Tagging::TagAssociation::ObjectToTags.tag_ids` will only contain those tags for which you have the read privilege.

Parameters

  object_ids | [REQUIRED] The identifiers of the input objects. . The value must be Array of Com::Vmware::Vapi::Std::DynamicID.

Return values

  The | list of the object identifiers to all tag identifiers that are attached to that object. The return type will be Array of Com::Vmware::Cis::Tagging::TagAssociation::ObjectToTags

Code:
click to view
# Number of lines of code in list_attached_tags_on_objects: 10
sub list_attached_tags_on_objects {
my ($self, %args) = @_;
my $object_ids = $args {object_ids};
$self->validate_args (method_name => 'list_attached_tags_on_objects',
method_args => \%args);
return $self->invoke (method_name => 'list_attached_tags_on_objects',
method_args => \%args);
}

public method Com::Vmware::Cis::Tagging::TagAssociation::new | ( |  | ) |

Constructor to initialize the object

Parameters

  api_provider | - protocol connection to use with stubs created by this factory
  StubConfig | - Stub's additional configuration

Return values

  Blessed | object

Code:
click to view
# Number of lines of code in new: 11
sub new {
my ($class, %args) = @_;
$class = ref($class) || $class;
my $stub_config = $args {stub_config};
my $api_provider = $args {api_provider};
my $self = $class->SUPER::new('stub_config' => $stub_config,
'api_provider' => $api_provider);
bless $self, $class;
return $self;
}

The documentation for this class was generated from the following file:

- Com/Vmware/Cis/Tagging/TagAssociation.pm