Search in sources :

Example 1 with ControllerServiceTypesEntity

use of org.apache.nifi.web.api.entity.ControllerServiceTypesEntity in project kylo by Teradata.

the class NifiIntegrationRestController method getServiceTypes.

@GET
@Path("/controller-services/types")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Gets a list of the available controller service types.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the controller service types.", response = ControllerServiceTypesEntity.class), @ApiResponse(code = 500, message = "NiFi is unavailable.", response = RestResponseStatus.class) })
public Response getServiceTypes() {
    final ControllerServiceTypesEntity entity = new ControllerServiceTypesEntity();
    entity.setControllerServiceTypes(legacyNifiRestClient.getControllerServiceTypes());
    return Response.ok(entity).build();
}
Also used : ControllerServiceTypesEntity(org.apache.nifi.web.api.entity.ControllerServiceTypesEntity) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 2 with ControllerServiceTypesEntity

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

the class FlowResource method getControllerServiceTypes.

/**
 * Retrieves the types of controller services that this NiFi supports.
 *
 * @param serviceType Returns only services that implement this type
 * @return A controllerServicesTypesEntity.
 * @throws InterruptedException if interrupted
 */
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("controller-service-types")
@ApiOperation(value = "Retrieves the types of controller services that this NiFi supports", notes = NON_GUARANTEED_ENDPOINT, response = ControllerServiceTypesEntity.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 = 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 getControllerServiceTypes(@ApiParam(value = "If specified, will only return controller services that are compatible with this type of service.", required = false) @QueryParam("serviceType") String serviceType, @ApiParam(value = "If serviceType specified, is the bundle group of the serviceType.", required = false) @QueryParam("serviceBundleGroup") String serviceBundleGroup, @ApiParam(value = "If serviceType specified, is the bundle artifact of the serviceType.", required = false) @QueryParam("serviceBundleArtifact") String serviceBundleArtifact, @ApiParam(value = "If serviceType specified, is the bundle version of the serviceType.", required = false) @QueryParam("serviceBundleVersion") String serviceBundleVersion, @ApiParam(value = "If specified, will only return types that are a member of this bundle group.", required = false) @QueryParam("bundleGroupFilter") String bundleGroupFilter, @ApiParam(value = "If specified, will only return types that are a member of this bundle artifact.", required = false) @QueryParam("bundleArtifactFilter") String bundleArtifactFilter, @ApiParam(value = "If specified, will only return types whose fully qualified classname matches.", required = false) @QueryParam("typeFilter") String typeFilter) throws InterruptedException {
    authorizeFlow();
    if (serviceType != null) {
        if (serviceBundleGroup == null || serviceBundleArtifact == null || serviceBundleVersion == null) {
            throw new IllegalArgumentException("When specifying the serviceType the serviceBundleGroup, serviceBundleArtifact, and serviceBundleVersion must be specified.");
        }
    }
    if (isReplicateRequest()) {
        return replicate(HttpMethod.GET);
    }
    // create response entity
    final ControllerServiceTypesEntity entity = new ControllerServiceTypesEntity();
    entity.setControllerServiceTypes(serviceFacade.getControllerServiceTypes(serviceType, serviceBundleGroup, serviceBundleArtifact, serviceBundleVersion, bundleGroupFilter, bundleArtifactFilter, typeFilter));
    // generate the response
    return generateOkResponse(entity).build();
}
Also used : ControllerServiceTypesEntity(org.apache.nifi.web.api.entity.ControllerServiceTypesEntity) Path(javax.ws.rs.Path) 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)2 ApiResponses (io.swagger.annotations.ApiResponses)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 ControllerServiceTypesEntity (org.apache.nifi.web.api.entity.ControllerServiceTypesEntity)2 Consumes (javax.ws.rs.Consumes)1