Search in sources :

Example 1 with JsonRawRestResponse

use of alien4cloud.rest.model.JsonRawRestResponse in project alien4cloud by alien4cloud.

the class DeploymentController method getByIds.

/**
 * Bulk id request API.
 */
@ApiOperation(value = "Get a list of deployments from their ids.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/bulk/ids", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
public JsonRawRestResponse getByIds(@RequestBody String[] deploymentIds) {
    // Check topology status for this deployment object
    MultiGetResponse response = alienDAO.getClient().prepareMultiGet().add(alienDAO.getIndexForType(Deployment.class), MappingBuilder.indexTypeFromClass(Deployment.class), deploymentIds).get();
    JsonRawRestResponse restResponse = new JsonRawRestResponse();
    restResponse.setData(ResponseUtil.rawMultipleData(response));
    return restResponse;
}
Also used : MultiGetResponse(org.elasticsearch.action.get.MultiGetResponse) JsonRawRestResponse(alien4cloud.rest.model.JsonRawRestResponse) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with JsonRawRestResponse

use of alien4cloud.rest.model.JsonRawRestResponse in project alien4cloud by alien4cloud.

the class EnvironmentBulkController method getByIds.

/**
 * Bulk id request API.
 */
@ApiOperation(value = "Get a list of environment from their ids.", authorizations = { @Authorization("ADMIN") })
@RequestMapping(value = "/bulk/ids", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAuthority('ADMIN')")
public JsonRawRestResponse getByIds(@RequestBody String[] deploymentIds) {
    // Check topology status for this deployment object
    MultiGetResponse response = alienDAO.getClient().prepareMultiGet().add(alienDAO.getIndexForType(ApplicationEnvironment.class), MappingBuilder.indexTypeFromClass(ApplicationEnvironment.class), deploymentIds).get();
    JsonRawRestResponse restResponse = new JsonRawRestResponse();
    restResponse.setData(ResponseUtil.rawMultipleData(response));
    return restResponse;
}
Also used : MultiGetResponse(org.elasticsearch.action.get.MultiGetResponse) JsonRawRestResponse(alien4cloud.rest.model.JsonRawRestResponse) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JsonRawRestResponse (alien4cloud.rest.model.JsonRawRestResponse)2 ApiOperation (io.swagger.annotations.ApiOperation)2 MultiGetResponse (org.elasticsearch.action.get.MultiGetResponse)2 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2