Sha256: 1ded5b6e86de039301ddc97939ffce6a78864fcfa94d6909cfa14434c179deee

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

module Fog
  module VcloudDirector
    class Compute
      class Real
        # Retrieve metadata associated with the vApp or VM.
        #
        # @deprecated Use {#get_vapp_metadata} instead.
        # @todo Log deprecation warning.
        #
        # @param [String] id Object identifier of the vApp or VM.
        # @return [Excon::Response]
        #   * body<~Hash>:
        #
        # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-VAppMetadata.html
        # @since vCloud API version 1.5
        def get_metadata(id)
          require 'fog/vcloud_director/parsers/compute/metadata'

          request(
            :expects    => 200,
            :idempotent => true,
            :method     => 'GET',
            :parser     => Fog::VcloudDirector::Parsers::Compute::Metadata.new,
            :path       => "vApp/#{id}/metadata/"
          )
        end
      end
      class Mock
        def get_metadata(id)
          tags = data[:tags][id] || {}
          body = {:type => 'application/vnd.vmware.vcloud.metadata+xml', :metadata => tags}
          Excon::Response.new(
            :status => 200,
            :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
            :body => body
          )
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-vcloud-director-0.3.1 lib/fog/vcloud_director/requests/compute/get_metadata.rb
fog-vcloud-director-0.3.0 lib/fog/vcloud_director/requests/compute/get_metadata.rb