1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #1383: Client functions to deal with keypairs

This commit is contained in:
Ruben S. Montero 2012-09-25 23:14:36 +02:00
parent dc5b09d22f
commit 54eafbefdc

View File

@ -444,5 +444,61 @@ module EC2QueryClient
return response
end
######################################################################
# Lists available key pairs
# @param name[String] of the kaypair
# @return keypairs[Hash]
# {"xmlns"=>"http://ec2.amazonaws.com/doc/2010-08-31/",
# "keySet"=>{"item"=>[
# {"keyName"=>"...", "keyFingerprint"=>"..."}]}}
######################################################################
def describe_keypairs()
begin
response = @ec2_connection.describe_keypairs
rescue Exception => e
error = CloudClient::Error.new(e.message)
return error
end
return response
end
######################################################################
# Creates a new key pair
# @param name[String] of the kaypair
# @return keypair[Hash]
# {"xmlns"=>"http://ec2.amazonaws.com/doc/2010-08-31/",
# "keySet"=>{"item"=>[
# {"keyName"=>"...", "keyFingerprint"=>"..."}]}}
######################################################################
def create_keypair(name)
begin
response = @ec2_connection.create_keypair(:key_name => name)
rescue Exception => e
error = CloudClient::Error.new(e.message)
return error
end
return response
end
######################################################################
# Deletes a new key pair
# @param name[String] of the kaypair
# @return response[Hash]
# {"xmlns"=>"http://ec2.amazonaws.com/doc/2010-08-31/",
# "return"=>{"true/false"}
######################################################################
def delete_keypair(name)
begin
response = @ec2_connection.delete_keypair(:key_name => name)
rescue Exception => e
error = CloudClient::Error.new(e.message)
return error
end
return response
end
end
end