# File lib/fog/bluebox/blb.rb, line 45 def initialize(options={}) @bluebox_api_key = options[:bluebox_api_key] @bluebox_customer_id = options[:bluebox_customer_id] @connection_options = options[:connection_options] || {} @host = options[:bluebox_host] || "boxpanel.bluebox.net" @persistent = options[:persistent] || false @port = options[:bluebox_port] || 443 @scheme = options[:bluebox_scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
Add machine to default lb_backend for each lb_service in the application.
lb_application_id<~String> - ID of application
lb_machine_id<~String> - ID of machine
options<~Hash>:
port<~Integer> - port machine listens on; defaults to service listening port
maxconn<~Integer> - maximum number of connections server can be sent
backup<~Boolean> - only send traffic to machine if all others are down
# File lib/fog/bluebox/requests/blb/add_machine_to_lb_application.rb, line 16 def add_machine_to_lb_application(lb_application_id, lb_machine_id, options = {}) # convert to CGI array args body = Hash[options.map {|k,v| ["lb_options[#{k}]", v] }] body['lb_machine'] = lb_machine_id request( :expects => 200, :method => 'POST', :path => "/api/lb_applications/add_machine/#{lb_application_id}.json", :body => body.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}"}.join('&') ) end
Add machine to specified lb_backend
lb_backend_id<~String> - ID of backend
lb_machine_id<~String> - ID of machine
options<~Hash>:
port<~Integer> - port machine listens on; defaults to service listening port
maxconn<~Integer> - maximum number of connections server can be sent
backup<~Boolean> - only send traffic to machine if all others are down
# File lib/fog/bluebox/requests/blb/add_machine_to_lb_backend.rb, line 14 def add_machine_to_lb_backend(lb_backend_id, lb_machine_id, options = {}) # convert to CGI array args body = Hash[options.map {|k,v| ["lb_options[#{k}]", v] }] body['lb_machine'] = lb_machine_id request( :expects => 200, :method => 'POST', :path => "/api/lb_backends/#{lb_backend_id}/lb_machines.json", :body => body.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}"}.join('&') ) end
Get details of an lb_application.
lb_application_id<~Integer> - ID of application
response<~Excon::Response>:
body<~Hash>:
'id'<~String> - UUID of application
'ip_v4'<~Array> - IPv4 addresses
'ip_v6'<~String> - IPv6 address
'name'<~String> - The hostname
'lb_services'<~Array> - Listening services
'source_ip_v4'<~String> - address that application connects to pool members from (v1 only)
# File lib/fog/bluebox/requests/blb/get_lb_application.rb, line 19 def get_lb_application(lb_application_id) request( :expects => 200, :method => 'GET', :path => "api/lb_applications/#{lb_application_id}.json" ) end
Get list of applications
response<~Excon::Response>:
body<~Array>:
'application'<~Hash>:
'id'<~String> - UUID of application
'ip_v4'<~Array> - IPv4 addresses
'ip_v6'<~String> - IPv6 address
'name'<~String> - The hostname
'lb_services'<~Array> - Listening services
'source_ip_v4'<~String> - address that application connects to pool members from (v1 only)
# File lib/fog/bluebox/requests/blb/get_lb_applications.rb, line 17 def get_lb_applications request( :expects => 200, :method => 'GET', :path => 'api/lb_applications.json' ) end
Get details of an lb_backend.
lb_service_id<~String> - service backend belongs to
lb_backend_id<~String> - backend to look up
response<~Excon::Response>:
body<~Hash>:
id<~String> - backend ID
backend_name<~String>
lb_machines<~Array> - array of backend members
acl_name<~String> - name of ACL for this backend
acl_rule<~String>
monitoring_url_hostname<~String> - HTTP host header for health check
monitoring_url<~String> - URL for health check
check_interval<~Integer> - time between checks, in milliseconds
# File lib/fog/bluebox/requests/blb/get_lb_backend.rb, line 22 def get_lb_backend(lb_service_id, lb_backend_id) request( :expects => 200, :method => 'GET', :path => "api/lb_services/#{lb_service_id}/lb_backends/#{lb_backend_id}.json" ) end
Get list of backends
lb_service_id<~String> - service containing backends
response<~Excon::Response>:
body<~Array>:
backend<~Hash>:
id<~String> - backend ID
backend_name<~String>
lb_machines<~Array> - array of backend members
acl_name<~String> - name of ACL for this backend
acl_rule<~String>
monitoring_url_hostname<~String> - HTTP host header for health check
monitoring_url<~String> - URL for health check
check_interval<~Integer> - time between checks, in milliseconds
# File lib/fog/bluebox/requests/blb/get_lb_backends.rb, line 22 def get_lb_backends(lb_service_id) request( :expects => 200, :method => 'GET', :path => "api/lb_services/#{lb_service_id}/lb_backends.json" ) end
Get details of an lb_machine.
lb_backend_id<~String> - backend machine belongs to
lb_machine_id<~String> - machine to look up
response<~Excon::Response>:
body<~Hash>:
id<~String> - machine ID
ip<~String> - machine IP address for this member (v4 or v6)
port<~Integer> - service port for this member
hostname<~String> - name as registered with Box Panel
acl_name<~String> - name of ACL for this machine
created<~DateTime> - when machine was added to load balancer backend
maxconn<~Integer> - maximum concurrent connections for this member (BLBv2 only)
# File lib/fog/bluebox/requests/blb/get_lb_machine.rb, line 21 def get_lb_machine(lb_backend_id, lb_machine_id) request( :expects => 200, :method => 'GET', :path => "api/lb_backends/#{lb_backend_id}/lb_machines/#{lb_machine_id}.json" ) end
Get list of machines
lb_backend_id<~String> - backend containing machines
response<~Excon::Response>:
body<~Array>:
machine<~Hash>:
id<~String> - machine ID
ip<~String> - machine IP address for this member (v4 or v6)
port<~Integer> - service port for this member
hostname<~String> - name as registered with Box Panel
acl_name<~String> - name of ACL for this machine
created<~DateTime> - when machine was added to load balancer backend
maxconn<~Integer> - maximum concurrent connections for this member (BLBv2 only)
# File lib/fog/bluebox/requests/blb/get_lb_machines.rb, line 21 def get_lb_machines(lb_backend_id) request( :expects => 200, :method => 'GET', :path => "api/lb_backends/#{lb_backend_id}/lb_machines.json" ) end
Get details of a lb_service.
lb_application_id<~String> - ID of application the service belongs to
lb_service_id<~String> - ID of service to look up
response<~Excon::Response>:
body<~Hash>:
name<~String> - service name
port<~Integer> - port of load balanced service
private<~Boolean> - whether service is only available internally
status_username<~String> - HTTP basic auth username
status_password<~String> - HTTP basic auth password
status_url<~String> - URL of stats page
service_type<~String> - proto being load balanced (e.g. 'http', 'tcp')
created<~DateTime> - when service was created
# File lib/fog/bluebox/requests/blb/get_lb_service.rb, line 22 def get_lb_service(lb_application_id, lb_service_id) request( :expects => 200, :method => 'GET', :path => "api/lb_applications/#{lb_application_id}/lb_services/#{lb_service_id}.json", ) end
Get list of load balancing services
lb_application_id<~String> - Id of application services to list
response<~Excon::Response>:
body<~Array>:
backend<~Hash>:
name<~String> - service name
port<~Integer> - port of load balanced service
private<~Boolean> - whether service is only available internally
status_username<~String> - HTTP basic auth username
status_password<~String> - HTTP basic auth password
status_url<~String> - URL of stats page
service_type<~String> - proto being load balanced (e.g. 'http', 'tcp')
created<~DateTime> - when service was created
# File lib/fog/bluebox/requests/blb/get_lb_services.rb, line 22 def get_lb_services(lb_application_id) request( :expects => 200, :method => 'GET', :path => "api/lb_applications/#{lb_application_id}/lb_services.json" ) end
# File lib/fog/bluebox/blb.rb, line 56 def reload @connection.reset end
remove machine from single backend
lb_backend_id<~String> - ID of backend
lb_machine_id<~String> - ID of machine
response<~Excon::Response>:
body<~String> - success or failure message
# File lib/fog/bluebox/requests/blb/remove_machine_from_lb_backend.rb, line 14 def remove_machine_from_lb_backend(lb_backend_id, lb_machine_id) request( :expects => 200, :method => 'DELETE', :path => "/api/lb_backends/#{lb_backend_id}/lb_machines/#{lb_machine_id}", :headers => {"Accept" => "text/plain"}, ) end
# File lib/fog/bluebox/blb.rb, line 60 def request(params) params[:headers] ||= {} params[:headers].merge!({ 'Authorization' => "Basic #{Base64.encode64([@bluebox_customer_id, @bluebox_api_key].join(':')).delete("\r\n")}" }) begin response = @connection.request(params.merge!({:host => @host})) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::Compute::Bluebox::NotFound.slurp(error) else error end end unless response.body.empty? || params[:headers]['Accept'] == 'text/plain' response.body = Fog::JSON.decode(response.body) end response end
change machine attributes (port &c) in a single backend
lb_backend_id<~String> - ID of backend
lb_machine_id<~String> - ID of machine
options<~Hash>:
port<~Integer> - port machine listens on
maxconn<~Integer> - maximum number of connections server can be sent
backup<~Boolean> - only send traffic to machine if all others are down
# File lib/fog/bluebox/requests/blb/update_lb_backend_machine.rb, line 14 def update_lb_backend_machine(lb_backend_id, lb_machine_id, options = {}) # inconsistent, no? request( :expects => 202, :method => 'PUT', :path => "/api/lb_backends/#{lb_backend_id}/lb_machines/#{lb_machine_id}", :body => options.map {|k,v| "#{CGI.escape(k)}=#{CGI.escape(v.to_s)}"}.join('&') ) end
Generated with the Darkfish Rdoc Generator 2.