Sha256: b8ff9af4a414cbbba1d77151b3ba5d0b97cf6fb072b2cb8ce7e3fdba7eb2d077

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

module Fog
  module Compute
    class RackspaceV2
      class Real

        # Lists all networks and addresses associated with a specified server.
        # @param [String] server_id
        # @return [Excon::Response] response:
        #   * body [Hash]:
        #     * addresses [Hash] - key is the network name and the value are an array of addresses allocated for that network
        # @raise [Fog::Compute::RackspaceV2::NotFound] - HTTP 404
        # @raise [Fog::Compute::RackspaceV2::BadRequest] - HTTP 400
        # @raise [Fog::Compute::RackspaceV2::InternalServerError] - HTTP 500
        # @raise [Fog::Compute::RackspaceV2::ServiceError]
        def list_addresses(server_id)
          request(
            :method   => 'GET',
            :expects  => 200,
            :path     => "/servers/#{server_id}/ips"
          )
        end

      end

      class Mock

        def list_addresses(server_id)
          raise Fog::Compute::RackspaceV2::NotFound.new if server_id == 0
          response        = Excon::Response.new
          response.status = 200
          response.body   = {
            "addresses" => {
              "public"=>[{"version"=>6, "addr"=>"2001:4800:7811:0513:0fe1:75e8:ff04:760b"}, {"version"=>4, "addr"=>"166.78.18.176"}],
              "private"=>[{"version"=>4, "addr"=>"10.181.129.68"}]
            }
          }
          response
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-1.22.0 lib/fog/rackspace/requests/compute_v2/list_addresses.rb
fog-1.21.0 lib/fog/rackspace/requests/compute_v2/list_addresses.rb