# File lib/fog/digitalocean/compute.rb, line 76 def initialize(options={}) @digitalocean_api_key = options[:digitalocean_api_key] @digitalocean_client_id = options[:digitalocean_client_id] @digitalocean_api_url = options[:digitalocean_api_url] || "https://api.digitalocean.com" @connection = Fog::Connection.new(@digitalocean_api_url) end
FIXME: missing ssh keys support
# File lib/fog/digitalocean/requests/compute/create_server.rb, line 9 def create_server( name, size_id, image_id, region_id, options = {} ) query_hash = { :name => name, :size_id => size_id, :image_id => image_id, :region_id => region_id } if options[:ssh_key_ids] query_hash[:ssh_key_ids] = options[:ssh_key_ids] end request( :expects => [200], :method => 'GET', :path => 'droplets/new', :query => query_hash ) end
# File lib/fog/digitalocean/requests/compute/create_ssh_key.rb, line 6 def create_ssh_key( name, pub_key ) request( :expects => [200], :method => 'GET', :path => 'ssh_keys/new', :query => { 'name' => name, 'ssh_pub_key' => pub_key } ) end
FIXME: missing ssh keys support
# File lib/fog/digitalocean/requests/compute/destroy_server.rb, line 9 def destroy_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/destroy" ) end
Delete a SSH public key from your account
@see www.digitalocean.com/api#ssh_keys
# File lib/fog/digitalocean/requests/compute/destroy_ssh_key.rb, line 11 def destroy_ssh_key(id) request( :expects => [200], :method => 'GET', :path => "ssh_keys/#{id}/destroy" ) end
# File lib/fog/digitalocean/requests/compute/get_server_details.rb, line 6 def get_server_details(server_id) request( :expects => [200], :method => 'GET', :path => "droplets/#{server_id}" ) end
This method shows a specific public SSH key in your account that can be added to a droplet.
@see www.digitalocean.com/api#ssh_keys
# File lib/fog/digitalocean/requests/compute/get_ssh_key.rb, line 12 def get_ssh_key(id) request( :expects => [200], :method => 'GET', :path => "ssh_keys/#{id}" ) end
# File lib/fog/digitalocean/requests/compute/list_flavors.rb, line 6 def list_flavors(options = {}) request( :expects => [200], :method => 'GET', :path => 'sizes' ) end
# File lib/fog/digitalocean/requests/compute/list_images.rb, line 6 def list_images(options = {}) request( :expects => [200], :method => 'GET', :path => 'images' ) end
# File lib/fog/digitalocean/requests/compute/list_regions.rb, line 6 def list_regions(options = {}) request( :expects => [200], :method => 'GET', :path => 'regions' ) end
# File lib/fog/digitalocean/requests/compute/list_servers.rb, line 6 def list_servers(options = {}) request( :expects => [200], :method => 'GET', :path => 'droplets' ) end
# File lib/fog/digitalocean/requests/compute/list_ssh_keys.rb, line 6 def list_ssh_keys(options = {}) request( :expects => [200], :method => 'GET', :path => 'ssh_keys' ) end
# File lib/fog/digitalocean/requests/compute/power_cycle_server.rb, line 6 def power_cycle_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/power_cycle" ) end
# File lib/fog/digitalocean/requests/compute/power_off_server.rb, line 6 def power_off_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/power_off" ) end
# File lib/fog/digitalocean/requests/compute/power_on_server.rb, line 6 def power_on_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/power_on" ) end
# File lib/fog/digitalocean/requests/compute/reboot_server.rb, line 6 def reboot_server( id ) request( :expects => [200], :method => 'GET', :path => "droplets/#{id}/reboot" ) end
# File lib/fog/digitalocean/compute.rb, line 84 def reload @connection.reset end
# File lib/fog/digitalocean/compute.rb, line 88 def request(params) params[:query] ||= {} params[:query].merge!(:api_key => @digitalocean_api_key) params[:query].merge!(:client_id => @digitalocean_client_id) response = @connection.request(params) unless response.body.empty? response.body = Fog::JSON.decode(response.body) if response.body['status'] != 'OK' raise Fog::Errors::Error.new response.body.to_s end end response end
Generated with the Darkfish Rdoc Generator 2.