http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java index 9e34201..821ca2f 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java @@ -17,6 +17,12 @@ package org.apache.nifi.web.api; import com.sun.jersey.api.core.ResourceContext; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; +import com.wordnik.swagger.annotations.ApiResponse; +import com.wordnik.swagger.annotations.ApiResponses; +import com.wordnik.swagger.annotations.Authorization; import java.net.URI; import java.util.HashMap; @@ -81,6 +87,10 @@ import org.springframework.security.access.prepost.PreAuthorize; * RESTful endpoint for managing a Flow Controller. */ @Path("/controller") +@Api( + value = "/controller", + description = "Provides realtime command and control of this NiFi instance" +) public class ControllerResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; @@ -96,6 +106,10 @@ public class ControllerResource extends ApplicationResource { * @return the Provenance sub-resource */ @Path("/provenance") + @ApiOperation( + value = "Gets the provenance resource", + response = ProvenanceResource.class + ) public ProvenanceResource getProvenanceResource() { return resourceContext.getResource(ProvenanceResource.class); } @@ -106,6 +120,10 @@ public class ControllerResource extends ApplicationResource { * @return the User sub-resource */ @Path("/users") + @ApiOperation( + value = "Gets the user resource", + response = UserResource.class + ) public UserResource getUserResource() { return resourceContext.getResource(UserResource.class); } @@ -116,6 +134,10 @@ public class ControllerResource extends ApplicationResource { * @return the User sub-resource */ @Path("/user-groups") + @ApiOperation( + value = "Gets the user group resource", + response = UserGroupResource.class + ) public UserGroupResource getUserGroupResource() { return resourceContext.getResource(UserGroupResource.class); } @@ -126,6 +148,10 @@ public class ControllerResource extends ApplicationResource { * @return the History sub-resource */ @Path("/history") + @ApiOperation( + value = "Gets the history resource", + response = HistoryResource.class + ) public HistoryResource getHistoryResource() { return resourceContext.getResource(HistoryResource.class); } @@ -136,6 +162,10 @@ public class ControllerResource extends ApplicationResource { * @return the History sub-resource */ @Path("/bulletin-board") + @ApiOperation( + value = "Gets the bulletin board resource", + response = BulletinBoardResource.class + ) public BulletinBoardResource getBulletinBoardResource() { return resourceContext.getResource(BulletinBoardResource.class); } @@ -146,6 +176,10 @@ public class ControllerResource extends ApplicationResource { * @return the Template sub-resource */ @Path("/templates") + @ApiOperation( + value = "Gets the template resource", + response = TemplateResource.class + ) public TemplateResource getTemplateResource() { return resourceContext.getResource(TemplateResource.class); } @@ -156,6 +190,10 @@ public class ControllerResource extends ApplicationResource { * @return the Snippets sub-resource */ @Path("/snippets") + @ApiOperation( + value = "Gets the snippet resource", + response = SnippetResource.class + ) public SnippetResource getSnippetResource() { return resourceContext.getResource(SnippetResource.class); } @@ -166,6 +204,10 @@ public class ControllerResource extends ApplicationResource { * @return the Controller Services sub-resource */ @Path("/controller-services") + @ApiOperation( + value = "Gets the controller service resource", + response = ControllerServiceResource.class + ) public ControllerServiceResource getControllerServiceResource() { return resourceContext.getResource(ControllerServiceResource.class); } @@ -176,6 +218,10 @@ public class ControllerResource extends ApplicationResource { * @return the Reporting Tasks sub-resource */ @Path("/reporting-tasks") + @ApiOperation( + value = "Gets the reporting task resource", + response = ReportingTaskResource.class + ) public ReportingTaskResource getReportingTaskResource() { return resourceContext.getResource(ReportingTaskResource.class); } @@ -187,7 +233,16 @@ public class ControllerResource extends ApplicationResource { * @return the Group sub-resource */ @Path("/process-groups/{process-group-id}") - public ProcessGroupResource getGroupResource(@PathParam("process-group-id") String groupId) { + @ApiOperation( + value = "Gets the process group resource", + response = ProcessGroupResource.class + ) + public ProcessGroupResource getGroupResource( + @ApiParam( + value = "The id of the process group that is the parent of the requested resource(s).", + required = true + ) + @PathParam("process-group-id") String groupId) { ProcessGroupResource groupResource = resourceContext.getResource(ProcessGroupResource.class); groupResource.setGroupId(groupId); return groupResource; @@ -215,10 +270,29 @@ public class ControllerResource extends ApplicationResource { * @return A controllerEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @PreAuthorize("hasRole('ROLE_NIFI')") @TypeHint(ControllerEntity.class) - public Response getController(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Returns the details about this NiFi necessary to communicate via site to site", + response = ControllerEntity.class, + authorizations = @Authorization(value = "NiFi", type = "ROLE_NIFI") + ) + @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 getController( + @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) ClientIdParameter clientId) { if (properties.isClusterManager()) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -247,10 +321,28 @@ public class ControllerResource extends ApplicationResource { * @return A searchResultsEntity */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/search-results") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(SearchResultsEntity.class) + @ApiOperation( + value = "Performs a search against this NiFi using the specified search term", + response = SearchResultsEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 searchController(@QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -285,9 +377,36 @@ public class ControllerResource extends ApplicationResource { @Path("/archive") @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessGroupEntity.class) + @ApiOperation( + value = "Creates a new archive of this NiFi flow configuration", + notes = "This POST operation returns a URI that is not representative of the thing " + + "that was actually created. The archive that is created cannot be referenced " + + "at a later time, therefore there is no corresponding URI. Instead the " + + "request URI is returned.", + response = ProcessGroupEntity.class, + authorizations = { + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM") + } + ) + @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 createArchive( @Context HttpServletRequest httpServletRequest, + @ApiParam( + value = "The revision is used to verify the client is working with the latest version of the flow", + required = true + ) @FormParam(VERSION) LongParameter version, + @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 + ) @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { // replicate if cluster manager @@ -331,10 +450,28 @@ public class ControllerResource extends ApplicationResource { * @return A revisionEntity */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/revision") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(Entity.class) + @ApiOperation( + value = "Gets the current revision of this NiFi", + response = Entity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getRevision() { // create the current revision final RevisionDTO revision = serviceFacade.getRevision(); @@ -354,11 +491,34 @@ public class ControllerResource extends ApplicationResource { * @return A controllerStatusEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/status") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ControllerStatusEntity.class) - public Response getControllerStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Gets the current status of this NiFi", + response = Entity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getControllerStatus( + @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) ClientIdParameter clientId) { final ControllerStatusDTO controllerStatus = serviceFacade.getControllerStatus(); @@ -382,11 +542,34 @@ public class ControllerResource extends ApplicationResource { * @return A countersEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/counters") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(CountersEntity.class) - public Response getCounters(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Gets the current counters for this NiFi", + response = Entity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getCounters( + @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) ClientIdParameter clientId) { final CountersDTO countersReport = serviceFacade.getCounters(); @@ -412,12 +595,33 @@ public class ControllerResource extends ApplicationResource { * @return A counterEntity. */ @PUT + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/counters/{id}") - @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") + @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(CounterEntity.class) + @ApiOperation( + value = "Updates the specified counter. This will reset the counter value to 0", + response = CounterEntity.class, + authorizations = { + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM") + } + ) + @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 updateCounter( @Context HttpServletRequest httpServletRequest, + @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 + ) @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) { @@ -455,11 +659,36 @@ public class ControllerResource extends ApplicationResource { * @return A controllerConfigurationEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/config") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN', 'ROLE_NIFI')") @TypeHint(ControllerConfigurationEntity.class) - public Response getControllerConfig(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves the configuration for this NiFi", + response = ControllerConfigurationEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN"), + @Authorization(value = "ROLE_NIFI", type = "ROLE_NIFI") + } + ) + @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 getControllerConfig( + @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) ClientIdParameter clientId) { + // replicate if cluster manager if (properties.isClusterManager()) { return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); @@ -551,9 +780,27 @@ public class ControllerResource extends ApplicationResource { @Path("/config") @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ControllerConfigurationEntity.class) + @ApiOperation( + value = "Retrieves the configuration for this NiFi", + response = ControllerConfigurationEntity.class, + authorizations = { + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM") + } + ) + @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 updateControllerConfig( @Context HttpServletRequest httpServletRequest, - ControllerConfigurationEntity configEntity) { + @ApiParam( + value = "The controller configuration", + required = true + ) ControllerConfigurationEntity configEntity) { if (configEntity == null || configEntity.getConfig() == null) { throw new IllegalArgumentException("Controller configuration must be specified"); @@ -606,11 +853,35 @@ public class ControllerResource extends ApplicationResource { * @return A authoritiesEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/authorities") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(AuthorityEntity.class) - public Response getAuthorities(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves the user details, including the authorities, about the user making the request", + response = AuthorityEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getAuthorities( + @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) ClientIdParameter clientId) { + // note that the cluster manager will handle this request directly final NiFiUser user = NiFiUserUtils.getNiFiUser(); if (user == null) { @@ -638,11 +909,34 @@ public class ControllerResource extends ApplicationResource { * @return A bannerEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/banners") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(BannerEntity.class) - public Response getBanners(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves the banners for this NiFi", + response = BannerEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getBanners( + @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) ClientIdParameter clientId) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -676,11 +970,34 @@ public class ControllerResource extends ApplicationResource { * @return A processorTypesEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/processor-types") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessorTypesEntity.class) - public Response getProcessorTypes(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves the types of processors that this NiFi supports", + response = ProcessorTypesEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getProcessorTypes( + @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) ClientIdParameter clientId) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -708,12 +1025,38 @@ public class ControllerResource extends ApplicationResource { * @return A controllerServicesTypesEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/controller-service-types") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ControllerServiceTypesEntity.class) + @ApiOperation( + value = "Retrieves the types of controller services that this NiFi supports", + response = ControllerServiceTypesEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 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) ClientIdParameter clientId, + @ApiParam( + value = "If specified, will only return controller services of this type", + required = false + ) @QueryParam("serviceType") String serviceType) { // replicate if cluster manager @@ -741,11 +1084,34 @@ public class ControllerResource extends ApplicationResource { * @return A controllerServicesTypesEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/reporting-task-types") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ReportingTaskTypesEntity.class) - public Response getReportingTaskTypes(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves the types of reporting tasks that this NiFi supports", + response = ReportingTaskTypesEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getReportingTaskTypes( + @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) ClientIdParameter clientId) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -772,11 +1138,34 @@ public class ControllerResource extends ApplicationResource { * @return A prioritizerTypesEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/prioritizers") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(PrioritizerTypesEntity.class) - public Response getPrioritizers(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves the types of prioritizers that this NiFi supports", + response = PrioritizerTypesEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getPrioritizers( + @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) ClientIdParameter clientId) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -803,11 +1192,34 @@ public class ControllerResource extends ApplicationResource { * @return An aboutEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/about") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(AboutEntity.class) - public Response getAboutInfo(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { + @ApiOperation( + value = "Retrieves details about this NiFi to put in the About dialog", + response = AboutEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getAboutInfo( + @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) ClientIdParameter clientId) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -835,6 +1247,7 @@ public class ControllerResource extends ApplicationResource { } // setters + public void setServiceFacade(NiFiServiceFacade serviceFacade) { this.serviceFacade = serviceFacade; }
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java index 90d031d..f9bfda3 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -74,6 +75,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Controller Service. */ +@Api(hidden = true) public class ControllerServiceResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ControllerServiceResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java index fd97dca..73742e7 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -61,6 +62,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Funnel. */ +@Api(hidden = true) public class FunnelResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(FunnelResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java index 749863c..c334b37 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; @@ -44,6 +45,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for querying the history of this Controller. */ +@Api(hidden = true) public class HistoryResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java index 4e446fb..4c6b313 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -63,6 +64,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing an Input Port. */ +@Api(hidden = true) public class InputPortResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(InputPortResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java index 6b12d0e..ca897ee 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -63,6 +64,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Label. */ +@Api(hidden = true) public class LabelResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(LabelResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/NodeResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/NodeResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/NodeResource.java index bb0eba9..0b2fe12 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/NodeResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/NodeResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; @@ -46,6 +47,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a cluster connection. */ +@Api(hidden = true) public class NodeResource extends ApplicationResource { private NiFiServiceFacade serviceFacade; http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java index a600d35..68b6b2c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -63,6 +64,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing an Output Port. */ +@Api(hidden = true) public class OutputPortResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(OutputPortResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index 2b3657e..73e2d66 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -17,6 +17,11 @@ package org.apache.nifi.web.api; import com.sun.jersey.api.core.ResourceContext; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiResponse; +import com.wordnik.swagger.annotations.ApiResponses; +import com.wordnik.swagger.annotations.Authorization; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -68,6 +73,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Group. */ +@Api(hidden = true) public class ProcessGroupResource extends ApplicationResource { private static final String VERBOSE = "false"; @@ -87,6 +93,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the processor resource within the specified group */ @Path("processors") + @ApiOperation( + value = "Gets the processor resource", + response = ProcessorResource.class + ) public ProcessorResource getProcessorResource() { ProcessorResource processorResource = resourceContext.getResource(ProcessorResource.class); processorResource.setGroupId(groupId); @@ -99,6 +109,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the connection sub-resource within the specified group */ @Path("connections") + @ApiOperation( + value = "Gets the connection resource", + response = ConnectionResource.class + ) public ConnectionResource getConnectionResource() { ConnectionResource connectionResource = resourceContext.getResource(ConnectionResource.class); connectionResource.setGroupId(groupId); @@ -111,6 +125,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the input ports sub-resource within the specified group */ @Path("input-ports") + @ApiOperation( + value = "Gets the input port resource", + response = InputPortResource.class + ) public InputPortResource getInputPortResource() { InputPortResource inputPortResource = resourceContext.getResource(InputPortResource.class); inputPortResource.setGroupId(groupId); @@ -123,6 +141,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the output ports sub-resource within the specified group */ @Path("output-ports") + @ApiOperation( + value = "Gets the output port resource", + response = OutputPortResource.class + ) public OutputPortResource getOutputPortResource() { OutputPortResource outputPortResource = resourceContext.getResource(OutputPortResource.class); outputPortResource.setGroupId(groupId); @@ -135,6 +157,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the label sub-resource within the specified group */ @Path("labels") + @ApiOperation( + value = "Gets the label resource", + response = LabelResource.class + ) public LabelResource getLabelResource() { LabelResource labelResource = resourceContext.getResource(LabelResource.class); labelResource.setGroupId(groupId); @@ -147,6 +173,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the funnel sub-resource within the specified group */ @Path("funnels") + @ApiOperation( + value = "Gets the funnel resource", + response = FunnelResource.class + ) public FunnelResource getFunnelResource() { FunnelResource funnelResource = resourceContext.getResource(FunnelResource.class); funnelResource.setGroupId(groupId); @@ -159,6 +189,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return the remote process group sub-resource within the specified group */ @Path("remote-process-groups") + @ApiOperation( + value = "Gets the remote process group resource", + response = RemoteProcessGroupResource.class + ) public RemoteProcessGroupResource getRemoteProcessGroupResource() { RemoteProcessGroupResource remoteProcessGroupResource = resourceContext.getResource(RemoteProcessGroupResource.class); remoteProcessGroupResource.setGroupId(groupId); @@ -242,9 +276,29 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessGroupEntity.class) + @ApiOperation( + value = "Gets the specified process group", + response = ProcessGroupEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getProcessGroup( @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @QueryParam("recursive") @DefaultValue(RECURSIVE) Boolean recursive, @@ -297,6 +351,22 @@ public class ProcessGroupResource extends ApplicationResource { @Path("/snippet-instance") @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(FlowSnippetEntity.class) + @ApiOperation( + value = "Creates a new flow snippet", + response = FlowSnippetEntity.class, + authorizations = { + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @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 copySnippet( @Context HttpServletRequest httpServletRequest, @FormParam(VERSION) LongParameter version, @@ -441,6 +511,7 @@ public class ProcessGroupResource extends ApplicationResource { @PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessGroupEntity.class) public Response updateProcessGroup( @@ -481,6 +552,7 @@ public class ProcessGroupResource extends ApplicationResource { @PUT @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessGroupEntity.class) public Response updateProcessGroup( @@ -549,6 +621,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/process-group-references/{id}") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @@ -597,6 +670,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A controllerEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/process-group-references") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @@ -904,6 +978,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupEntity. */ @DELETE + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/process-group-references/{id}") @PreAuthorize("hasRole('ROLE_DFM')") @@ -956,6 +1031,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processGroupStatusEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/status") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN', 'ROLE_NIFI')") @@ -999,6 +1075,7 @@ public class ProcessGroupResource extends ApplicationResource { * @return A processorEntity. */ @GET + @Consumes(MediaType.WILDCARD) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/status/history") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java index 16c7e19..7cd544a 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessorResource.java @@ -16,6 +16,12 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; +import com.wordnik.swagger.annotations.ApiResponse; +import com.wordnik.swagger.annotations.ApiResponses; +import com.wordnik.swagger.annotations.Authorization; import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; @@ -83,6 +89,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Processor. */ +@Api(hidden = true) public class ProcessorResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ProcessorResource.class); @@ -149,8 +156,27 @@ public class ProcessorResource extends ApplicationResource { */ @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessorsEntity.class) + @ApiOperation( + value = "Gets all processors", + response = ProcessorsEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getProcessors(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) { // replicate if cluster manager @@ -189,6 +215,7 @@ public class ProcessorResource extends ApplicationResource { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessorEntity.class) public Response createProcessor( @@ -236,10 +263,31 @@ public class ProcessorResource extends ApplicationResource { @POST @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Path("") // necessary due to bug in swagger @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessorEntity.class) + @ApiOperation( + value = "Creates a new processor", + response = ProcessorEntity.class, + authorizations = { + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @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 createProcessor( @Context HttpServletRequest httpServletRequest, + @ApiParam( + value = "The processor configuration details", + required = true + ) ProcessorEntity processorEntity) { if (processorEntity == null || processorEntity.getProcessor() == null) { @@ -324,6 +372,24 @@ public class ProcessorResource extends ApplicationResource { @Path("/{id}") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessorEntity.class) + @ApiOperation( + value = "Gets the specified processor", + response = ProcessorEntity.class, + authorizations = { + @Authorization(value = "Read Only", type = "ROLE_MONITOR"), + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"), + @Authorization(value = "Administrator", type = "ROLE_ADMIN") + } + ) + @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 getProcessor(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) { // replicate if cluster manager @@ -675,10 +741,38 @@ public class ProcessorResource extends ApplicationResource { @Path("/{id}") @PreAuthorize("hasRole('ROLE_DFM')") @TypeHint(ProcessorEntity.class) + @ApiOperation( + value = "Deletes the specified processor", + response = ProcessorEntity.class, + authorizations = { + @Authorization(value = "Data Flow Manager", type = "ROLE_DFM") + } + ) + @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 deleteProcessor( @Context HttpServletRequest httpServletRequest, + @ApiParam( + value = "The revision is used to verify the client is working with the latest version of the flow", + required = false + ) @QueryParam(VERSION) LongParameter version, + @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) ClientIdParameter clientId, + @ApiParam( + value = "The processor id", + required = true + ) @PathParam("id") String id) { // replicate if cluster manager http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java index 4bfe3a0..574ec3d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProvenanceResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -85,6 +86,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for querying data provenance. */ +@Api(hidden = true) public class ProvenanceResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ProvenanceResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java index c506b9b..0c70c3e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -69,6 +70,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Remote group. */ +@Api(hidden = true) public class RemoteProcessGroupResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(RemoteProcessGroupResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java index 8aea04c..293b7b3 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ReportingTaskResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -70,6 +71,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Reporting Task. */ +@Api(hidden = true) public class ReportingTaskResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ReportingTaskResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java index 997fe4a..fb2ea01 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java @@ -17,6 +17,7 @@ package org.apache.nifi.web.api; import com.sun.jersey.api.core.ResourceContext; +import com.wordnik.swagger.annotations.Api; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -61,6 +62,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Snippet. */ +@Api(hidden = true) public class SnippetResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(SnippetResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java index f747c47..dd91872 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -40,6 +41,10 @@ import org.springframework.security.access.prepost.PreAuthorize; * RESTful endpoint for retrieving system diagnostics. */ @Path("/system-diagnostics") +@Api( + value = "/system-diagnostics", + description = "Provides diagnostics for the system NiFi is running on" +) public class SystemDiagnosticsResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(SystemDiagnosticsResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java index 00707be..7dd265e 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TemplateResource.java @@ -17,6 +17,7 @@ package org.apache.nifi.web.api; import com.sun.jersey.multipart.FormDataParam; +import com.wordnik.swagger.annotations.Api; import java.io.InputStream; import java.net.URI; import java.util.Date; @@ -61,6 +62,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Template. */ +@Api(hidden = true) public class TemplateResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(TemplateResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserGroupResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserGroupResource.java index f7b2009..2ea2c5d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserGroupResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserGroupResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -50,6 +51,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing this Controller's user groups. */ +@Api(hidden = true) public class UserGroupResource extends ApplicationResource { /* http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java index 6dbb1a7..df8d85f 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/UserResource.java @@ -16,6 +16,7 @@ */ package org.apache.nifi.web.api; +import com.wordnik.swagger.annotations.Api; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -62,6 +63,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing this Controller's users. */ +@Api(hidden = true) public class UserResource extends ApplicationResource { /* http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs new file mode 100644 index 0000000..6296862 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/endpoint.hbs @@ -0,0 +1,61 @@ +{{!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--}} +<div class="endpoints"> + <span class="path hidden">{{@key}}</span> + {{#post}} + <div class="endpoint post"> + <div class="operation-handle"> + <div class="method">POST</div> + <div class="path mono"></div> + <div class="summary">{{summary}}</div> + <div class="clear"></div> + </div> + {{> operation}} + </div> + {{/post}} + {{#get}} + <div class="endpoint get"> + <div class="operation-handle"> + <div class="method">GET</div> + <div class="path mono"></div> + <div class="summary">{{summary}}</div> + <div class="clear"></div> + </div> + {{> operation}} + </div> + {{/get}} + {{#put}} + <div class="endpoint put"> + <div class="operation-handle"> + <div class="method">PUT</div> + <div class="path mono"></div> + <div class="summary">{{summary}}</div> + <div class="clear"></div> + </div> + {{> operation}} + </div> + {{/put}} + {{#delete}} + <div class="endpoint delete"> + <div class="operation-handle"> + <div class="method">DELETE</div> + <div class="path mono"></div> + <div class="summary">{{summary}}</div> + <div class="clear"></div> + </div> + {{> operation}} + </div> + {{/delete}} +</div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/180534b1/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs new file mode 100644 index 0000000..a753cc3 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs @@ -0,0 +1,16 @@ +{{!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--}} +{{#each properties}} {{#ifeq type "string"}}"{{@key}}": "string"{{/ifeq}}{{#ifeq type "integer"}}"{{@key}}": 0{{/ifeq}}{{#if $ref}}"{{@key}}": <span class="nested collapsed"><span class="nested-id hidden">{{basename $ref}}</span><span class="nested-example">{…}</span></span>{{/if}} +{{/each}} \ No newline at end of file
