use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class ListVPCOfferingsCmd method execute.
@Override
public void execute() {
final Pair<List<? extends VpcOffering>, Integer> offerings = _vpcProvSvc.listVpcOfferings(getId(), getVpcOffName(), getDisplayText(), getSupportedServices(), isDefault, this.getKeyword(), getState(), this.getStartIndex(), this.getPageSizeVal());
final ListResponse<VpcOfferingResponse> response = new ListResponse<>();
final List<VpcOfferingResponse> offeringResponses = new ArrayList<>();
for (final VpcOffering offering : offerings.first()) {
final VpcOfferingResponse offeringResponse = _responseGenerator.createVpcOfferingResponse(offering);
offeringResponses.add(offeringResponse);
}
response.setResponses(offeringResponses, offerings.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class ListVPCsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final 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());
final ListResponse<VpcResponse> response = new ListResponse<>();
final List<VpcResponse> vpcResponses = new ArrayList<>();
for (final Vpc vpc : vpcs.first()) {
final VpcResponse offeringResponse = _responseGenerator.createVpcResponse(ResponseView.Restricted, vpc);
vpcResponses.add(offeringResponse);
}
response.setResponses(vpcResponses, vpcs.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class ListVMSnapshotCmd method execute.
@Override
public void execute() {
final List<? extends VMSnapshot> result = _vmSnapshotService.listVMSnapshots(this);
final ListResponse<VMSnapshotResponse> response = new ListResponse<>();
final List<VMSnapshotResponse> snapshotResponses = new ArrayList<>();
for (final VMSnapshot r : result) {
final VMSnapshotResponse vmSnapshotResponse = _responseGenerator.createVMSnapshotResponse(r);
vmSnapshotResponse.setObjectName("vmSnapshot");
snapshotResponses.add(vmSnapshotResponse);
}
response.setResponses(snapshotResponses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class ListVpnCustomerGatewaysCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
final Pair<List<? extends Site2SiteCustomerGateway>, Integer> gws = _s2sVpnService.searchForCustomerGateways(this);
final ListResponse<Site2SiteCustomerGatewayResponse> response = new ListResponse<>();
final List<Site2SiteCustomerGatewayResponse> gwResponses = new ArrayList<>();
for (final Site2SiteCustomerGateway gw : gws.first()) {
if (gw == null) {
continue;
}
final Site2SiteCustomerGatewayResponse site2SiteCustomerGatewayRes = _responseGenerator.createSite2SiteCustomerGatewayResponse(gw);
site2SiteCustomerGatewayRes.setObjectName("vpncustomergateway");
gwResponses.add(site2SiteCustomerGatewayRes);
}
response.setResponses(gwResponses, gws.second());
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.ListResponse in project cosmic by MissionCriticalCloud.
the class ListUsersCmdTest method testExecuteWithEmptySecretKey.
@Test
public void testExecuteWithEmptySecretKey() {
ListResponse<UserResponse> responseList = new ListResponse<>();
UserResponse response = new UserResponse();
responseList.setResponses(Arrays.asList(response));
when(queryService.searchForUsers(listUsersCmd)).thenReturn(responseList);
listUsersCmd.execute();
responseList = (ListResponse) listUsersCmd.getResponseObject();
response = responseList.getResponses().get(0);
assertFalse("Empty SecretKey should be left empty", StringUtils.isNotBlank(response.getSecretKey()));
}
Aggregations