Class: Squall::Network
Overview
OnApp Network
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(options = {}) ⇒ Object
Public: Create a Network.
-
#delete(id) ⇒ Object
Public: Delete a network.
-
#edit(id, options = {}) ⇒ Object
Public: Edit a Network.
-
#list ⇒ Object
Public: Lists all networks.
-
#rebuild(id) ⇒ Object
Public: Rebuild VM network.
Methods inherited from Base
#check_config, #default_params, #key_for_class, #request
Instance Method Details
#create(options = {}) ⇒ Object
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.
29 30 31 32 |
# File 'lib/squall/network.rb', line 29 def create( = {}) response = request(:post, '/settings/networks.json', default_params()) response.first[1] end |
#delete(id) ⇒ Object
Public: Delete a network.
id - ID of the network
Returns a Hash.
49 50 51 |
# File 'lib/squall/network.rb', line 49 def delete(id) request(:delete, "/settings/networks/#{id}.json") end |
#edit(id, options = {}) ⇒ Object
Public: Edit a Network
id - ID of the network options - Params for editing the Network, see ‘#create`
Returns a Hash.
40 41 42 |
# File 'lib/squall/network.rb', line 40 def edit(id, = {}) request(:put, "/settings/networks/#{id}.json", default_params()) end |
#list ⇒ Object
Public: Lists all networks.
Returns an Array.
7 8 9 10 |
# File 'lib/squall/network.rb', line 7 def list response = request(:get, '/settings/networks.json') response.collect { |network| network['network'] } end |
#rebuild(id) ⇒ Object
Public: Rebuild VM network.
id - ID of the virtual machine
Returns a Hash.
58 59 60 |
# File 'lib/squall/network.rb', line 58 def rebuild(id) request(:post, "/virtual_machines/#{id}/rebuild_network.json") end |