2013-03-25 21:56:29 +01:00
|
|
|
module Fog
|
|
|
|
module Compute
|
2014-02-19 12:30:59 +00:00
|
|
|
class DigitalOcean
|
2013-03-25 21:56:29 +01:00
|
|
|
class Real
|
|
|
|
#
|
|
|
|
# This method shows a specific public SSH key in your account
|
|
|
|
# that can be added to a droplet.
|
|
|
|
#
|
2014-06-19 07:25:26 -07:00
|
|
|
# @see https://www.developers.digitalocean.com/ssh-keys
|
2013-03-25 21:56:29 +01:00
|
|
|
#
|
|
|
|
def get_ssh_key(id)
|
|
|
|
request(
|
|
|
|
:expects => [200],
|
|
|
|
:method => 'GET',
|
|
|
|
:path => "ssh_keys/#{id}"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
def get_ssh_key(id)
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
response.body = {
|
|
|
|
"status" => "OK",
|
|
|
|
# key listing does not return ssh_pub_key
|
2014-06-19 07:25:26 -07:00
|
|
|
# https://www.developers.digitalocean.com/ssh-keys
|
2013-03-25 21:56:29 +01:00
|
|
|
"ssh_key" => self.data[:ssh_keys].find { |k| k['id'] == id }
|
|
|
|
}
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|