Class: Euca::Tag
- Inherits:
-
Object
- Object
- Euca::Tag
- Includes:
- Filterable, Model
- Defined in:
- lib/euca/api/tag.rb
Constant Summary collapse
- TYPE_ID =
"tag"- TYPE_ATTRS =
%w(type instance_id instance_type key value)
Class Method Summary collapse
Methods included from Filterable
Class Method Details
.create(key, value, instance_id = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/euca/api/tag.rb', line 10 def self.create key, value, instance_id = nil result = begin if key.is_a? Hash euca("create-tags", key.map{|key,value| "--tag #{key}=#{value}" }.join(" ") , value).first else return nil if instance_id.nil? euca("create-tags", "--tag #{key}=#{value}", instance_id).first end end if result result['value']=result['key'] result['key']=result['instance_type'] result.delete('instance_type') result end end |
.destroy(key, value, instance_id = nil) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/euca/api/tag.rb', line 27 def self.destroy key, value, instance_id = nil if key.is_a? Hash euca("delete-tags", key.map{|key,value| "--tag #{key}=#{value}" }.join(" ") , value).first else return nil if instance_id.nil? euca("delete-tags", "--tag #{key}=#{value}", instance_id).first end end |