Sha256: 32c18cdcb7dcefa1a7541922813241d8f7c109e5bd8d6b77650dea2bd5426669
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
module Squall # OnApp Network class Network < Base # Public: Lists all networks. # # Returns an Array. def list response = request(:get, '/settings/networks.json') response.collect { |network| network['network'] } end # 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. def create(options = {}) response = request(:post, '/settings/networks.json', default_params(options)) response.first[1] end # Public: Edit a Network # # id - ID of the network # options - Params for editing the Network, see `#create` # # Returns a Hash. def edit(id, options = {}) request(:put, "/settings/networks/#{id}.json", default_params(options)) end # Public: Delete a network. # # id - ID of the network # # Returns a Hash. def delete(id) request(:delete, "/settings/networks/#{id}.json") end # Public: Rebuild VM network. # # id - ID of the virtual machine # # Returns a Hash. def rebuild(id) request(:post, "/virtual_machines/#{id}/rebuild_network.json") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
squall-1.4.0 | lib/squall/network.rb |
squall-1.3.1 | lib/squall/network.rb |