Class AWS::EC2::ResourceTagCollection
In: lib/aws/ec2/resource_tag_collection.rb
Parent: Object

Represents the EC2 tags associated with a single resource.

@example Manipulating the tags of an EC2 instance

 i = ec2.instances["i-123"]
 i.tags.to_h                  # => { "foo" => "bar", ... }
 i.tags.clear
 i.tags.stage = "production"
 i.tags.stage                 # => "production"

Methods

<<   []   []=   add   clear   delete   each   each_pair   empty?   has_key?   has_value?   include?   key?   member?   method_missing   new   set   store   to_h   update   value?   values_at  

Included Modules

Model Enumerable

Public Class methods

Public Instance methods

<<(key)

Alias for add

@return [String] The value of the tag with the given key, or

  nil if no such tag exists.

@param [String or Symbol] key The key of the tag to return.

Changes the value of a tag.

@param [String or Symbol] The key of the tag to set.

@param [String] The new value. If this is nil, the tag will

  be deleted.

Adds a tag with a blank value.

@param [String or Symbol] key The key of the new tag.

Removes all tags from the resource.

Deletes the tags with the given keys (which may be strings or symbols).

@yield [key, value] The key/value pairs of each tag

  associated with the resource.  If the block has an arity
  of 1, the key and value will be yielded in an aray.
each_pair(&blk)

Alias for each

@return [Boolean] True if the resource has no tags.

@return [Boolean] True if the resource has a tag for the given key.

@param [String or Symbol] The key of the tag to check.

@return [Boolean] True if the resource has a tag with the given value.

@param [String or Symbol] The value to check.

include?(key)

Alias for has_key?

key?(key)

Alias for has_key?

member?(key)

Alias for has_key?

Allows setting and getting individual tags through instance methods. For example:

 tags.color = "red"
 tags.color         # => "red"

Sets multiple tags in a single request.

@param [Hash] tags The tags to set. The keys of the hash

  may be strings or symbols, and the values must be strings.
  Note that there is no way to both set and delete tags
  simultaneously.
store(key, value)

Alias for #[]=

@return [Hash] The current tags as a hash, where the keys

  are the tag keys as strings and the values are the tag
  values as strings.
update(tags)

Alias for set

value?(value)

Alias for has_value?

@return [Array] An array of the tag values associated with

  the given keys.  An entry for a key that has no value
  (i.e. there is no such tag) will be nil.

[Validate]