Sha256: ba283111579bb6b7069b62c00e285ec66a1a79ab94457278ea0af334bba3681f

Contents?: true

Size: 1010 Bytes

Versions: 11

Compression:

Stored size: 1010 Bytes

Contents

module Fog
  module Compute
    class OracleCloud
      class Real
      	def delete_instance (name)
          if !name.start_with?("/Compute-") then
            # They haven't provided a well formed name, add their name in
            name = "/Compute-#{@identity_domain}/#{@username}/#{name}"
          end         
          request(
            :method   => 'DELETE',
            :expects  => 204,
            :path     => "/instance#{name}",
            :headers  => {
              'Content-Type' => 'application/oracle-compute-v3+json'
            }
          )
      	end
      end

      class Mock
        def delete_instance(name)
          response = Excon::Response.new
          clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''
          self.data[:instances][clean_name]['state'] = 'stopping'
          self.data[:deleted_at][clean_name] = Time.now
          response.status = 204
          response
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.12 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.11 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.10 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.9 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.8 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.7 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.6 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.5 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.4 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.3 lib/fog/oraclecloud/requests/compute/delete_instance.rb
fog-oraclecloud-0.1.2 lib/fog/oraclecloud/requests/compute/delete_instance.rb