Search in sources :

Example 1 with CreateSSHKeyPairResponse

use of org.apache.cloudstack.api.response.CreateSSHKeyPairResponse in project cloudstack by apache.

the class CreateSSHKeyPairCmd method execute.

@Override
public void execute() {
    SSHKeyPair r = _mgr.createSSHKeyPair(this);
    CreateSSHKeyPairResponse response = (CreateSSHKeyPairResponse) _responseGenerator.createSSHKeyPairResponse(r, true);
    response.setResponseName(getCommandName());
    response.setObjectName("keypair");
    setResponseObject(response);
}
Also used : SSHKeyPair(com.cloud.user.SSHKeyPair) CreateSSHKeyPairResponse(org.apache.cloudstack.api.response.CreateSSHKeyPairResponse)

Example 2 with CreateSSHKeyPairResponse

use of org.apache.cloudstack.api.response.CreateSSHKeyPairResponse in project cloudstack by apache.

the class ApiResponseHelper method createSSHKeyPairResponse.

@Override
public SSHKeyPairResponse createSSHKeyPairResponse(SSHKeyPair sshkeyPair, boolean privatekey) {
    SSHKeyPairResponse response = new SSHKeyPairResponse(sshkeyPair.getUuid(), sshkeyPair.getName(), sshkeyPair.getFingerprint());
    if (privatekey) {
        response = new CreateSSHKeyPairResponse(sshkeyPair.getUuid(), sshkeyPair.getName(), sshkeyPair.getFingerprint(), sshkeyPair.getPrivateKey());
    }
    Account account = ApiDBUtils.findAccountById(sshkeyPair.getAccountId());
    response.setAccountName(account.getAccountName());
    Domain domain = ApiDBUtils.findDomainById(sshkeyPair.getDomainId());
    response.setDomainId(domain.getUuid());
    response.setDomainName(domain.getName());
    response.setHasAnnotation(annotationDao.hasAnnotations(sshkeyPair.getUuid(), AnnotationService.EntityType.SSH_KEYPAIR.name(), _accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));
    return response;
}
Also used : CreateSSHKeyPairResponse(org.apache.cloudstack.api.response.CreateSSHKeyPairResponse) SSHKeyPairResponse(org.apache.cloudstack.api.response.SSHKeyPairResponse) ProjectAccount(com.cloud.projects.ProjectAccount) UserAccount(com.cloud.user.UserAccount) Account(com.cloud.user.Account) CreateSSHKeyPairResponse(org.apache.cloudstack.api.response.CreateSSHKeyPairResponse) Domain(com.cloud.domain.Domain)

Aggregations

CreateSSHKeyPairResponse (org.apache.cloudstack.api.response.CreateSSHKeyPairResponse)2 Domain (com.cloud.domain.Domain)1 ProjectAccount (com.cloud.projects.ProjectAccount)1 Account (com.cloud.user.Account)1 SSHKeyPair (com.cloud.user.SSHKeyPair)1 UserAccount (com.cloud.user.UserAccount)1 SSHKeyPairResponse (org.apache.cloudstack.api.response.SSHKeyPairResponse)1