2013-03-04 06:39:57 -05:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class DigitalOcean
|
|
|
|
class Real
|
|
|
|
|
|
|
|
def create_ssh_key( name, pub_key )
|
|
|
|
request(
|
|
|
|
:expects => [200],
|
|
|
|
:method => 'GET',
|
2013-03-18 10:22:21 -04:00
|
|
|
:path => 'ssh_keys/new',
|
2013-03-04 06:39:57 -05:00
|
|
|
:query => { 'name' => name, 'ssh_pub_key' => pub_key }
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
|
|
|
def create_ssh_key( name, pub_key )
|
2013-03-18 07:48:27 -04:00
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
mock_data = {
|
|
|
|
"id" => Fog::Mock.random_numbers(1).to_i,
|
|
|
|
"name" => name,
|
|
|
|
"ssh_pub_key" => pub_key
|
|
|
|
}
|
|
|
|
response.body = {
|
|
|
|
"status" => "OK",
|
|
|
|
"ssh_key" => mock_data
|
|
|
|
}
|
|
|
|
self.data[:ssh_keys] << mock_data
|
|
|
|
response
|
2013-03-04 06:39:57 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|