use of org.apache.nifi.web.api.entity.PropertyDescriptorEntity in project nifi by apache.
the class ProcessorResource method getPropertyDescriptor.
/**
* Returns the descriptor for the specified property.
*
* @param id The id of the processor
* @param propertyName The property
* @return a propertyDescriptorEntity
* @throws InterruptedException if interrupted
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/descriptors")
@ApiOperation(value = "Gets the descriptor for a processor property", response = PropertyDescriptorEntity.class, authorizations = { @Authorization(value = "Read - /processors/{uuid}") })
@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 getPropertyDescriptor(@ApiParam(value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", required = false) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) final ClientIdParameter clientId, @ApiParam(value = "The processor id.", required = true) @PathParam("id") final String id, @ApiParam(value = "The property name.", required = true) @QueryParam("propertyName") final String propertyName) throws InterruptedException {
// ensure the property name is specified
if (propertyName == null) {
throw new IllegalArgumentException("The property name must be specified.");
}
if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}
// authorize access
serviceFacade.authorizeAccess(lookup -> {
final Authorizable processor = lookup.getProcessor(id).getAuthorizable();
processor.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser());
});
// get the property descriptor
final PropertyDescriptorDTO descriptor = serviceFacade.getProcessorPropertyDescriptor(id, propertyName);
// generate the response entity
final PropertyDescriptorEntity entity = new PropertyDescriptorEntity();
entity.setPropertyDescriptor(descriptor);
// generate the response
return generateOkResponse(entity).build();
}
use of org.apache.nifi.web.api.entity.PropertyDescriptorEntity in project nifi by apache.
the class ControllerServiceResource method getPropertyDescriptor.
/**
* Returns the descriptor for the specified property.
*
* @param id The id of the controller service.
* @param propertyName The property
* @return a propertyDescriptorEntity
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}/descriptors")
@ApiOperation(value = "Gets a controller service property descriptor", response = PropertyDescriptorEntity.class, authorizations = { @Authorization(value = "Read - /controller-services/{uuid}") })
@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 getPropertyDescriptor(@ApiParam(value = "The controller service id.", required = true) @PathParam("id") final String id, @ApiParam(value = "The property name to return the descriptor for.", required = true) @QueryParam("propertyName") final String propertyName) {
// ensure the property name is specified
if (propertyName == null) {
throw new IllegalArgumentException("The property name must be specified.");
}
if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}
// authorize access
serviceFacade.authorizeAccess(lookup -> {
final Authorizable controllerService = lookup.getControllerService(id).getAuthorizable();
controllerService.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser());
});
// get the property descriptor
final PropertyDescriptorDTO descriptor = serviceFacade.getControllerServicePropertyDescriptor(id, propertyName);
// generate the response entity
final PropertyDescriptorEntity entity = new PropertyDescriptorEntity();
entity.setPropertyDescriptor(descriptor);
// generate the response
return generateOkResponse(entity).build();
}
use of org.apache.nifi.web.api.entity.PropertyDescriptorEntity in project nifi by apache.
the class ReportingTaskResource method getPropertyDescriptor.
/**
* Returns the descriptor for the specified property.
*
* @param id The id of the reporting task.
* @param propertyName The property
* @return a propertyDescriptorEntity
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}/descriptors")
@ApiOperation(value = "Gets a reporting task property descriptor", response = PropertyDescriptorEntity.class, authorizations = { @Authorization(value = "Read - /reporting-tasks/{uuid}") })
@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 getPropertyDescriptor(@ApiParam(value = "The reporting task id.", required = true) @PathParam("id") final String id, @ApiParam(value = "The property name.", required = true) @QueryParam("propertyName") final String propertyName) {
// ensure the property name is specified
if (propertyName == null) {
throw new IllegalArgumentException("The property name must be specified.");
}
if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}
// authorize access
serviceFacade.authorizeAccess(lookup -> {
final Authorizable reportingTask = lookup.getReportingTask(id).getAuthorizable();
reportingTask.authorize(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser());
});
// get the property descriptor
final PropertyDescriptorDTO descriptor = serviceFacade.getReportingTaskPropertyDescriptor(id, propertyName);
// generate the response entity
final PropertyDescriptorEntity entity = new PropertyDescriptorEntity();
entity.setPropertyDescriptor(descriptor);
// generate the response
return generateOkResponse(entity).build();
}
Aggregations