Sha256: 1262df7e385ff8d1f7f26acdabdd0d2c96e2b05673a80c540a281a8130664ceb

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

#
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
module Fog
  module Compute
    class Softlayer

      class Mock
        def get_vm(identifier)
          response = Excon::Response.new
          response.body = @virtual_guests.map {|vm| vm if vm['id'] == identifier.to_s }.compact.first || {}
          response.status = response.body.empty? ? 404 : 200
          if response.status == 404
            response.body = {
              "error"=>"Unable to find object with id of '#{identifier}'.",
              "code"=>"SoftLayer_Exception_ObjectNotFound"
            }
          end
          response
        end

      end

      class Real
        def get_vm(identifier)
          request(:virtual_guest, identifier, :expected => [200, 404], :query => 'objectMask=mask[datacenter,tagReferences,blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.passwords.password]')
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-softlayer-0.3.6 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.3.6.pre.f82ffe9 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.3.5 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.3.4.pre lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.3.3.pre lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.3.2 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.3.1 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.2.1 lib/fog/softlayer/requests/compute/get_vm.rb