use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.
the class QueryManagerImpl method searchForAccounts.
@Override
public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd) {
Pair<List<AccountJoinVO>, Integer> result = searchForAccountsInternal(cmd);
ListResponse<AccountResponse> response = new ListResponse<AccountResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListAccountsCmdByAdmin) {
respView = ResponseView.Full;
}
List<AccountResponse> accountResponses = ViewResponseHelper.createAccountResponse(respView, result.first().toArray(new AccountJoinVO[result.first().size()]));
response.setResponses(accountResponses, result.second());
return response;
}
use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.
the class QueryManagerImpl method listDataCenters.
@Override
public ListResponse<ZoneResponse> listDataCenters(ListZonesCmd cmd) {
Pair<List<DataCenterJoinVO>, Integer> result = listDataCentersInternal(cmd);
ListResponse<ZoneResponse> response = new ListResponse<ZoneResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListZonesCmdByAdmin) {
respView = ResponseView.Full;
}
List<ZoneResponse> dcResponses = ViewResponseHelper.createDataCenterResponse(respView, cmd.getShowCapacities(), result.first().toArray(new DataCenterJoinVO[result.first().size()]));
response.setResponses(dcResponses, result.second());
return response;
}
use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.
the class QueryManagerImpl method listTemplates.
@Override
public ListResponse<TemplateResponse> listTemplates(ListTemplatesCmd cmd) {
Pair<List<TemplateJoinVO>, Integer> result = searchForTemplatesInternal(cmd);
ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListTemplatesCmdByAdmin) {
respView = ResponseView.Full;
}
List<TemplateResponse> templateResponses = ViewResponseHelper.createTemplateResponse(respView, result.first().toArray(new TemplateJoinVO[result.first().size()]));
response.setResponses(templateResponses, result.second());
return response;
}
use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.
the class QueryManagerImpl method searchForVolumes.
@Override
public ListResponse<VolumeResponse> searchForVolumes(ListVolumesCmd cmd) {
Pair<List<VolumeJoinVO>, Integer> result = searchForVolumesInternal(cmd);
ListResponse<VolumeResponse> response = new ListResponse<VolumeResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListVolumesCmdByAdmin) {
respView = ResponseView.Full;
}
List<VolumeResponse> volumeResponses = ViewResponseHelper.createVolumeResponse(respView, result.first().toArray(new VolumeJoinVO[result.first().size()]));
for (VolumeResponse vr : volumeResponses) {
String poolId = vr.getStoragePoolId();
if (poolId == null) {
continue;
}
DataStore store = dataStoreManager.getPrimaryDataStore(poolId);
if (store == null) {
continue;
}
DataStoreDriver driver = store.getDriver();
if (driver == null) {
continue;
}
Map<String, String> caps = driver.getCapabilities();
if (caps != null) {
boolean quiescevm = Boolean.parseBoolean(caps.get(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString()));
vr.setNeedQuiescevm(quiescevm);
}
}
response.setResponses(volumeResponses, result.second());
return response;
}
use of org.apache.cloudstack.api.ResponseObject.ResponseView in project cloudstack by apache.
the class QueryManagerImpl method searchForUserVMs.
@Override
public ListResponse<UserVmResponse> searchForUserVMs(ListVMsCmd cmd) {
Pair<List<UserVmJoinVO>, Integer> result = searchForUserVMsInternal(cmd);
ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
ResponseView respView = ResponseView.Restricted;
if (cmd instanceof ListVMsCmdByAdmin) {
respView = ResponseView.Full;
}
List<UserVmResponse> vmResponses = ViewResponseHelper.createUserVmResponse(respView, "virtualmachine", cmd.getDetails(), result.first().toArray(new UserVmJoinVO[result.first().size()]));
response.setResponses(vmResponses, result.second());
return response;
}
Aggregations