Class List Method List File List

# Class: Com::Vmware::Cis::Tagging::TagAssociation

Inherits:
  VAPI::Bindings::VapiService
  - Object
  - VAPI::Bindings::VapiService
  - Com::Vmware::Cis::Tagging::TagAssociation
  show all
Defined in:
  /build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb

## Overview

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

## Defined Under Namespace

Classes: BatchResult, ObjectToTags, TagToObjects

## Instance Method Summary (collapse)

- - (Void) attach(tag_id, object_id)

  Attaches the given tag to the input object.

- - (Com::Vmware::Cis::Tagging::TagAssociation::BatchResult) attach_multiple_tags_to_object(object_id, tag_ids)

  Attaches the given tags to the input object.

- - (Com::Vmware::Cis::Tagging::TagAssociation::BatchResult) attach_tag_to_multiple_objects(tag_id, object_ids)

  Attaches the given tag to the input objects.

- - (Void) detach(tag_id, object_id)

  Detaches the tag from the given object.

- - (Com::Vmware::Cis::Tagging::TagAssociation::BatchResult) detach_multiple_tags_from_object(object_id, tag_ids)

  Detaches the given tags from the input object.

- - (Com::Vmware::Cis::Tagging::TagAssociation::BatchResult) detach_tag_from_multiple_objects(tag_id, object_ids)

  Detaches the given tag from the input objects.

- - (TagAssociation) initialize(config) constructor

  Constructs a new instance.

- - (Array<String>) list_attachable_tags(object_id)

  Fetches the list of attachable tags for the given object, omitting the tags that have already been attached.

- - (Array<Com::Vmware::Vapi::Std::DynamicID>) list_attached_objects(tag_id)

  Fetches the list of attached objects for the given tag.

- - (Array<Com::Vmware::Cis::Tagging::TagAssociation::TagToObjects>) list_attached_objects_on_tags(tag_ids)

  Fetches the list of :class:`Com::Vmware::Cis::Tagging::TagAssociation::TagToObjects` describing the input tag identifiers and the objects they are attached to.

- - (Array<String>) list_attached_tags(object_id)

  Fetches the list of tags attached to the given object.

- - (Array<Com::Vmware::Cis::Tagging::TagAssociation::ObjectToTags>) list_attached_tags_on_objects(object_ids)

  Fetches the list of :class:`Com::Vmware::Cis::Tagging::TagAssociation::ObjectToTags` describing the input object identifiers and the tags attached to each object.

## Constructor Details

### - (`TagAssociation`) initialize(config)

Constructs a new instance.

Parameters:

- config (`VAPI::Bindings::StubConfig`) —

  A hash with the api provider details.

    1013
    1014
    1015
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1013

    def initialize(config)
        super(config, @@service_info)
    end

## Instance Method Details

### - (`Void`) attach(tag_id, object_id)

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 (`String`) —

  The identifier of the input tag.

- object_id (`Com::Vmware::Vapi::Std::DynamicID`) —

  The identifier of the input object.

Returns:

- (`Void`)

Raises:

