Search in sources :

Example 1 with VersionedFlowEntity

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

the class FlowResource method getFlows.

@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("registries/{registry-id}/buckets/{bucket-id}/flows")
@ApiOperation(value = "Gets the flows from the specified registry and bucket for the current user", response = VersionedFlowsEntity.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 getFlows(@ApiParam(value = "The registry id.", required = true) @PathParam("registry-id") String registryId, @ApiParam(value = "The bucket id.", required = true) @PathParam("bucket-id") String bucketId) {
    authorizeFlow();
    final Set<VersionedFlowEntity> versionedFlows = serviceFacade.getFlowsForUser(registryId, bucketId, NiFiUserUtils.getNiFiUser());
    final VersionedFlowsEntity versionedFlowsEntity = new VersionedFlowsEntity();
    versionedFlowsEntity.setVersionedFlows(versionedFlows);
    return generateOkResponse(versionedFlowsEntity).build();
}
Also used : VersionedFlowsEntity(org.apache.nifi.web.api.entity.VersionedFlowsEntity) VersionedFlowEntity(org.apache.nifi.web.api.entity.VersionedFlowEntity) 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)

Example 2 with VersionedFlowEntity

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

the class StandardNiFiServiceFacade method createVersionedFlowEntity.

private VersionedFlowEntity createVersionedFlowEntity(final String registryId, final VersionedFlow versionedFlow) {
    if (versionedFlow == null) {
        return null;
    }
    final VersionedFlowDTO dto = new VersionedFlowDTO();
    dto.setRegistryId(registryId);
    dto.setBucketId(versionedFlow.getBucketIdentifier());
    dto.setFlowId(versionedFlow.getIdentifier());
    dto.setFlowName(versionedFlow.getName());
    dto.setDescription(versionedFlow.getDescription());
    final VersionedFlowEntity entity = new VersionedFlowEntity();
    entity.setVersionedFlow(dto);
    return entity;
}
Also used : VersionedFlowDTO(org.apache.nifi.web.api.dto.VersionedFlowDTO) VersionedFlowEntity(org.apache.nifi.web.api.entity.VersionedFlowEntity)

Aggregations

VersionedFlowEntity (org.apache.nifi.web.api.entity.VersionedFlowEntity)2 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 VersionedFlowDTO (org.apache.nifi.web.api.dto.VersionedFlowDTO)1 VersionedFlowsEntity (org.apache.nifi.web.api.entity.VersionedFlowsEntity)1