Sha256: 585925f267443ec8712de207a1fb78e7003dbf42c6581effdc0c5ff8f26f16e2

Contents?: true

Size: 922 Bytes

Versions: 54

Compression:

Stored size: 922 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.find{ |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

54 entries across 52 versions & 7 rubygems

Version Path
fog-2.3.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-ifeel-2.2.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-2.2.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-2.1.0 lib/fog/vcloud_director/models/compute/tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/vcloud_director/models/compute/tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/vcloud_director/models/compute/tags.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/vcloud_director/models/compute/tags.rb
fog-1.42.1 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.10 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.9 lib/fog/vcloud_director/models/compute/tags.rb
fog-2.0.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-1.42.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-1.41.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-1.40.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-1.39.0 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.8 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.7 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.6 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.5 lib/fog/vcloud_director/models/compute/tags.rb
fog-vcloud-director-0.1.4 lib/fog/vcloud_director/models/compute/tags.rb