Sha256: edfd3e6279899a280e3919f2e55c236d281c2d2ba7e75ddc1f2eeed641b26172

Contents?: true

Size: 836 Bytes

Versions: 4

Compression:

Stored size: 836 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      class Real
        def update_server(server_id, options = {})
          request(
            :body    => Fog::JSON.encode('server' => options),
            :expects => 200,
            :method  => 'PUT',
            :path    => "servers/#{server_id}"
          )
        end
      end

      class Mock
        def update_server(server_id, options = {})
          response = Excon::Response.new
          server = list_servers_detail.body['servers'].find { |srv| srv['id'] == server_id }
          if server
            if options['name']
              server['name'] = options['name']
            end
            response.status = 200
            response
          else
            raise Fog::Compute::HuaweiCloud::NotFound
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/compute/huaweicloud/requests/update_server.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/update_server.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/update_server.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/update_server.rb