Class: AWS::AutoScaling::Tag

Inherits:
Hash
  • Object
show all
Defined in:
lib/aws/auto_scaling/tag.rb

Overview

Auto Scaling tags are hashes with two helper methods:

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Tag

Returns a new instance of Tag.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/aws/auto_scaling/tag.rb', line 25

def initialize options = {}

  super()

  @resource = 
    case options[:resource_type]
    when 'auto-scaling-group' 
      group_name = options[:resource_id]
      config = options.delete(:config)
      Group.new(group_name, :config => config)
    else 
      msg = "unhandled resource type: #{options[:resource_type]}"
      raise ArgumentError, msg
    end

  merge!(options)

end

Instance Method Details

#deletenil

Deletes the tag from the resource.

Returns:

  • (nil)


52
53
54
55
# File 'lib/aws/auto_scaling/tag.rb', line 52

def delete
  resource.delete_tags([self])
  nil
end

#resourceGroup

Returns the tagged resource. Currently this is always an Auto Scaling group.

Returns:

  • (Group)

    Returns the tagged resource. Currently this is always an Auto Scaling group.



46
47
48
# File 'lib/aws/auto_scaling/tag.rb', line 46

def resource
  @resource
end