use of alien4cloud.model.common.Usage in project alien4cloud by alien4cloud.
the class OrchestratorController method disable.
@ApiOperation(value = "Disable an orchestrator. Destroys the instance of the orchestrator connector.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/{id}/instance", method = RequestMethod.DELETE)
@PreAuthorize("hasAuthority('ADMIN')")
public RestResponse<List<Usage>> disable(@ApiParam(value = "Id of the orchestrator to enable", required = true) @PathVariable String id, @ApiParam(value = "This parameter is useful only when trying to disable the orchestrator, if deployments are performed using this orchestrator disable " + "operation will fail unnless the force flag is true", required = false) @RequestParam(required = false, defaultValue = "false") boolean force, @ApiParam(value = "In case an orchestrator with deployment is forced to be disabled, the user may decide to mark all deployments managed " + "by this orchestrator as ended.", required = false) @RequestParam(required = false, defaultValue = "false") boolean clearDeployments) {
RestResponseBuilder<List<Usage>> responseBuilder = RestResponseBuilder.<List<Usage>>builder();
Orchestrator orchestrator = orchestratorService.getOrFail(id);
List<Usage> usages = orchestratorStateService.disable(orchestrator, force);
if (CollectionUtils.isEmpty(usages)) {
return responseBuilder.build();
}
return responseBuilder.data(usages).error(new RestError(RestErrorCode.RESOURCE_USED_ERROR.getCode(), "There are actives deployment with the orchestrator. It cannot be disabled.")).build();
}
Aggregations