- (`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.

    1031
    1032
    1033
    1034
    1035
    1036
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1031

    def attach(tag_id, object_id)
        invoke_with_info(@@attach_info, {
            'tag_id' => tag_id,
            'object_id' => object_id,
        })
    end

### - (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) 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 :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 (`Com::Vmware::Vapi::Std::DynamicID`) —

  The identifier of the input object.

- tag_ids (`Array<String>`) —

  The identifiers of the input tags.

Returns:

- (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) —

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

Raises:

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if you do not have the privilege to read the object.

    1049
    1050
    1051
    1052
    1053
    1054
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1049

    def attach_multiple_tags_to_object(object_id, tag_ids)
        invoke_with_info(@@attach_multiple_tags_to_object_info, {
            'object_id' => object_id,
            'tag_ids' => tag_ids,
        })
    end

### - (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) 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 :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 (`String`) —

  The identifier of the input tag.

- object_ids (`Array<Com::Vmware::Vapi::Std::DynamicID>`) —

  The identifiers of the input objects.

Returns:

- (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) —

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

Raises:

- (`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.

    1069
    1070
    1071
    1072
    1073
    1074
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1069

    def attach_tag_to_multiple_objects(tag_id, object_ids)
        invoke_with_info(@@attach_tag_to_multiple_objects_info, {
            'tag_id' => tag_id,
            'object_ids' => object_ids,
        })
    end

### - (`Void`) 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 (`String`) —

  The identifier of the input tag.

- object_id (`Com::Vmware::Vapi::Std::DynamicID`) —

  The identifier of the input object.

Returns:

- (`Void`)

Raises:

- (`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.

    1088
    1089
    1090
    1091
    1092
    1093
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1088

    def detach(tag_id, object_id)
        invoke_with_info(@@detach_info, {
            'tag_id' => tag_id,
            'object_id' => object_id,
        })
    end

### - (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) 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 :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 (`Com::Vmware::Vapi::Std::DynamicID`) —

  The identifier of the input object.

- tag_ids (`Array<String>`) —

  The identifiers of the input tags.

Returns:

- (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) —

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

Raises:

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if you do not have the privilege to read the object.

    1106
    1107
    1108
    1109
    1110
    1111
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1106

    def detach_multiple_tags_from_object(object_id, tag_ids)
        invoke_with_info(@@detach_multiple_tags_from_object_info, {
            'object_id' => object_id,
            'tag_ids' => tag_ids,
        })
    end

### - (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) 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 :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 (`String`) —

  The identifier of the input tag.

- object_ids (`Array<Com::Vmware::Vapi::Std::DynamicID>`) —

  The identifiers of the input objects.

Returns:

- (`Com::Vmware::Cis::Tagging::TagAssociation::BatchResult`) —

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

Raises:

- (`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.

    1126
    1127
    1128
    1129
    1130
    1131
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1126

    def detach_tag_from_multiple_objects(tag_id, object_ids)
        invoke_with_info(@@detach_tag_from_multiple_objects_info, {
            'tag_id' => tag_id,
            'object_ids' => object_ids,
        })
    end

### - (`Array<String>`) 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 ( :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 (`Com::Vmware::Vapi::Std::DynamicID`) —

  The identifier of the input object.

Returns:

- (`Array<String>`) —

  The list of tag identifiers that are eligible to be attached to the given object.

Raises:

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if you do not have the privilege to read the object.

    1200
    1201
    1202
    1203
    1204
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1200

    def list_attachable_tags(object_id)
        invoke_with_info(@@list_attachable_tags_info, {
            'object_id' => object_id,
        })
    end

### - (`Array<Com::Vmware::Vapi::Std::DynamicID>`) 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 (`String`) —

  The identifier of the input tag.

Returns:

- (`Array<Com::Vmware::Vapi::Std::DynamicID>`) —

  The list of attached object identifiers.

Raises:

- (`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.

    1144
    1145
    1146
    1147
    1148
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1144

    def list_attached_objects(tag_id)
        invoke_with_info(@@list_attached_objects_info, {
            'tag_id' => tag_id,
        })
    end

### - (`Array<Com::Vmware::Cis::Tagging::TagAssociation::TagToObjects>`) list_attached_objects_on_tags(tag_ids)

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 (`Array<String>`) —

  The identifiers of the input tags.

Returns:

- (`Array<Com::Vmware::Cis::Tagging::TagAssociation::TagToObjects>`) —

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

    1157
    1158
    1159
    1160
    1161
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1157

    def list_attached_objects_on_tags(tag_ids)
        invoke_with_info(@@list_attached_objects_on_tags_info, {
            'tag_ids' => tag_ids,
        })
    end

### - (`Array<String>`) 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::DynamicID`) —

  The identifier of the input object.

Returns:

- (`Array<String>`) —

  The list of all tag identifiers that correspond to the tags attached to the given object.

Raises:

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if you do not have the privilege to read the object.

    1172
    1173
    1174
    1175
    1176
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1172

    def list_attached_tags(object_id)
        invoke_with_info(@@list_attached_tags_info, {
            'object_id' => object_id,
        })
    end

### - (`Array<Com::Vmware::Cis::Tagging::TagAssociation::ObjectToTags>`) list_attached_tags_on_objects(object_ids)

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 (`Array<Com::Vmware::Vapi::Std::DynamicID>`) —

  The identifiers of the input objects.

Returns:

- (`Array<Com::Vmware::Cis::Tagging::TagAssociation::ObjectToTags>`) —

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

    1185
    1186
    1187
    1188
    1189
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/cis/tagging.rb', line 1185

    def list_attached_tags_on_objects(object_ids)
        invoke_with_info(@@list_attached_tags_on_objects_info, {
            'object_ids' => object_ids,
        })
    end