Sha256: 62e56e1013f3bd7a5f742eb302ef9a180c4f29c7ec07051c1c3acda06ca147dd

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

module Fog
  module Compute
    class OneAndOne

      class Real

        ##
        # Removes a server from a shared storage
        # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__servers__server_id__delete]
        ##
        def remove_shared_storage_server(shared_storage_id: nil, server_id: nil)
          
          params = {
            'method' => :delete,
            'endpoint' => "/shared_storages/#{shared_storage_id}/servers/#{server_id}"
          }

          request(params)

        end

      end # Real

      
      class Mock

        def remove_shared_storage_server(shared_storage_id: nil, server_id: nil)
          
          # Search for shared storage
          if shared_storage = self.data[:shared_storages].find {
            |hash| hash['id'] == shared_storage_id
          }
          else
            raise Fog::Errors::NotFound.new('The requested resource could
              not be found.')
          end

          # Search for server to destroy
          if server = shared_storage['servers'].find {
            |index| index['id'] == server_id
          }
            shared_storage['servers'].delete(server)
          else
            raise Fog::Errors::NotFound.new('The requested server could
            not be found.')
          end

          # Return Response Object to User
          response = Excon::Response.new
          response.status = 202
          response.body = shared_storage
          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/remove_shared_storage_server.rb
fog-oneandone-1.0 lib/oneandone/requests/compute/remove_shared_storage_server.rb