1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/requests/compute_v2/create_keypair.rb
2013-07-23 09:42:25 +02:00

36 lines
870 B
Ruby

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
end
end
end