* @param request
* @return
*/
public EC2SSHKeyPair createKeyPair(EC2CreateKeyPair request) {
try {
CloudStackKeyPair resp = getApi().createSSHKeyPair(request.getKeyName(), null, null);
if (resp == null) {
throw new Exception("Ivalid CloudStack API response");
}
EC2SSHKeyPair response = new EC2SSHKeyPair();
response.setFingerprint(resp.getFingerprint());
response.setKeyName(resp.getName());
response.setPrivateKey(resp.getPrivatekey());
return response;
} catch (Exception e) {
logger.error("EC2 CreateKeyPair - ", e);
throw new EC2ServiceException(ServerError.InternalError, e.getMessage());