Sha256: fe92944232eb728463817885e7bbd55e57a69422a4e3445a96044b71d083df34

Contents?: true

Size: 1.05 KB

Versions: 64

Compression:

Stored size: 1.05 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

        # Delete a BMC server
        # @param [Integer] id
        # @return [Excon::Response]
        def delete_bare_metal_server(id)
          response = Excon::Response.new

          # Found it and deleted it.
          response.status = 200
          response.body = self.get_bare_metal_servers.body.map{|server| server['id']}.include?(id)

          # Didn't find it, give the error that the API would give.
          unless response.body
            response.body = Fog::JSON.encode({:error => "A billing item is required to process a cancellation.", :code => "SoftLayer_Exception_NotFound"})
            response.status = 500
          end

          response
        end
      end

      class Real

        def delete_bare_metal_server(id)
          request(:hardware_server, id.to_s, :http_method => :DELETE)
        end

      end
    end
  end
end

Version data entries

64 entries across 62 versions & 3 rubygems

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