Sha256: 47120147f074edf1f12d8ff82dbdb31cfc6d4bac924ffcbf77a041b9967c0e1c

Contents?: true

Size: 778 Bytes

Versions: 4

Compression:

Stored size: 778 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      class Real
        def list_private_addresses(server_id)
          request(
            :expects => [200, 203],
            :method  => 'GET',
            :path    => "servers/#{server_id}/ips/private"
          )
        end
      end

      class Mock
        def list_private_addresses(server_id)
          response = Excon::Response.new
          server = list_servers_detail.body['servers'].find { |srv| srv['id'] == server_id }
          if server
            response.status = [200, 203][rand(2)]
            response.body = {'private' => server['addresses']['private']}
            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/list_private_addresses.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/list_private_addresses.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/list_private_addresses.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/list_private_addresses.rb