use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListVPCOfferingsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
Pair<List<? extends VpcOffering>, Integer> offerings = _vpcProvSvc.listVpcOfferings(this);
ListResponse<VpcOfferingResponse> response = new ListResponse<VpcOfferingResponse>();
List<VpcOfferingResponse> offeringResponses = new ArrayList<VpcOfferingResponse>();
for (VpcOffering offering : offerings.first()) {
VpcOfferingResponse offeringResponse = _responseGenerator.createVpcOfferingResponse(offering);
offeringResponses.add(offeringResponse);
}
response.setResponses(offeringResponses, offerings.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListVpnUsersCmd method execute.
@Override
public void execute() {
Pair<List<? extends VpnUser>, Integer> vpnUsers = _ravService.searchForVpnUsers(this);
ListResponse<VpnUsersResponse> response = new ListResponse<VpnUsersResponse>();
List<VpnUsersResponse> vpnResponses = new ArrayList<VpnUsersResponse>();
for (VpnUser vpnUser : vpnUsers.first()) {
vpnResponses.add(_responseGenerator.createVpnUserResponse(vpnUser));
}
response.setResponses(vpnResponses, vpnUsers.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListLunsCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
List<LunVO> lunList = netappMgr.listLunsOnFiler(poolName);
ListResponse<ListLunsCmdResponse> listResponse = new ListResponse<ListLunsCmdResponse>();
List<ListLunsCmdResponse> responses = new ArrayList<ListLunsCmdResponse>();
for (LunVO lun : lunList) {
ListLunsCmdResponse response = new ListLunsCmdResponse();
response.setId(lun.getId());
response.setIqn(lun.getTargetIqn());
response.setName(lun.getLunName());
response.setVolumeId(lun.getVolumeId());
response.setObjectName("lun");
responses.add(response);
}
listResponse.setResponses(responses);
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
}
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListVolumePoolsCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
List<PoolVO> poolList = netappMgr.listPools();
ListResponse<ListVolumePoolsCmdResponse> listResponse = new ListResponse<ListVolumePoolsCmdResponse>();
List<ListVolumePoolsCmdResponse> responses = new ArrayList<ListVolumePoolsCmdResponse>();
for (PoolVO pool : poolList) {
ListVolumePoolsCmdResponse response = new ListVolumePoolsCmdResponse();
response.setId(pool.getId());
response.setName(pool.getName());
response.setAlgorithm(pool.getAlgorithm());
response.setObjectName("pool");
responses.add(response);
}
listResponse.setResponses(responses);
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
}
}
use of org.apache.cloudstack.api.response.ListResponse in project cloudstack by apache.
the class ListVPCsCmdByAdmin method execute.
@Override
public void execute() {
Pair<List<? extends Vpc>, Integer> vpcs = _vpcService.listVpcs(getId(), getVpcName(), getDisplayText(), getSupportedServices(), getCidr(), getVpcOffId(), getState(), getAccountName(), getDomainId(), getKeyword(), getStartIndex(), getPageSizeVal(), getZoneId(), isRecursive(), listAll(), getRestartRequired(), getTags(), getProjectId(), getDisplay());
ListResponse<VpcResponse> response = new ListResponse<VpcResponse>();
List<VpcResponse> vpcResponses = new ArrayList<VpcResponse>();
for (Vpc vpc : vpcs.first()) {
VpcResponse offeringResponse = _responseGenerator.createVpcResponse(ResponseView.Full, vpc);
vpcResponses.add(offeringResponse);
}
response.setResponses(vpcResponses, vpcs.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations