Repository: incubator-nifi Updated Branches: refs/heads/NIFI-292 [created] 524606cae
NIFI-292: - Annotating endpoints using swagger. - Started building the template for the REST documentation. Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/524606ca Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/524606ca Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/524606ca Branch: refs/heads/NIFI-292 Commit: 524606cae23f9aac091f1b0ea192f5816f9497fc Parents: dca93a5 Author: Matt Gilman <[email protected]> Authored: Fri Apr 24 14:45:18 2015 -0400 Committer: Matt Gilman <[email protected]> Committed: Fri Apr 24 14:45:18 2015 -0400 ---------------------------------------------------------------------- .../nifi-web/nifi-web-api/pom.xml | 57 ++- .../nifi/web/api/BulletinBoardResource.java | 3 + .../apache/nifi/web/api/ClusterResource.java | 10 + .../apache/nifi/web/api/ConnectionResource.java | 20 + .../apache/nifi/web/api/ControllerResource.java | 368 ++++++++++++++++++- .../nifi/web/api/ControllerServiceResource.java | 2 + .../org/apache/nifi/web/api/FunnelResource.java | 2 + .../apache/nifi/web/api/HistoryResource.java | 2 + .../apache/nifi/web/api/InputPortResource.java | 2 + .../org/apache/nifi/web/api/LabelResource.java | 2 + .../org/apache/nifi/web/api/NodeResource.java | 2 + .../apache/nifi/web/api/OutputPortResource.java | 2 + .../nifi/web/api/ProcessGroupResource.java | 49 +++ .../apache/nifi/web/api/ProcessorResource.java | 20 + .../apache/nifi/web/api/ProvenanceResource.java | 2 + .../web/api/RemoteProcessGroupResource.java | 2 + .../nifi/web/api/ReportingTaskResource.java | 2 + .../apache/nifi/web/api/SnippetResource.java | 2 + .../nifi/web/api/SystemDiagnosticsResource.java | 5 + .../apache/nifi/web/api/TemplateResource.java | 2 + .../apache/nifi/web/api/UserGroupResource.java | 2 + .../org/apache/nifi/web/api/UserResource.java | 2 + .../src/main/resources/templates/endpoint.hbs | 60 +++ .../src/main/resources/templates/index.html.hbs | 170 +++++++++ .../src/main/resources/templates/operation.hbs | 93 +++++ 25 files changed, 863 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml index 5a87ff8..3734985 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/pom.xml @@ -89,6 +89,44 @@ <reuseForks>false</reuseForks> </configuration> </plugin> + <plugin> + <groupId>com.github.kongchen</groupId> + <artifactId>swagger-maven-plugin</artifactId> + <version>3.0-M1</version> + <configuration> + <apiSources> + <apiSource> + <locations>org.apache.nifi.web.api</locations> + <schemes>http,https</schemes> + <basePath>/nifi-api</basePath> + <info> + <title>NiFi Rest Api</title> + <version>${project.version}</version> + <!--<description>This is a sample for swagger-maven-plugin</description>--> + <contact> + <email>[email protected]</email> + <url>https://nifi.incubator.apache.org/</url> + </contact> + <license> + <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> + <name>Apache 2.0</name> + </license> + </info> + <templatePath>classpath:/templates/index.html.hbs</templatePath> + <outputPath>${project.build.directory}/${project.artifactId}-${project.version}/docs/rest-api/index.html</outputPath> + <swaggerDirectory>${project.build.directory}/swagger-ui</swaggerDirectory> + </apiSource> + </apiSources> + </configuration> + <executions> + <execution> + <phase>compile</phase> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> <dependencies> @@ -119,15 +157,8 @@ </dependency> <dependency> <groupId>org.apache.nifi</groupId> - <artifactId>nifi-client-dto</artifactId> - <classifier>sources</classifier> - <scope>provided</scope> - <optional>true</optional> - <version>0.1.0-incubating-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> <artifactId>nifi-data-provenance-utils</artifactId> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.nifi</groupId> @@ -198,6 +229,11 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>com.wordnik</groupId> + <artifactId>swagger-core</artifactId> + <version>1.5.3-M1</version> + </dependency> + <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <scope>provided</scope> @@ -208,6 +244,11 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <scope>provided</scope> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.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/BulletinBoardResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java index 32dafb9..9af8c5d 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java @@ -16,8 +16,10 @@ */ 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; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; @@ -40,6 +42,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Template. */ +@Api(hidden = true) public class BulletinBoardResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(BulletinBoardResource.class); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ClusterResource.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/ClusterResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ClusterResource.java index a99d7df..872ef22 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ClusterResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ClusterResource.java @@ -69,6 +69,8 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import com.sun.jersey.api.core.ResourceContext; +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; import org.apache.nifi.web.api.dto.status.ClusterProcessGroupStatusDTO; import org.apache.nifi.web.api.entity.ClusterProcessGroupStatusEntity; import org.codehaus.enunciate.jaxrs.TypeHint; @@ -77,6 +79,10 @@ import org.codehaus.enunciate.jaxrs.TypeHint; * RESTful endpoint for managing a cluster. */ @Path("/cluster") +@Api( + value = "/cluster", + description = "Provides access to the cluster of Nodes that comprise this NiFi" +) public class ClusterResource extends ApplicationResource { @Context @@ -90,6 +96,10 @@ public class ClusterResource extends ApplicationResource { * @return */ @Path("/nodes") + @ApiOperation( + value = "Gets the node resource", + response = NodeResource.class + ) public NodeResource getNodeResource() { return resourceContext.getResource(NodeResource.class); } http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.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/ConnectionResource.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java index 5d233f7..eb61310 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java @@ -16,6 +16,11 @@ */ package org.apache.nifi.web.api; +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.ArrayList; @@ -73,6 +78,7 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Connection. */ +@Api(hidden = true) public class ConnectionResource extends ApplicationResource { private static final Logger logger = LoggerFactory.getLogger(ConnectionResource.class); @@ -156,6 +162,20 @@ public class ConnectionResource extends ApplicationResource { @Path("/{id}") @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ConnectionEntity.class) + @ApiOperation( + value = "Gets the specified connection", + response = ConnectionEntity.class, + authorizations = { + @Authorization(value = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) public Response getConnection(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/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 9228be4..6eb66c1 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 */ @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 */ @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 */ @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 */ @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 */ @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 */ @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 */ @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 */ @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 */ @Path("/reporting-tasks") + @ApiOperation( + value = "Gets the reporting task resource", + response = ReportingTaskResource.class + ) public ReportingTaskResource getReportingTaskResource() { return resourceContext.getResource(ReportingTaskResource.class); } @@ -187,6 +233,10 @@ public class ControllerResource extends ApplicationResource { * @return */ @Path("/process-groups/{process-group-id}") + @ApiOperation( + value = "Gets the process group resource", + response = ProcessGroupResource.class + ) public ProcessGroupResource getGroupResource(@PathParam("process-group-id") String groupId) { ProcessGroupResource groupResource = resourceContext.getResource(ProcessGroupResource.class); groupResource.setGroupId(groupId); @@ -221,7 +271,22 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_NIFI", type = "ROLE_NIFI") + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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(); @@ -254,6 +319,20 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) public Response searchController(@QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) { // replicate if cluster manager if (properties.isClusterManager()) { @@ -296,9 +375,33 @@ 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 = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) 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 @@ -346,6 +449,20 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) public Response getRevision() { // create the current revision final RevisionDTO revision = serviceFacade.getRevision(); @@ -371,7 +488,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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(); @@ -401,7 +537,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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(); @@ -431,10 +586,26 @@ public class ControllerResource extends ApplicationResource { @PUT @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 = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) 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) { @@ -478,7 +649,28 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN"), + @Authorization(value = "ROLE_NIFI", type = "ROLE_NIFI") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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(); @@ -575,9 +767,24 @@ 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 = "ROLE_DFM", type = "ROLE_DFM") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) 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"); @@ -637,7 +844,27 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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) { @@ -671,7 +898,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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()) { @@ -711,7 +957,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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()) { @@ -745,8 +1010,30 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) 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 @@ -780,7 +1067,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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()) { @@ -813,7 +1119,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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()) { @@ -846,7 +1171,26 @@ public class ControllerResource extends ApplicationResource { @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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) + 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()) { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/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 bd3daf2..7e27056 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/524606ca/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 4e6095e..5bf9443 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/524606ca/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 49bede82..ec9a1d7 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/524606ca/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 9b5eeba..d602624 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/524606ca/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 4905ad3..61dafa8 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/524606ca/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 db3d040..da20fdb 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/524606ca/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 168ec90..2eb9721 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/524606ca/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 1bf3f77..79e457d 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,8 @@ import org.springframework.security.access.prepost.PreAuthorize; /** * RESTful endpoint for managing a Group. */ +//@Path("") // necessary due to bug in swagger +@Api(hidden = true) public class ProcessGroupResource extends ApplicationResource { private static final String VERBOSE = "false"; @@ -87,6 +94,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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 +110,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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 +126,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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 +142,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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 +158,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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 +174,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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 +190,10 @@ public class ProcessGroupResource extends ApplicationResource { * @return */ @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); @@ -262,6 +297,20 @@ public class ProcessGroupResource extends ApplicationResource { @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')") @TypeHint(ProcessGroupEntity.class) + @ApiOperation( + value = "Gets the specified process group", + response = ProcessGroupEntity.class, + authorizations = { + @Authorization(value = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) public Response getProcessGroup( @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @QueryParam("recursive") @DefaultValue(RECURSIVE) Boolean recursive, http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/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 00b6fe3..e66778b 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,11 @@ */ package org.apache.nifi.web.api; +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.Arrays; @@ -83,6 +88,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); @@ -335,6 +341,20 @@ 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 = "ROLE_MONITOR", type = "ROLE_MONITOR"), + @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"), + @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN") + } + ) + @ApiResponses( + value = { + @ApiResponse(code = 403, message = "Client is not authorized to make this request") + } + ) public Response getProcessor(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) { // replicate if cluster manager http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/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 5fef27f..780bb6a 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/524606ca/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 b171835..593a018 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/524606ca/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 485b8fd..86b4c99 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/524606ca/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 275b133..6d67028 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/524606ca/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 915c55e..1177c5d 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/524606ca/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 24292e9..5fac113 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/524606ca/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 573c407..594c67d 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/524606ca/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 09307c8..a413cfe 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/524606ca/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..ce2f7d5 --- /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,60 @@ +{{!-- + 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"> + {{#post}} + <div class="endpoint post"> + <div class="operation-handle"> + <div class="method">POST</div> + <div class="path">{{@key}}</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">{{@key}}</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">{{@key}}</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">{{@key}}</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/524606ca/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs new file mode 100644 index 0000000..e169e4e --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs @@ -0,0 +1,170 @@ +<!DOCTYPE html> +<!-- + 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. +--> +<html> + <head> + <title>{{info.title}}-{{info.version}}</title> + <script type="text/javascript" src="../nifi/js/jquery/jquery-2.1.1.min.js"></script> + <script type="text/javascript"> + if (typeof window.jQuery === 'undefined') { + document.write(unescape('%3Cscript src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript" %3E%3C/script%3E')); + } + </script> + <style> + @import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic|Noto+Serif:400,400italic,700,700italic|Droid+Sans+Mono:400"; + + html, html a { + -webkit-font-smoothing: antialiased; + text-shadow: 1px 1px 1px rgba(0,0,0,0.004); + } + + body { + width: 62.5em; + margin: 0 auto; + display: block; + font-family: "Open Sans", "DejaVu Sans", sans-serif; + } + + div.endpoint { + margin-bottom: 10px; + } + + /* get */ + + div.endpoint.get { + border: 1px solid #174961; + } + + div.get div.operation-handle { + background-color: rgba(23, 73, 97, .15); + } + + div.get div.method { + background-color: #174961; + } + + div.get div.operation { + border-top: 1px solid #174961; + } + + /* post */ + + div.endpoint.post { + border: 1px solid #7298AC; + } + + div.post div.operation-handle { + background-color: rgba(114, 152, 172, .15); + } + + div.post div.method { + background-color: #7298AC; + } + + div.post div.operation { + border-top: 1px solid #7298AC; + } + + /* put */ + + div.endpoint.put { + border: 1px solid #063046; + } + + div.put div.operation-handle { + background-color: rgba(6, 48, 70, .15); + } + + div.put div.method { + background-color: #063046; + } + + div.put div.operation { + border-top: 1px solid #063046; + } + + /* delete */ + + div.endpoint.delete { + border: 1px solid #47758E; + } + + div.delete div.operation-handle { + background-color: rgba(71, 117, 142, .15); + } + + div.delete div.method { + background-color: #47758E; + } + + div.delete div.operation { + border-top: 1px solid #47758E; + } + + div.operation-handle { + cursor: pointer; + padding-right: 5px; + height: 22px; + } + + div.method { + float: left; + width: 75px; + color: #fff; + text-align: center; + background-color: #7098ad; + margin-right: 10px; + font-weight: bold; + } + + div.path { + float: left; + line-height: 22px; + font-family: monospace; + } + + div.summary { + float: right; + font-size: 12px; + line-height: 22px; + } + + div.operation { + padding: 5px; + } + + div.clear { + clear: both; + } + + .hidden { + display: none; + } + </style> + <script type="text/javascript"> + $(document).ready(function () { + $('div.operation-handle').on('click', function () { + $(this).next('div.operation').toggle(); + }); + }); + </script> + </head> + <body> + + {{#each paths}} + {{> endpoint}} + {{/each}} + </body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/524606ca/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs new file mode 100644 index 0000000..11e8992 --- /dev/null +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/operation.hbs @@ -0,0 +1,93 @@ +{{!-- + 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="operation hidden"> + {{description}} +</div> + +{{!-- +{{#deprecated}}-deprecated-{{/deprecated}} +{{summary}} + +{{description}} + +{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}}) +{{/if}} + +{{#if security}} +#### Security +{{/if}} + +{{#security}} +{{#each this}} +* {{@key}} +{{#this}} * {{this}} +{{/this}} +{{/each}} +{{/security}} + +#### Request + +{{#if consumes}} +**Content-Type: ** {{join consumes ", "}}{{/if}} + +##### Parameters +{{#if parameters}} +<table border="1"> + <tr> + <th>Name</th> + <th>Located in</th> + <th>Required</th> + <th>Description</th> + <th>Default</th> + <th>Schema</th> + </tr> +{{/if}} + +{{#parameters}} +<tr> + <th>{{name}}</th> + <td>{{in}}</td> + <td>{{#if required}}yes{{else}}no{{/if}}</td> + <td>{{description}}</td> + <td> - </td> +{{#ifeq in "body"}} + <td> + {{#ifeq schema.type "array"}}Array[<a href="#/definitions/{{basename schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}} + {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}} + </td> +{{else}} + {{#ifeq type "array"}} + <td>Array[{{items.type}}] ({{collectionFormat}})</td> + {{else}} + <td>{{type}} {{#format}}({{format}}){{/format}}</td> + {{/ifeq}} +{{/ifeq}} +</tr> +{{/parameters}} +{{#if parameters}} +</table> +{{/if}} + + +#### Response + +{{#if produces}}**Content-Type: ** {{join produces ", "}}{{/if}} + + +| Status Code | Reason | Response Model | +|-------------|-------------|----------------| +{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}| +{{/each}} +--}} \ No newline at end of file
