Sha256: bc925edec20459a7f25e6d267d94ed4bf67d535a1666881f316f86b4d5a4b101

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

#
# Author:: Alessio Rocchi (<alessio.rocchi@staff.aruba.it>)
# © Copyright ArubaCloud.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

require 'fog/arubacloud/service'
require 'fog/arubacloud/error'
require 'benchmark'

module Fog
  module Compute
    class ArubaCloud
      class Real
        def get_hypervisors
          body = self.body('GetHypervisors')
          options = {
              :http_method => :post,
              :method => 'GetHypervisors',
              :body => Fog::JSON.encode(body)
          }
          response = nil
          time = Benchmark.realtime {
            response = request(options)
          }
          Fog::Logger.debug("GetHypervisors time: #{time}")
          if response['Success']
            response
          else
            raise Fog::ArubaCloud::Errors::RequestError.new('Error in request.')
          end
        end # get_hypervisors
      end # Real

      class Mock
        # Due to the length of the response body, I actually decided to not implement
        # the mock method of the request. I will introduce it in the next version after structuring the mock
        # objects in a more reasonable way.
        def get_hypervisors
          raise Fog::Errors::MockNotImplemented.new(
              'Mock object for get_hypervisor not present, read code comments for details.'
          )
        end # get_hypervisors
      end # Mock

    end # ArubaCloud
  end # Compute
end # Fog

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-arubacloud-0.0.3 lib/fog/arubacloud/requests/compute/get_hypervisors.rb