Search in sources :

Example 6 with SSHKeyPairResponse

use of com.cloud.api.response.SSHKeyPairResponse in project cosmic by MissionCriticalCloud.

the class ListSSHKeyPairsCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final Pair<List<? extends SSHKeyPair>, Integer> resultList = _mgr.listSSHKeyPairs(this);
    final List<SSHKeyPairResponse> responses = new ArrayList<>();
    for (final SSHKeyPair result : resultList.first()) {
        final SSHKeyPairResponse r = _responseGenerator.createSSHKeyPairResponse(result, false);
        r.setObjectName("sshkeypair");
        responses.add(r);
    }
    final ListResponse<SSHKeyPairResponse> response = new ListResponse<>();
    response.setResponses(responses, resultList.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : SSHKeyPairResponse(com.cloud.api.response.SSHKeyPairResponse) SSHKeyPair(com.cloud.user.SSHKeyPair) ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

SSHKeyPairResponse (com.cloud.api.response.SSHKeyPairResponse)6 SSHKeyPair (com.cloud.user.SSHKeyPair)5 ListResponse (com.cloud.api.response.ListResponse)2 ArrayList (java.util.ArrayList)2 CreateSSHKeyPairResponse (com.cloud.api.response.CreateSSHKeyPairResponse)1 Domain (com.cloud.domain.Domain)1 Account (com.cloud.user.Account)1 UserAccount (com.cloud.user.UserAccount)1 List (java.util.List)1