use of org.apache.nifi.web.api.entity.BucketEntity in project nifi by apache.
the class FlowResource method getBuckets.
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("registries/{id}/buckets")
@ApiOperation(value = "Gets the buckets from the specified registry for the current user", response = BucketsEntity.class, authorizations = { @Authorization(value = "Read - /flow") })
@ApiResponses(value = { @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(code = 401, message = "Client could not be authenticated."), @ApiResponse(code = 403, message = "Client is not authorized to make this request."), @ApiResponse(code = 404, message = "The specified resource could not be found."), @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") })
public Response getBuckets(@ApiParam(value = "The registry id.", required = true) @PathParam("id") String id) throws NiFiRegistryException {
authorizeFlow();
final Set<BucketEntity> buckets = serviceFacade.getBucketsForUser(id, NiFiUserUtils.getNiFiUser());
final BucketsEntity bucketsEntity = new BucketsEntity();
bucketsEntity.setBuckets(buckets);
return generateOkResponse(bucketsEntity).build();
}
use of org.apache.nifi.web.api.entity.BucketEntity in project nifi by apache.
the class EntityFactory method createBucketEntity.
public BucketEntity createBucketEntity(final BucketDTO dto, final PermissionsDTO permissions) {
final BucketEntity entity = new BucketEntity();
entity.setId(dto.getId());
entity.setPermissions(permissions);
if (permissions != null && permissions.getCanRead()) {
entity.setBucket(dto);
}
return entity;
}
Aggregations