Module: Hyperkit::Client::Networks

Included in:
Hyperkit::Client
Defined in:
lib/hyperkit/client/networks.rb

Overview

Methods for the networks API

Instance Method Summary collapse

Instance Method Details

#network(name) ⇒ Sawyer::Resource

Get information on a network

Examples:

Get information about lxcbr0

Hyperkit.network("lxcbr0") #=> {:name=>"lxcbr0", :type=>"bridge", :used_by=>[]}

Returns:

  • (Sawyer::Resource)

    Network information



28
29
30
# File 'lib/hyperkit/client/networks.rb', line 28

def network(name)
  get(network_path(name)).
end

#networksArray<String>

List of networks defined on the host

Examples:

Get list of networks

Hyperkit.networks #=> ["lo", "eth0", "lxcbr0"]

Returns:

  • (Array<String>)

    An array of networks defined on the host



17
18
19
20
# File 'lib/hyperkit/client/networks.rb', line 17

def networks
  response = get(networks_path)
  response..map { |path| path.split('/').last }
end