class Squall::Network

OnApp Network

Public Instance Methods

create(options = {}) click to toggle source

Public: Create a Network.

options - Params for creating the Network:

:label
:vlan
:identifier

Example

create(
  label:            'mynetwork',
  network_group_id: 1,
  vlan:             2,
  identifier:       'something'
)

Returns a Hash.

# File lib/squall/network.rb, line 29
def create(options = {})
  response = request(:post, '/settings/networks.json', default_params(options))
  response.first[1]
end
delete(id) click to toggle source

Public: Delete a network.

id - ID of the network

Returns a Hash.

# File lib/squall/network.rb, line 49
def delete(id)
  request(:delete, "/settings/networks/#{id}.json")
end
edit(id, options = {}) click to toggle source

Public: Edit a Network

id - ID of the network options - Params for editing the Network, see `#create`

Returns a Hash.

# File lib/squall/network.rb, line 40
def edit(id, options = {})
  request(:put, "/settings/networks/#{id}.json", default_params(options))
end
list() click to toggle source

Public: Lists all networks.

Returns an Array.

# File lib/squall/network.rb, line 7
def list
  response = request(:get, '/settings/networks.json')
  response.collect { |network| network['network'] }
end
rebuild(id) click to toggle source

Public: Rebuild VM network.

id - ID of the virtual machine

Returns a Hash.

# File lib/squall/network.rb, line 58
def rebuild(id)
  request(:post, "/virtual_machines/#{id}/rebuild_network.json")
end