Sha256: 9b7ae1f7aefd1a860afef524e15c6c7065f10bffe975c2601dd25d52c394cf7f

Contents?: true

Size: 942 Bytes

Versions: 37

Compression:

Stored size: 942 Bytes

Contents

require 'fog/core/collection'
require 'fog/vcloud_director/models/compute/tag'

module Fog
  module Compute
    class VcloudDirector

      class Tags < Collection
        model Fog::Compute::VcloudDirector::Tag

        attribute :vm

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

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

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

        private
        
        def item_list
          @items =[]
          hash_items.each_pair{ |k,v| @items << {:id => k, :value => v }.merge(:vm => vm) }
          @items
        end

      end
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101839 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/vcloud_director/models/compute/tags.rb
fog-1.20.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/vcloud_director/models/compute/tags.rb
fog-1.19.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/vcloud_director/models/compute/tags.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/vcloud_director/models/compute/tags.rb