class Squall::NetworkZone

OnApp NetworkZone

Public Instance Methods

attach(id, network_id) click to toggle source

Public: Attach a network to a network zone.

id - ID of the network zone network_id - ID of the network

Returns a Hash.

# 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 = {}) click to toggle source

Public: Creates a new network zone.

options - Options for creating the new network zone:

:label - Label for the network zone

Returns a Hash.

# File lib/squall/network_zone.rb, line 38
def create(options = {})
  request(:post, "/network_zones.json", query: { pack: options })
end
delete(id) click to toggle source

Public: Deletes an existing network zone.

id - ID of the network zone

Returns a Hash.

# File lib/squall/network_zone.rb, line 47
def delete(id)
  request(:delete, "/network_zones/#{id}.json")
end
detach(id, network_id) click to toggle source

Public: Detach a network from a network zone.

id - ID of the network zone network_id - ID of the network

Returns a Hash.

# 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 = {}) click to toggle source

Public: Updates an existing network zone.

id - ID of the network zone options - Options to update the network zone, see `#create`

Returns a Hash.

# File lib/squall/network_zone.rb, line 28
def edit(id, options = {})
  request(:put, "/network_zones/#{id}.json", query:  { pack: options })
end
list() click to toggle source

Public: Lists all network zones.

Returns an Array.

# 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) click to toggle source

Public: Get the details for a network zone.

id - ID of the network zone

Returns a Hash.

# File lib/squall/network_zone.rb, line 17
def show(id)
  response = request(:get, "/network_zones/#{id}.json")
  response['network_group']
end