Sha256: 0ea863fe3337fdc714df8daf9eb17605b2ad60d303eb04bbc121f66396df5838

Contents?: true

Size: 1.72 KB

Versions: 18

Compression:

Stored size: 1.72 KB

Contents

module Fog
  module Compute
    class VcloudDirector
      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 vApp
        # @param [Array]  sections List of sections hashes
        # @return [Excon::Response]
        #   * body<~Hash>:
        #
        # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-E13A5613-8A41-46E3-889B-8E1EAF10ABBE.html
        # @since vCloud API version 1.5
        def put_product_sections(id, sections)
          xml  = '<ProductSectionList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">'
          xml += '<ovf:ProductSection>'
          xml += '<ovf:Info>Global vApp Custom Properties</ovf:Info>'
          xml += '<ovf:Category>Global</ovf:Category>'

          sections.each do |section|
            section[:user_configurable] ||= true
            section[:type]              ||= "string"
            section[:password]          ||= false
            xml += "<ovf:Property ovf:userConfigurable='#{section[:user_configurable]}' ovf:type='#{section[:type]}' ovf:password='#{section[:password]}' ovf:key='#{section[:id]}' ovf:value='#{section[:value]}'/>"
          end

          xml += '</ovf:ProductSection>'
          xml += "</ProductSectionList>"

          request(
            :body    => xml,
            :expects => 202,
            :headers => {'Content-Type' => 'application/vnd.vmware.vcloud.productSections+xml'},
            :method  => 'PUT',
            :parser  => Fog::ToHashDocument.new,
            :path    => "vApp/#{id}/productSections"
          )
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
fog-1.37.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.36.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.35.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-2.0.0.pre.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.34.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.33.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.32.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.31.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.30.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.29.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.28.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.27.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.26.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.25.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
nsidc-fog-1.24.1 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.24.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb
fog-1.23.0 lib/fog/vcloud_director/requests/compute/put_product_sections.rb