Sha256: 7bf1f58a5ea3096cefa717037d2cc3add2f7f2143be9f6183ef439b4acfa04fd

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Fog
  module Compute
    class ProfitBricks
      class Real
        # Delete virtual data center
        #
        # ==== Parameters
        # * snapshot_id<~String> - UUID of the snapshot
        #
        # ==== Returns
        # * response<~Excon::Response>
        #
        # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#delete-snapshot]
        def delete_snapshot(snapshot_id)
          request(
              :expects => [202],
              :method  => 'DELETE',
              :path    => "/snapshots/#{snapshot_id}"
          )
        rescue => error
          puts error
          Fog::Errors::NotFound.new(error)
        end
      end

      class Mock
        def delete_snapshot(snapshot_id)
          response = Excon::Response.new
          response.status = 202

          if snapshot = self.data[:snapshots]['items'].find {
              |attrib| attrib['id'] == snapshot_id
          }
          else
            raise Fog::Errors::NotFound.new('The requested resource could not be found')
          end

          response
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 lib/fog/profitbricks/requests/compute/delete_snapshot.rb