use of com.cloud.api.response.ZoneResponse in project CloudStack-archive by CloudStack-extras.
the class ListZonesByCmd method execute.
@Override
public void execute() {
List<? extends DataCenter> dataCenters = _mgr.listDataCenters(this);
ListResponse<ZoneResponse> response = new ListResponse<ZoneResponse>();
List<ZoneResponse> zoneResponses = new ArrayList<ZoneResponse>();
for (DataCenter dataCenter : dataCenters) {
ZoneResponse zoneResponse = _responseGenerator.createZoneResponse(dataCenter, showCapacities);
zoneResponse.setObjectName("zone");
zoneResponses.add(zoneResponse);
}
response.setResponses(zoneResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ZoneResponse in project CloudStack-archive by CloudStack-extras.
the class CreateZoneCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Zone Name: " + getZoneName());
DataCenter result = _configService.createZone(this);
if (result != null) {
ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a zone");
}
}
use of com.cloud.api.response.ZoneResponse in project CloudStack-archive by CloudStack-extras.
the class UpdateZoneCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Zone Id: " + getId());
DataCenter result = _configService.editZone(this);
if (result != null) {
ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update zone; internal error.");
}
}
Aggregations