Sha256: 5ce0ae1773e68427259be1cacba868a0a64d736d21f8567453817942b0b6c3c8

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module Fog
  module Compute
    class OneAndOne

      class Real

        ##
        # Removes a snapshot
        # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__snapshots__snapshot_id__delete]
        ##
        def delete_snapshot(server_id: nil, snapshot_id: nil)
          
          params = {
            'method' => :delete,
            'endpoint' => "/servers/#{server_id}/snapshots/#{snapshot_id}"
          }

          request(params)

        end

      end # Real

      
      class Mock

        def delete_snapshot(server_id: nil, snapshot_id: nil)
          
          # Search for server
          if server = self.data[:servers].find {
            |hash| hash['id'] == server_id
          }
            server['snapshot'] = {}
          else
            raise Fog::Errors::NotFound.new('The requested resource could
              not be found.')
          end

          # Return Response Object to User
          response = Excon::Response.new
          response.status = 202
          response.body = server
          response

        end

      end # Mock

    end # OneAndOne
  end # Compute
end # Fog

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-oneandone-1.2 lib/oneandone/requests/compute/delete_snapshot.rb
fog-oneandone-1.0 lib/oneandone/requests/compute/delete_snapshot.rb