Sha256: 6fc3aac2c1768cc8b1f612d61aee335f6362eec62f7b4304bca0f7be6c0dad96

Contents?: true

Size: 1.86 KB

Versions: 96

Compression:

Stored size: 1.86 KB

Contents

module Fog
  module Compute
    class VcloudDirector
      class Real
        # Set the metadata value for the specified key to the value provided,
        # overwriting any existing value.
        #
        # @param [String] id Object identifier of the catalog item.
        # @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-CatalogItemMetadataItem-metadata.html
        # @since vCloud API version 1.5
        def put_catalog_item_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) {
              if api_version.to_f < 5.1
                Value value
              else
                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
            }
          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    => "catalogItem/#{id}/metadata/#{URI.escape(key)}"
          )
        end
      end
    end
  end
end

Version data entries

96 entries across 94 versions & 8 rubygems

Version Path
fog-2.3.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-ifeel-2.2.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-2.2.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-2.1.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-1.42.1 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.2.2 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.2.1 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.2.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.1.10 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.1.9 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-2.0.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-1.42.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-1.41.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-1.40.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-1.39.0 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.1.8 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb
fog-vcloud-director-0.1.7 lib/fog/vcloud_director/requests/compute/put_catalog_item_metadata_item_metadata.rb