module AWS::ELB::TaggedItem

Public Instance Methods

add_tag(key, options = {}) click to toggle source

Adds a single tag with an optional tag value.

# adds a tag with the key production
resource.tag('production')

# adds a tag with the optional value set to production
resource.tag('role', :value => 'webserver')

@param [String] key The name of the tag to add. @param [Hash] options @option options [String] :value An optional tag value. Unlike EC2 version, this returns nil

# File lib/aws/elb/tagged_item.rb, line 17
def add_tag key, options = {}
  tags[key] = options[:value].to_s
end
Also aliased as: tag
clear_tags() click to toggle source

Deletes all tags associated with this EC2 resource. @return [nil]

# File lib/aws/elb/tagged_item.rb, line 24
def clear_tags
  tags.clear
  nil
end
tag(key, options = {})
Alias for: add_tag
tags() click to toggle source

Returns a collection that represents only tags belonging to this 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"

@return [ResourceTagCollection] A collection of tags that

belong to this resource.
# File lib/aws/elb/tagged_item.rb, line 42
def tags
  LoadBalancerTagCollection.new(self, :config => config)
end