Sha256: 0f9bf8933714dbf6f3c4519d2502f33c55ddf72f825f4d76e1d1824a3309aa67

Contents?: true

Size: 1.64 KB

Versions: 29

Compression:

Stored size: 1.64 KB

Contents

module Fog
  module Compute
    class HP
      class Real
        # List private server addresses
        #
        # ==== Parameters
        # * server_id<~Integer> - Id of server to list addresses for
        # * network_name<~String> - The name of the network name i.e. public, private or custom name
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'private'<~Array> - Private ip addresses
        def list_server_private_addresses(server_id, network_name)
          response = request(
            :expects  => 200,
            :method   => 'GET',
            :path     => "servers/#{server_id}/ips/#{network_name}.json"
          )
          # return the first address
          private_address = []
          data = response.body["#{network_name}"][0]
          if data
            private_address << data
          end

          response.body = { 'private' => private_address }
          response
        end
      end

      class Mock
        def list_server_private_addresses(server_id, network_name)
          response = Excon::Response.new
          if server = list_servers_detail.body['servers'].find {|_| _['id'] == server_id}
            private_address = []
            data = nil
            data = server['addresses']["#{network_name}"][0] if server['addresses']["#{network_name}"]
            if data
              private_address << data
            end

            response.status = 200
            response.body = { 'private' => private_address }
            response
          else
            raise Fog::Compute::HP::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/list_server_private_addresses.rb
fog-1.36.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.35.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-2.0.0.pre.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.34.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.33.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.32.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.31.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.30.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.29.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.28.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.27.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.26.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.25.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
nsidc-fog-1.24.1 lib/fog/hp/requests/compute/list_server_private_addresses.rb
fog-1.24.0 lib/fog/hp/requests/compute/list_server_private_addresses.rb
ns-fog-1.22.11 lib/fog/hp/requests/compute/list_server_private_addresses.rb
ns-fog-1.22.10 lib/fog/hp/requests/compute/list_server_private_addresses.rb