Module: Hyperb::Network
Overview
network api wrapper
Instance Method Summary collapse
-
#fip_allocate(params = {}) ⇒ Array
allocate a new floating ip.
-
#fip_attach(params = {}) ⇒ Object
attach a floating ip to a container.
-
#fip_detach(params = {}) ⇒ Object
detach a floating ip from a container.
-
#fip_name(params = {}) ⇒ Object
set a name for floating ip.
-
#fip_release(params = {}) ⇒ Object
release a floating ip.
-
#fips_ls(params = {}) ⇒ Object
list floating ips.
Methods included from Utils
#camelize, #check_arguments, #downcase_symbolize, #prepare_json, #underscore
Instance Method Details
#fip_allocate(params = {}) ⇒ Array
allocate a new floating ip
93 94 95 96 97 98 99 100 |
# File 'lib/hyperb/network/fips.rb', line 93 def fip_allocate(params = {}) raise ArgumentError, 'Invalid Arguments' unless check_arguments(params, 'count') path = '/fips/allocate' query = {} query[:count] = params[:count] if params.key?(:count) fips = JSON.parse(Hyperb::Request.new(self, path, query, 'post').perform) fips end |
#fip_attach(params = {}) ⇒ Object
attach a floating ip to a container
40 41 42 43 44 45 46 47 |
# File 'lib/hyperb/network/fips.rb', line 40 def fip_attach(params = {}) raise ArgumentError, 'Invalid Arguments' unless check_arguments(params, 'container', 'ip') path = '/fips/attach' query = {} query[:ip] = params[:ip] if params.key?(:ip) query[:container] = params[:container] if params.key?(:container) Hyperb::Request.new(self, path, query, 'post').perform end |
#fip_detach(params = {}) ⇒ Object
detach a floating ip from a container
22 23 24 25 26 27 28 |
# File 'lib/hyperb/network/fips.rb', line 22 def fip_detach(params = {}) raise ArgumentError, 'Invalid Arguments' unless check_arguments(params, 'container') path = '/fips/detach' query = {} query[:container] = params[:container] if params.key?(:container) Hyperb::Request.new(self, path, query, 'post').perform end |
#fip_name(params = {}) ⇒ Object
set a name for floating ip
115 116 117 118 119 120 121 122 |
# File 'lib/hyperb/network/fips.rb', line 115 def fip_name(params = {}) raise ArgumentError, 'Invalid Arguments' unless check_arguments(params, 'ip', 'name') path = '/fips/name' query = {} query[:ip] = params[:ip] if params.key?(:ip) query[:name] = params[:name] if params.key?(:name) Hyperb::Request.new(self, path, query, 'post').perform end |
#fip_release(params = {}) ⇒ Object
release a floating ip
76 77 78 79 80 81 |
# File 'lib/hyperb/network/fips.rb', line 76 def fip_release(params = {}) path = '/fips/release' query = {} query[:ip] = params[:ip] if params.key?(:ip) Hyperb::Request.new(self, path, query, 'post').perform end |
#fips_ls(params = {}) ⇒ Object
list floating ips
60 61 62 63 64 65 |
# File 'lib/hyperb/network/fips.rb', line 60 def fips_ls(params = {}) path = '/fips' query = {} query[:filters] = params[:filters] if params.key?(:filters) downcase_symbolize(JSON.parse(Hyperb::Request.new(self, path, query, 'get').perform)) end |