Class: Fog::Compute::VcloudDirector::Tags

Inherits:
Collection show all
Defined in:
lib/fog/vcloud_director/models/compute/tags.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#all, #get, #get_everyone, #index

Methods inherited from Fog::Collection

#clear, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#create(key, value) ⇒ Object



22
23
24
25
# File 'lib/fog/vcloud_director/models/compute/tags.rb', line 22

def create(key,value)
  response = service.(vm.id, { key => value} )
  service.process_task(response.body)
end

#get_by_id(item_id) ⇒ Object



17
18
19
20
# File 'lib/fog/vcloud_director/models/compute/tags.rb', line 17

def get_by_id(item_id)
  item_list unless @items
  @items.detect{ |i| i[:id] == item_id}
end

#get_by_name(tag_name) ⇒ Object



13
14
15
# File 'lib/fog/vcloud_director/models/compute/tags.rb', line 13

def get_by_name(tag_name)
  get(tag_name)
end

#hash_itemsObject



27
28
29
30
# File 'lib/fog/vcloud_director/models/compute/tags.rb', line 27

def hash_items
  @tags = service.(vm.id).body
  @tags[:metadata]
end