Sha256: c4f8871a3ac534f5100c1ba8d6fe15939acd4c1d15817b294e4eb4273d6eb20c
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
module Fog module VcloudDirector class Compute class Real # Set the value for the specified metadata key to the value provided, # overwriting any existing value. # # @param [String] id Object identifier of the disk. # @param [String] key Key of the metadata item. # @param [Boolean,DateTime,Fixnum,String] value Value of the metadata # item. # @return [Excon::Response] # * body<~Hash>: # # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/PUT-DiskMetadataItem-metadata.html # @since vCloud API version 5.1 def put_disk_metadata_item_metadata(id, key, value) body = Nokogiri::XML::Builder.new do attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } MetadataValue(attrs) { type = case value when TrueClass, FalseClass then 'MetadataBooleanValue'; when DateTime then 'MetadataDateTimeValue'; when Fixnum then 'MetadataNumberValue'; else 'MetadataStringValue' end TypedValue('xsi:type' => type) { Value value } } end.to_xml request( :body => body, :expects => 202, :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata.value+xml'}, :method => 'PUT', :parser => Fog::ToHashDocument.new, :path => "disk/#{id}/metadata/#{URI::DEFAULT_PARSER.escape(key)}" ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-vcloud-director-0.3.1 | lib/fog/vcloud_director/requests/compute/put_disk_metadata_item_metadata.rb |