In Files

Parent

Files

Class/Module Index [+]

Quicksearch

Fog::Compute::Brightbox::Real

Public Class Methods

new(options) click to toggle source
# File lib/fog/compute/brightbox.rb, line 90
def initialize(options)
  require 'multi_json'
  # Currently authentication and api endpoints are the same but may change
  @auth_url = options[:brightbox_auth_url] || Fog.credentials[:brightbox_auth_url] || API_URL
  @api_url = options[:brightbox_api_url] || Fog.credentials[:brightbox_api_url] || API_URL
  @brightbox_client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id]
  @brightbox_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret]
  @connection = Fog::Connection.new(@api_url)
end

Public Instance Methods

account() click to toggle source
# File lib/fog/compute/brightbox.rb, line 113
def account
  Fog::Compute::Brightbox::Account.new(get_account)
end
activate_console_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/activate_console_server.rb, line 6
def activate_console_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers/#{identifier}/activate_console",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
add_listeners_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb, line 6
def add_listeners_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/load_balancers/#{identifier}/add_listeners",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
add_nodes_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/add_nodes_load_balancer.rb, line 6
def add_nodes_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/load_balancers/#{identifier}/add_nodes",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
create_api_client(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/create_api_client.rb, line 6
def create_api_client(options = {})
  request(
    :expects  => [201],
    :method   => 'POST',
    :path     => "/1.0/api_clients",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
create_cloud_ip(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/create_cloud_ip.rb, line 6
def create_cloud_ip(options = {})
  request(
    :expects  => [201],
    :method   => 'POST',
    :path     => "/1.0/cloud_ips",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
create_image(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/create_image.rb, line 6
def create_image(options = {})
  request(
    :expects  => [201],
    :method   => 'POST',
    :path     => "/1.0/images",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
create_load_balancer(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/create_load_balancer.rb, line 6
def create_load_balancer(options = {})
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/load_balancers",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
create_server(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/create_server.rb, line 6
def create_server(options = {})
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
destroy_api_client(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/destroy_api_client.rb, line 6
def destroy_api_client(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'DELETE',
    :path     => "/1.0/api_clients/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
destroy_cloud_ip(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/destroy_cloud_ip.rb, line 6
def destroy_cloud_ip(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'DELETE',
    :path     => "/1.0/cloud_ips/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
destroy_image(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/destroy_image.rb, line 6
def destroy_image(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'DELETE',
    :path     => "/1.0/images/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
destroy_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/destroy_load_balancer.rb, line 6
def destroy_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'DELETE',
    :path     => "/1.0/load_balancers/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
destroy_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/destroy_server.rb, line 6
def destroy_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'DELETE',
    :path     => "/1.0/servers/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_account(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_account.rb, line 6
def get_account(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/account",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_api_client(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_api_client.rb, line 6
def get_api_client(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/api_clients/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_cloud_ip(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_cloud_ip.rb, line 6
def get_cloud_ip(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/cloud_ips/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_image(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_image.rb, line 6
def get_image(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/images/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_interface(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_interface.rb, line 6
def get_interface(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/interfaces/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_load_balancer.rb, line 6
def get_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/load_balancers/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_server.rb, line 6
def get_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/servers/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_server_type(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_server_type.rb, line 6
def get_server_type(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/server_types/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_user(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_user.rb, line 6
def get_user(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/users/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
get_zone(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/get_zone.rb, line 6
def get_zone(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/zones/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_api_clients(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_api_clients.rb, line 6
def list_api_clients(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/api_clients",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_cloud_ips(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_cloud_ips.rb, line 6
def list_cloud_ips(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/cloud_ips",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_images(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_images.rb, line 6
def list_images(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/images",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_load_balancers(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_load_balancers.rb, line 6
def list_load_balancers(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/load_balancers",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_server_types(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_server_types.rb, line 6
def list_server_types(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/server_types",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_servers(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_servers.rb, line 6
def list_servers(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/servers",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_users(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_users.rb, line 6
def list_users(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/users",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
list_zones(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/list_zones.rb, line 6
def list_zones(options = {})
  request(
    :expects  => [200],
    :method   => 'GET',
    :path     => "/1.0/zones",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
map_cloud_ip(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/map_cloud_ip.rb, line 6
def map_cloud_ip(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/cloud_ips/#{identifier}/map",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
remove_listeners_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb, line 6
def remove_listeners_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/load_balancers/#{identifier}/remove_listeners",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
remove_nodes_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/remove_nodes_load_balancer.rb, line 6
def remove_nodes_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/load_balancers/#{identifier}/remove_nodes",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
request(params) click to toggle source
# File lib/fog/compute/brightbox.rb, line 100
def request(params)
  begin
    get_oauth_token if @oauth_token.nil?
    response = authenticated_request(params)
  rescue Excon::Errors::Unauthorized => e
    get_oauth_token
    response = authenticated_request(params)
  end
  unless response.body.empty?
    response = MultiJson.decode(response.body)
  end
end
reset_ftp_password_account(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/reset_ftp_password_account.rb, line 6
def reset_ftp_password_account(options = {})
  request(
    :expects  => [200],
    :method   => 'POST',
    :path     => "/1.0/account/reset_ftp_password",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
resize_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/resize_server.rb, line 6
def resize_server(identifier, options = {})
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers/#{identifier}/resize",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
shutdown_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/shutdown_server.rb, line 6
def shutdown_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers/#{identifier}/shutdown",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
snapshot_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/snapshot_server.rb, line 6
def snapshot_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers/#{identifier}/snapshot",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
start_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/start_server.rb, line 6
def start_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers/#{identifier}/start",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
stop_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/stop_server.rb, line 6
def stop_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/servers/#{identifier}/stop",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
unmap_cloud_ip(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/unmap_cloud_ip.rb, line 6
def unmap_cloud_ip(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => "/1.0/cloud_ips/#{identifier}/unmap",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
update_account(options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/update_account.rb, line 6
def update_account(options = {})
  return nil if options.empty? || options.nil?
  request(
    :expects  => [200],
    :method   => 'PUT',
    :path     => "/1.0/account",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
update_api_client(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/update_api_client.rb, line 6
def update_api_client(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  return nil if options.empty? || options.nil?
  request(
    :expects  => [200],
    :method   => 'PUT',
    :path     => "/1.0/api_clients/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
update_image(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/update_image.rb, line 6
def update_image(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  return nil if options.empty? || options.nil?
  request(
    :expects  => [200],
    :method   => 'PUT',
    :path     => "/1.0/images/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
update_load_balancer(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/update_load_balancer.rb, line 6
def update_load_balancer(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  return nil if options.empty? || options.nil?
  request(
    :expects  => [202],
    :method   => 'PUT',
    :path     => "/1.0/load_balancers/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
update_server(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/update_server.rb, line 6
def update_server(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  return nil if options.empty? || options.nil?
  request(
    :expects  => [200],
    :method   => 'PUT',
    :path     => "/1.0/servers/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end
update_user(identifier, options = {}) click to toggle source
# File lib/fog/compute/requests/brightbox/update_user.rb, line 6
def update_user(identifier, options = {})
  return nil if identifier.nil? || identifier == ""
  return nil if options.empty? || options.nil?
  request(
    :expects  => [200],
    :method   => 'PUT',
    :path     => "/1.0/users/#{identifier}",
    :headers  => {"Content-Type" => "application/json"},
    :body     => MultiJson.encode(options)
  )
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.