Sha256: bb9201a28eee31600bf695db967dc3ccf28f1e02cb2ef6d065046a35adbf234e

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

module Fog
  module VcloudDirector
    class Compute
      class Real
        # Retrieve SnapshotSection element for a vApp or VM.
        #
        # @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-SnapshotSection.html
        # @since vCloud API version 5.1
        def get_snapshot_section(id)
          request(
            :expects    => 200,
            :idempotent => true,
            :method     => 'GET',
            :parser     => Fog::ToHashDocument.new,
            :path       => "vApp/#{id}/snapshotSection"
          )
        end
      end

      class Mock

        def get_snapshot_section(id)
          type = 'application/vnd.vmware.vcloud.snapshotSection+xml'

          unless data[:vms][id] || data[:vapps][id]
            raise Fog::VcloudDirector::Compute::Forbidden.new(
              'This operation is denied.'
            )
          end

          Excon::Response.new(
            :status => 200,
            :headers => {'Content-Type' => "#{type};version=#{api_version}"},
            :body => get_snapshot_section_body(id)
          )
        end

        def get_snapshot_section_body(id)
          {
            :type => "application/vnd.vmware.vcloud.snapshotSection+xml",
            :href => make_href("vApp/#{id}/snapshotSection"),
            :ovf_required => "false",
            :"ovf:Info"   => "Snapshot information section"
          }
        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_snapshot_section.rb
fog-vcloud-director-0.3.0 lib/fog/vcloud_director/requests/compute/get_snapshot_section.rb