2013-07-17 03:18:27 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class RackspaceV2
|
|
|
|
class Real
|
|
|
|
|
|
|
|
# Requests a new keypair to be created
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * name<~String> - name to give new key
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * keypair<~Hash>:
|
|
|
|
# * 'fingerprint'<~String>:
|
|
|
|
# * 'name'<~String>:
|
|
|
|
# * 'private_key'<~String>:
|
|
|
|
# * 'public_key'<~String>:
|
|
|
|
# * 'user_id'<~String>:
|
|
|
|
def create_keypair(name, public_key=nil)
|
|
|
|
data = {
|
|
|
|
'keypair' => {
|
|
|
|
'name' => name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
request(
|
|
|
|
:method => 'POST',
|
|
|
|
:expects => 200,
|
|
|
|
:path => '/os-keypairs',
|
|
|
|
:body => Fog::JSON.encode(data)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2013-07-19 05:07:47 -04:00
|
|
|
|
|
|
|
class Mock
|
|
|
|
def create_keypair(name, public_key=nil)
|
|
|
|
|
|
|
|
k = self.data[:keypairs][0]
|
|
|
|
k['keypair']['name'] = name
|
|
|
|
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
response.body = k
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-07-17 03:18:27 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|