Search in sources :

Example 1 with OrchestratorState

use of alien4cloud.model.orchestrators.OrchestratorState in project alien4cloud by alien4cloud.

the class OrchestratorController method search.

@ApiOperation(value = "Search for orchestrators.")
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("isAuthenticated()")
public RestResponse<GetMultipleDataResult<Orchestrator>> search(@ApiParam(value = "Query text.") @RequestParam(required = false) String query, @ApiParam(value = "If true only connected orchestrators will be retrieved.") @RequestParam(required = false, defaultValue = "false") boolean connectedOnly, @ApiParam(value = "Query from the given index.") @RequestParam(required = false, defaultValue = "0") int from, @ApiParam(value = "Maximum number of results to retrieve.") @RequestParam(required = false, defaultValue = "20") int size) {
    FilterBuilder authorizationFilter = AuthorizationUtil.getResourceAuthorizationFilters();
    OrchestratorState filterStatus = connectedOnly ? OrchestratorState.CONNECTED : null;
    GetMultipleDataResult<Orchestrator> result = orchestratorService.search(query, filterStatus, from, size, authorizationFilter);
    return RestResponseBuilder.<GetMultipleDataResult<Orchestrator>>builder().data(result).build();
}
Also used : OrchestratorState(alien4cloud.model.orchestrators.OrchestratorState) FilterBuilder(org.elasticsearch.index.query.FilterBuilder) GetMultipleDataResult(alien4cloud.dao.model.GetMultipleDataResult) Orchestrator(alien4cloud.model.orchestrators.Orchestrator) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

GetMultipleDataResult (alien4cloud.dao.model.GetMultipleDataResult)1 Orchestrator (alien4cloud.model.orchestrators.Orchestrator)1 OrchestratorState (alien4cloud.model.orchestrators.OrchestratorState)1 ApiOperation (io.swagger.annotations.ApiOperation)1 FilterBuilder (org.elasticsearch.index.query.FilterBuilder)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1