use of org.apache.nifi.web.api.dto.ResourceDTO 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();
}
use of org.apache.nifi.web.api.dto.ResourceDTO in project nifi by apache.
the class StandardNiFiServiceFacade method getResources.
@Override
public List<ResourceDTO> getResources() {
final List<Resource> resources = controllerFacade.getResources();
final List<ResourceDTO> resourceDtos = new ArrayList<>(resources.size());
for (final Resource resource : resources) {
resourceDtos.add(dtoFactory.createResourceDto(resource));
}
return resourceDtos;
}
Aggregations