Class: Squall::NetworkZone
Overview
OnApp NetworkZone
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#attach(id, network_id) ⇒ Object
Public: Attach a network to a network zone.
-
#create(options = {}) ⇒ Object
Public: Creates a new network zone.
-
#delete(id) ⇒ Object
Public: Deletes an existing network zone.
-
#detach(id, network_id) ⇒ Object
Public: Detach a network from a network zone.
-
#edit(id, options = {}) ⇒ Object
Public: Updates an existing network zone.
-
#list ⇒ Object
Public: Lists all network zones.
-
#show(id) ⇒ Object
Public: Get the details for a network zone.
Methods inherited from Base
#check_config, #default_params, #key_for_class, #request
Instance Method Details
#attach(id, network_id) ⇒ Object
Public: Attach a network to a network zone.
id - ID of the network zone network_id - ID of the network
Returns a Hash.
57 58 59 |
# File 'lib/squall/network_zone.rb', line 57 def attach(id, network_id) request(:post, "/network_zones/#{id}/networks/#{network_id}/attach.json") end |
#create(options = {}) ⇒ Object
Public: Creates a new network zone.
options - Options for creating the new network zone:
:label - Label for the network zone
Returns a Hash.
38 39 40 |
# File 'lib/squall/network_zone.rb', line 38 def create( = {}) request(:post, "/network_zones.json", query: { pack: }) end |
#delete(id) ⇒ Object
Public: Deletes an existing network zone.
id - ID of the network zone
Returns a Hash.
47 48 49 |
# File 'lib/squall/network_zone.rb', line 47 def delete(id) request(:delete, "/network_zones/#{id}.json") end |
#detach(id, network_id) ⇒ Object
Public: Detach a network from a network zone.
id - ID of the network zone network_id - ID of the network
Returns a Hash.
67 68 69 |
# File 'lib/squall/network_zone.rb', line 67 def detach(id, network_id) request(:post, "/network_zones/#{id}/networks/#{network_id}/detach.json") end |
#edit(id, options = {}) ⇒ Object
Public: Updates an existing network zone.
id - ID of the network zone options - Options to update the network zone, see ‘#create`
Returns a Hash.
28 29 30 |
# File 'lib/squall/network_zone.rb', line 28 def edit(id, = {}) request(:put, "/network_zones/#{id}.json", query: { pack: }) end |
#list ⇒ Object
Public: Lists all network zones.
Returns an Array.
7 8 9 10 |
# File 'lib/squall/network_zone.rb', line 7 def list response = request(:get, "/network_zones.json") response.collect { |i| i['network_group'] } end |
#show(id) ⇒ Object
Public: Get the details for a network zone.
id - ID of the network zone
Returns a Hash.
17 18 19 20 |
# File 'lib/squall/network_zone.rb', line 17 def show(id) response = request(:get, "/network_zones/#{id}.json") response['network_group'] end |