Class: ActiveAws::TagSpec
- Inherits:
-
Object
- Object
- ActiveAws::TagSpec
- Defined in:
- lib/active_aws/tag_spec.rb
Instance Attribute Summary collapse
-
#resource_type ⇒ Object
readonly
Returns the value of attribute resource_type.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
- #add_tag!(key, value) ⇒ Object
-
#initialize(resource_type, tags) ⇒ TagSpec
constructor
A new instance of TagSpec.
- #merge(extra_tags) ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(resource_type, tags) ⇒ TagSpec
Returns a new instance of TagSpec.
17 18 19 20 |
# File 'lib/active_aws/tag_spec.rb', line 17 def initialize( resource_type, ) @resource_type = resource_type @tags = end |
Instance Attribute Details
#resource_type ⇒ Object (readonly)
Returns the value of attribute resource_type.
16 17 18 |
# File 'lib/active_aws/tag_spec.rb', line 16 def resource_type @resource_type end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
16 17 18 |
# File 'lib/active_aws/tag_spec.rb', line 16 def @tags end |
Class Method Details
.parse(tag_specifications) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/active_aws/tag_spec.rb', line 5 def parse( tag_specifications ) tag_specifications.map do |spec| spec = spec.deep_symbolize_keys self.new( spec[:resource_type], spec[:tags].map{|t| [t[:key], t[:value]]}.to_h ) end end |
Instance Method Details
#add_tag!(key, value) ⇒ Object
22 23 24 |
# File 'lib/active_aws/tag_spec.rb', line 22 def add_tag!( key, value ) @tags[key.to_s] = value end |
#merge(extra_tags) ⇒ Object
26 27 28 |
# File 'lib/active_aws/tag_spec.rb', line 26 def merge( ) self.class.new( resource_type, .merge() ) end |
#to_param ⇒ Object
30 31 32 33 34 35 |
# File 'lib/active_aws/tag_spec.rb', line 30 def to_param { resource_type: resource_type, tags: .map{|k,v| { key: k, value: v}} } end |