use of com.cloud.user.SSHKeyPair 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);
}
use of com.cloud.user.SSHKeyPair in project cosmic by MissionCriticalCloud.
the class CreateSSHKeyPairCmd method execute.
@Override
public void execute() {
final SSHKeyPair r = _mgr.createSSHKeyPair(this);
final CreateSSHKeyPairResponse response = (CreateSSHKeyPairResponse) _responseGenerator.createSSHKeyPairResponse(r, true);
response.setResponseName(getCommandName());
response.setObjectName("keypair");
setResponseObject(response);
}
use of com.cloud.user.SSHKeyPair in project cosmic by MissionCriticalCloud.
the class RegisterSSHKeyPairCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final SSHKeyPair result = _mgr.registerSSHKeyPair(this);
final SSHKeyPairResponse response = _responseGenerator.createSSHKeyPairResponse(result, false);
response.setResponseName(getCommandName());
response.setObjectName("keypair");
setResponseObject(response);
}
use of com.cloud.user.SSHKeyPair in project CloudStack-archive by CloudStack-extras.
the class ListSSHKeyPairsCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
List<? extends SSHKeyPair> resultList = _mgr.listSSHKeyPairs(this);
List<SSHKeyPairResponse> responses = new ArrayList<SSHKeyPairResponse>();
for (SSHKeyPair result : resultList) {
SSHKeyPairResponse r = new SSHKeyPairResponse(result.getName(), result.getFingerprint());
r.setObjectName("sshkeypair");
responses.add(r);
}
ListResponse<SSHKeyPairResponse> response = new ListResponse<SSHKeyPairResponse>();
response.setResponses(responses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.user.SSHKeyPair in project cosmic by MissionCriticalCloud.
the class ManagementServerImpl method listSSHKeyPairs.
@Override
public Pair<List<? extends SSHKeyPair>, Integer> listSSHKeyPairs(final ListSSHKeyPairsCmd cmd) {
final String name = cmd.getName();
final String fingerPrint = cmd.getFingerprint();
final Account caller = getCaller();
final List<Long> permittedAccounts = new ArrayList<>();
final Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<>(cmd.getDomainId(), cmd.isRecursive(), null);
_accountMgr.buildACLSearchParameters(caller, null, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, cmd.listAll(), false);
final Long domainId = domainIdRecursiveListProject.first();
final Boolean isRecursive = domainIdRecursiveListProject.second();
final ListProjectResourcesCriteria listProjectResourcesCriteria = domainIdRecursiveListProject.third();
final SearchBuilder<SSHKeyPairVO> sb = _sshKeyPairDao.createSearchBuilder();
_accountMgr.buildACLSearchBuilder(sb, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
final Filter searchFilter = new Filter(SSHKeyPairVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
final SearchCriteria<SSHKeyPairVO> sc = sb.create();
_accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
if (name != null) {
sc.addAnd("name", SearchCriteria.Op.EQ, name);
}
if (fingerPrint != null) {
sc.addAnd("fingerprint", SearchCriteria.Op.EQ, fingerPrint);
}
final Pair<List<SSHKeyPairVO>, Integer> result = _sshKeyPairDao.searchAndCount(sc, searchFilter);
return new Pair<>(result.first(), result.second());
}
Aggregations