module Hyperb::Network

network api wrapper

Public Instance Methods

fip_allocate(params = {}) click to toggle source

allocate a new floating ip

@see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Network/fip_allocate.html

@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid.

@return [Array] Array of ips (string).

@param params [Hash] A customizable set of params. @option params [String] :count the number of free fips to allocate

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

attach a floating ip to a container

@see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Network/fip_attach.html

@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid. @raise [Hyperb::Error::NotFound] raised when ip are not found.

@param params [Hash] A customizable set of params. @option params [String] :ip @option params [String] :container

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

detach a floating ip from a container

@see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Network/fip_detach.html

@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid. @raise [Hyperb::Error::NotFound] raised when container is found.

@param params [Hash] A customizable set of params. @option params [String] :container container name/id

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

set a name for floating ip

@see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Network/fip_name.html

@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid. @raise [Hyperb::Error::NotFound] raised when fip is not found @raise [Hyperb::Error::Conflict] raised when name already exists @raise [Hyperb::Error::InternalServerError] raised when server returns 5xx

@param params [Hash] A customizable set of params. @option params [String] :ip fip @option params [String] :name the name

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

release a floating ip

@see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Network/fip_release.html

@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid. @raise [Hyperb::Error::NotFound] raised when ips are not found.

@param params [Hash] A customizable set of params. @option params [String] :ip the number of free fips to allocate

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

list floating ips

@see docs.hyper.sh/Reference/API/2016-04-04%20[Ver.%201.23]/Network/fip_ls.html

@raise [Hyperb::Error::Unauthorized] raised when credentials are not valid. @raise [Hyperb::Error::NotFound] raised when ips are not found.

@returns [Array] array of downcased symbolized has

@param params [Hash] A customizable set of params. @option params [String] :filters

# 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