Class: AWS::EC2::Tag
- Inherits:
-
Resource
- Object
- Core::Resource
- Resource
- AWS::EC2::Tag
- Defined in:
- lib/aws/ec2/tag.rb
Overview
Represents an EC2 tag.
Instance Attribute Summary collapse
-
#key ⇒ String
(also: #name)
readonly
The name of this tag.
-
#resource ⇒ Object
readonly
The EC2 resource this tag belongs to.
-
#value ⇒ String
The tag value.
Instance Method Summary collapse
-
#delete(value = nil) ⇒ nil
Deletes this tag.
-
#initialize(resource, key, options = {}) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(resource, key, options = {}) ⇒ Tag
Returns a new instance of Tag.
24 25 26 27 28 |
# File 'lib/aws/ec2/tag.rb', line 24 def initialize resource, key, = {} @resource = resource @key = key.to_s super end |
Instance Attribute Details
#key ⇒ String (readonly) Also known as: name
Returns The name of this tag.
34 35 36 |
# File 'lib/aws/ec2/tag.rb', line 34 def key @key end |
#resource ⇒ Object (readonly)
Returns The EC2 resource this tag belongs to.
31 32 33 |
# File 'lib/aws/ec2/tag.rb', line 31 def resource @resource end |
#value ⇒ String
The tag value.
19 20 21 |
# File 'lib/aws/ec2/tag.rb', line 19 def value @value end |
Instance Method Details
#delete(value = nil) ⇒ nil
Deletes this tag.
46 47 48 49 50 51 |
# File 'lib/aws/ec2/tag.rb', line 46 def delete(value = nil) tag_opts = { :key => key } tag_opts[:value] = value if value client.(:resources => [resource.id], :tags => [tag_opts]) nil end |