Sha256: 8bd5086635e27f9fc39ece8c7a0332f1241460caaa5c87af970a596a520ff37d

Contents?: true

Size: 1.15 KB

Versions: 18

Compression:

Stored size: 1.15 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.softwareLicense.softwareDescription.referenceCode,sshKeys.id,privateNetworkOnlyFlag,userData,frontendNetworkComponents,backendNetworkComponents,hourlyBillingFlag]')
        end
      end
    end
  end
end

Version data entries

18 entries across 16 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/compute/get_vm.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/compute/get_vm.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.1.4 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.1.3 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.1.2 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.1.1 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.1.0 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.0.3 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.0.2 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.0.1 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-1.0.0 lib/fog/softlayer/requests/compute/get_vm.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.4.7 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.4.6 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.4.5 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.4.4 lib/fog/softlayer/requests/compute/get_vm.rb
fog-softlayer-0.4.3 lib/fog/softlayer/requests/compute/get_vm.rb