|
58 | 58 | import org.apache.cloudstack.api.response.ControlledViewEntityResponse; |
59 | 59 | import org.apache.cloudstack.api.response.CounterResponse; |
60 | 60 | import org.apache.cloudstack.api.response.CreateCmdResponse; |
| 61 | +import org.apache.cloudstack.api.response.CreateSSHKeyPairResponse; |
61 | 62 | import org.apache.cloudstack.api.response.DiskOfferingResponse; |
62 | 63 | import org.apache.cloudstack.api.response.DomainResponse; |
63 | 64 | import org.apache.cloudstack.api.response.DomainRouterResponse; |
|
105 | 106 | import org.apache.cloudstack.api.response.ResourceCountResponse; |
106 | 107 | import org.apache.cloudstack.api.response.ResourceLimitResponse; |
107 | 108 | import org.apache.cloudstack.api.response.ResourceTagResponse; |
| 109 | +import org.apache.cloudstack.api.response.SSHKeyPairResponse; |
108 | 110 | import org.apache.cloudstack.api.response.SecurityGroupResponse; |
109 | 111 | import org.apache.cloudstack.api.response.SecurityGroupRuleResponse; |
110 | 112 | import org.apache.cloudstack.api.response.ServiceOfferingResponse; |
|
291 | 293 | import com.cloud.template.VirtualMachineTemplate; |
292 | 294 | import com.cloud.user.Account; |
293 | 295 | import com.cloud.user.AccountManager; |
| 296 | +import com.cloud.user.SSHKeyPair; |
294 | 297 | import com.cloud.user.User; |
295 | 298 | import com.cloud.user.UserAccount; |
296 | 299 | import com.cloud.uservm.UserVm; |
@@ -3654,4 +3657,17 @@ public ListResponse<UpgradeRouterTemplateResponse> createUpgradeRouterTemplateRe |
3654 | 3657 | return response; |
3655 | 3658 | } |
3656 | 3659 |
|
| 3660 | + @Override |
| 3661 | + public SSHKeyPairResponse createSSHKeyPairResponse(SSHKeyPair sshkeyPair, boolean privatekey) { |
| 3662 | + SSHKeyPairResponse response = new SSHKeyPairResponse(sshkeyPair.getName(), sshkeyPair.getFingerprint()); |
| 3663 | + if (privatekey) { |
| 3664 | + response = new CreateSSHKeyPairResponse(sshkeyPair.getName(), sshkeyPair.getFingerprint(), sshkeyPair.getPrivateKey()); |
| 3665 | + } |
| 3666 | + Account account = ApiDBUtils.findAccountById(sshkeyPair.getAccountId()); |
| 3667 | + response.setAccountName(account.getAccountName()); |
| 3668 | + Domain domain = ApiDBUtils.findDomainById(sshkeyPair.getDomainId()); |
| 3669 | + response.setDomainId(domain.getUuid()); |
| 3670 | + response.setDomainName(domain.getName()); |
| 3671 | + return response; |
| 3672 | + } |
3657 | 3673 | } |
0 commit comments