Search in sources :

Example 1 with ResourcesEntity

use of org.apache.nifi.web.api.entity.ResourcesEntity in project nifi by apache.

the class ResourceResource method getResources.

/**
 * Gets the available resources that support access/authorization policies.
 *
 * @return A resourcesEntity.
 */
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Gets the available resources that support access/authorization policies", response = ResourcesEntity.class, authorizations = { @Authorization(value = "Read - /resources") })
@ApiResponses(value = { @ApiResponse(code = 401, message = "Client could not be authenticated."), @ApiResponse(code = 403, message = "Client is not authorized to make this request.") })
public Response getResources() {
    authorizeResource();
    if (isReplicateRequest()) {
        return replicate(HttpMethod.GET);
    }
    final List<ResourceDTO> resources = serviceFacade.getResources();
    // create the response
    final ResourcesEntity entity = new ResourcesEntity();
    entity.setResources(resources);
    // generate the response
    return generateOkResponse(entity).build();
}
Also used : ResourcesEntity(org.apache.nifi.web.api.entity.ResourcesEntity) ResourceDTO(org.apache.nifi.web.api.dto.ResourceDTO) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 ResourceDTO (org.apache.nifi.web.api.dto.ResourceDTO)1 ResourcesEntity (org.apache.nifi.web.api.entity.ResourcesEntity)1