Search in sources :

Example 1 with ListZonesCmdByAdmin

use of org.apache.cloudstack.api.command.admin.zone.ListZonesCmdByAdmin 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 || CallContext.current().getCallingAccount().getType() == Account.ACCOUNT_TYPE_ADMIN) {
        respView = ResponseView.Full;
    }
    List<ZoneResponse> dcResponses = ViewResponseHelper.createDataCenterResponse(respView, cmd.getShowCapacities(), cmd.getShowIcon(), result.first().toArray(new DataCenterJoinVO[result.first().size()]));
    response.setResponses(dcResponses, result.second());
    return response;
}
Also used : ZoneResponse(org.apache.cloudstack.api.response.ZoneResponse) DataCenterJoinVO(com.cloud.api.query.vo.DataCenterJoinVO) ResponseView(org.apache.cloudstack.api.ResponseObject.ResponseView) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) List(java.util.List) ListZonesCmdByAdmin(org.apache.cloudstack.api.command.admin.zone.ListZonesCmdByAdmin)

Aggregations

DataCenterJoinVO (com.cloud.api.query.vo.DataCenterJoinVO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ResponseView (org.apache.cloudstack.api.ResponseObject.ResponseView)1 ListZonesCmdByAdmin (org.apache.cloudstack.api.command.admin.zone.ListZonesCmdByAdmin)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1 ZoneResponse (org.apache.cloudstack.api.response.ZoneResponse)1