Sha256: 76ac66c682c380bcd03959f81c03a344fe1d93d1e324027fd6eaa8e897b8b957

Contents?: true

Size: 1.45 KB

Versions: 29

Compression:

Stored size: 1.45 KB

Contents

module Fog
  module Compute
    class HPV2
      class Real
        # List private server addresses
        #
        # ==== Parameters
        # * 'server_id'<~String> - UUId of server to list addresses for
        # * 'network_name'<~String> - Name of the network to list addresses for
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'custom'<~Array> - IP addresses for the server, for the network. The network name can change based on setup.
        #       * 'version'<~Integer> - IP version, 4 or 6
        #       * 'addr'<~String> - IP address
        def list_server_addresses_by_network(server_id, network_name)
          request(
            :expects  => [200,203],
            :method   => 'GET',
            :path     => "servers/#{server_id}/ips/#{Fog::HP.escape(network_name)}"
          )
        end
      end

      class Mock
        def list_server_addresses_by_network(server_id, network_name)
          response = Excon::Response.new
          if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id}
            response.status = 200
            # get the addresses for the network, which is 'custom' in case of mocks
            address = server['addresses'].select { |key, _| key == network_name}
            response.body = address
            response
          else
            raise Fog::Compute::HPV2::NotFound
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 4 rubygems

Version Path
fog-1.37.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.36.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.35.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-2.0.0.pre.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.34.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.33.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.32.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.31.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.30.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.29.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.28.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.27.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.26.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.25.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
nsidc-fog-1.24.1 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
fog-1.24.0 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
ns-fog-1.22.11 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb
ns-fog-1.22.10 lib/fog/hp/requests/compute_v2/list_server_addresses_by_network.rb