You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/04/28 01:22:09 UTC
[1/2] incubator-nifi git commit: NIFI-292: - Continuing to annotate
endpoints using swagger. - Continuing to build the templates for the REST
documentation.
Repository: incubator-nifi
Updated Branches:
refs/heads/NIFI-292 524606cae -> ead451fc5
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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 79e457d..fa14936 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
@@ -73,7 +73,6 @@ 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 {
@@ -294,21 +293,27 @@ 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 = "ROLE_MONITOR", type = "ROLE_MONITOR"),
- @Authorization(value = "ROLE_DFM", type = "ROLE_DFM"),
- @Authorization(value = "ROLE_ADMIN", type = "ROLE_ADMIN")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -366,6 +371,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,
@@ -519,6 +540,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(
@@ -561,6 +583,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(
@@ -635,6 +658,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')")
@@ -687,6 +711,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')")
@@ -1004,6 +1029,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')")
@@ -1060,6 +1086,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')")
@@ -1105,6 +1132,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/ead451fc/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 e66778b..41f9cd5 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
@@ -18,6 +18,7 @@ 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;
@@ -160,8 +161,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
@@ -204,6 +224,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(
@@ -251,10 +272,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) {
@@ -345,14 +387,18 @@ public class ProcessorResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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) {
@@ -720,10 +766,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/ead451fc/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
index ce2f7d5..6296862 100644
--- 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
@@ -13,11 +13,12 @@
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">{{@key}}</div>
+ <div class="path mono"></div>
<div class="summary">{{summary}}</div>
<div class="clear"></div>
</div>
@@ -28,7 +29,7 @@
<div class="endpoint get">
<div class="operation-handle">
<div class="method">GET</div>
- <div class="path">{{@key}}</div>
+ <div class="path mono"></div>
<div class="summary">{{summary}}</div>
<div class="clear"></div>
</div>
@@ -39,7 +40,7 @@
<div class="endpoint put">
<div class="operation-handle">
<div class="method">PUT</div>
- <div class="path">{{@key}}</div>
+ <div class="path mono"></div>
<div class="summary">{{summary}}</div>
<div class="clear"></div>
</div>
@@ -50,7 +51,7 @@
<div class="endpoint delete">
<div class="operation-handle">
<div class="method">DELETE</div>
- <div class="path">{{@key}}</div>
+ <div class="path mono"></div>
<div class="summary">{{summary}}</div>
<div class="clear"></div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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
index e169e4e..3516247 100644
--- 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
@@ -37,6 +37,10 @@
font-family: "Open Sans", "DejaVu Sans", sans-serif;
}
+ div.overview {
+ margin-bottom: 10px;
+ }
+
div.endpoint {
margin-bottom: 10px;
}
@@ -113,6 +117,8 @@
border-top: 1px solid #47758E;
}
+ /* operations */
+
div.operation-handle {
cursor: pointer;
padding-right: 5px;
@@ -129,10 +135,9 @@
font-weight: bold;
}
- div.path {
+ div.endpoint div.path {
float: left;
line-height: 22px;
- font-family: monospace;
}
div.summary {
@@ -143,8 +148,115 @@
div.operation {
padding: 5px;
+ font-size: 12px;
+ }
+
+ div.operation > div.title {
+ font-weight: bold;
+ color: #000;
+ }
+
+ div.operation div.details {
+ margin-left: 5px;
+ margin-bottom: 5px;
+ color: #333;
+ }
+
+ div.operation div.description {
+ margin-bottom: 10px;
+ }
+
+ div.mediatype {
+ line-height: 16px;
}
+ div.mediatype > div.title {
+ float: left;
+ width: 70px;
+ }
+
+ div.mediatype div.title {
+ float: left;
+ }
+
+ div.type {
+ position: fixed;
+ width: 800px;
+ height: 500px;
+ left: 50%;
+ top: 50%;
+ margin-left: -400px;
+ margin-top: -250px;
+ border: 3px solid #365C6A;
+ box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.9);
+ padding: 10px;
+ background-color: #eee;
+ font-size: 12px;
+ overflow-y: scroll;
+ }
+
+ /* tables */
+
+ table {
+ background-color: #fefefe;
+ border: 1px solid #ccc;
+ border-left: 6px solid #ccc;
+ color: #555;
+ display: block;
+ margin-bottom: 12px;
+ padding: 5px 8px;
+ }
+
+ table th {
+ font-weight: bold;
+ vertical-align:top;
+ text-align:left;
+ padding: 4px 15px;
+ border-width: 0;
+ white-space: nowrap;
+ }
+
+ table td {
+ vertical-align:top;
+ text-align:left;
+ padding: 2px 15px;
+ border-width: 0;
+ white-space: nowrap;
+ }
+
+ table td:last-child {
+ width: 99%;
+ white-space: normal;
+ }
+
+ code.example {
+ background-color: #fefefe;
+ border: 1px solid #ccc;
+ border-left: 6px solid #ccc;
+ color: #555;
+ margin-bottom: 10px;
+ padding: 5px 8px;
+ white-space: pre;
+ display: block;
+ tab-size: 4;
+ -moz-tab-size: 4;
+ -o-tab-size: 4;
+ line-height: 20px
+ }
+
+ span.nested.collapsed {
+ cursor: pointer;
+ border: 1px solid #7298AC;
+ background-color: rgba(114, 152, 172, .15);
+ padding: 1px;
+ }
+
+ /* general */
+
+ .mono {
+ font-family: monospace;
+ }
+
div.clear {
clear: both;
}
@@ -152,19 +264,92 @@
.hidden {
display: none;
}
+
+ a {
+ cursor: pointer;
+ color: #1e373f;
+ font-weight: normal;
+ }
+
+ a:hover {
+ color: #264c58;
+ text-decoration: underline;
+ }
</style>
<script type="text/javascript">
$(document).ready(function () {
+ // hide any open type dialogs
+ $('html').on('click', function() {
+ $('div.type').hide();
+ });
+
+ // populate all paths - this is necessary because the @key
+ // doesn't seem to reset after iterating through a nested
+ // array or object
+ $('span.path').each(function() {
+ var path = $(this);
+ var endpoint = path.parent();
+ endpoint.find('div.path').text(path.text());
+ });
+
+ // toggles the visibility of a given operation
$('div.operation-handle').on('click', function () {
$(this).next('div.operation').toggle();
});
+
+ // add support for clicking to view the definition of a type
+ $('a.type-link').on('click', function(e) {
+ // hide any previously shown dialogs
+ $('div.type').hide();
+
+ // show the type selected
+ var link = $(this);
+ var typeId = link.text();
+ $('#' + typeId).show();
+ e.stopPropagation();
+ });
+
+ // prevent hiding when clicking on the type dialog
+ $('div.type').on('click', function(e) {
+ e.stopPropagation();
+ });
+
+ // populate nested examples
+ $('code.example').on('click', 'span.nested', function(e) {
+ var nested = $(this).removeClass('collapsed');
+ var nestedId = nested.find('span.nested-id');
+ var nestedExample = nested.find('span.nested-example');
+
+ // get the id of the nested example
+ var typeId = nestedId.text();
+ var example = $('#' + typeId + ' code.example').html();
+ var depth = nestedId.parents('span.nested').length;
+
+ // tab over as appropriate
+ example = example.replace(/(\r\n|\r|\n)/g, function(match) {
+ var tab = '\t';
+ for (var i = 0; i < depth - 1; i++) {
+ tab += '\t';
+ }
+ return match + tab;
+ });
+
+ // copy over the example
+ nestedExample.html(example);
+ e.stopPropagation();
+ });
});
</script>
</head>
<body>
-
+ <div class="overview">
+ <div class="title">{{info.title}}-{{info.version}}</div>
+ </div>
{{#each paths}}
{{> endpoint}}
{{/each}}
+ {{#each definitions}}
+ {{> type}}
+ {{/each}}
</body>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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
index 11e8992..8c626bb 100644
--- 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
@@ -13,81 +13,100 @@
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
+ {{#if description}}
+ <div class="description">
+ {{description}}
+ </div>
+ {{/if}}
+ <div class="title">Request</div>
+ <div class="mediatypes details">
+ {{#if consumes}}
+ <div class="mediatype"><div class="title">consumes:</div><div class="mono">{{join consumes ", "}}</div><div class="clear"></div></div>
+ {{/if}}
+ </div>
+ {{#if parameters}}
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Location</th>
+ <th>Required</th>
+ <th>Type</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{/if}}
+ {{#each parameters}}
+ <tr>
+ <td>{{#ifeq in "body"}}{{else}}{{name}}{{/ifeq}}</td>
+ <td>{{in}}</td>
+ <td>
+ {{#ifeq in "body"}}
+ yes
+ {{else}}
+ {{#if required}}yes{{else}}no{{/if}}
+ {{/ifeq}}
+ </td>
+ {{#ifeq in "body"}}
+ <td>
+ {{#ifeq schema.type "array"}}Array[<a class="type-link" href="javascript:void(0);">{{basename schema.items.$ref}}</a>]{{/ifeq}}
+ {{#schema.$ref}}<a class="type-link" href="javascript:void(0);">{{basename schema.$ref}}</a> {{/schema.$ref}}
+ </td>
+ {{else}}
+ {{#ifeq type "array"}}
+ <td>Array[{{items.type}}] ({{collectionFormat}})</td>
+ {{else}}
+ {{#ifeq type "ref"}}
+ <td>string</td>
+ {{else}}
+ <td>{{type}} {{#format}}({{format}}){{/format}}</td>
+ {{/ifeq}}
+ {{/ifeq}}
+ {{/ifeq}}
+ <td>{{description}}</td>
+ </tr>
+ {{/each}}
+ {{#if parameters}}
+ </tbody>
+ </table>
+ {{/if}}
+ <div class="title">Response</div>
+ <div class="mediatypes details">
+ {{#if produces}}
+ <div class="mediatype"><div class="title">produces:</div><div class="mono">{{join produces ", "}}</div><div class="clear"></div></div>
+ {{/if}}
+ </div>
+ <table>
+ <thead>
+ <tr>
+ <th>Status Code</th>
+ <th>Type</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each responses}}
+ <tr>
+ <td>{{@key}}</td>
+ <td>
+ {{#if schema}}
+ {{#schema.$ref}}<a class="type-link" href="javascript:void(0);">{{basename schema.$ref}}</a>{{/schema.$ref}}
+ {{else}}
+ string
+ {{/if}}
+ </td>
+ <td>{{description}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ <div class="title">Authorization</div>
+ <div class="authorization details">
+ {{#security}}
+ {{#each this}}
+ <div>{{@key}}</div>
+ {{/each}}
+ {{/security}}
+ </div>
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
new file mode 100644
index 0000000..08f7a02
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
@@ -0,0 +1,51 @@
+{{!--
+ 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 id="{{@key}}" class="type hidden">
+ <h3>{{@key}}</h3>
+ <table>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Required</th>
+ <th>Description</th>
+ </tr>
+ {{#each properties}}
+ <tr>
+ <td>{{@key}}</td>
+ <td>
+ {{#ifeq type "array"}}
+ {{#items.$ref}}
+ {{type}}[<a class="type-link" href="javascript:void(0);">{{basename items.$ref}}</a>]
+ {{/items.$ref}}
+ {{^items.$ref}}
+ {{type}}[{{items.type}}]
+ {{/items.$ref}}
+ {{else}}
+ {{#$ref}}
+ <a class="type-link" href="javascript:void(0);">{{basename $ref}}</a>
+ {{/$ref}}
+ {{^$ref}}
+ {{type}}{{#format}} ({{format}}){{/format}}
+ {{/$ref}}
+ {{/ifeq}}
+ </td>
+ <td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td>
+ <td>{{#description}}{{{description}}}{{/description}}</td>
+ </tr>
+ {{/each}}
+ </table>
+ <h4>Example</h4>
+ <code class="example">{{{> example}}}</code>
+</div>
\ No newline at end of file
[2/2] incubator-nifi git commit: NIFI-292: - Continuing to annotate
endpoints using swagger. - Continuing to build the templates for the REST
documentation.
Posted by mc...@apache.org.
NIFI-292:
- Continuing to annotate endpoints using swagger.
- Continuing to build the templates 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/ead451fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/ead451fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/ead451fc
Branch: refs/heads/NIFI-292
Commit: ead451fc5f13e6f37e93e843ed3ba726c34232ed
Parents: 524606c
Author: Matt Gilman <ma...@gmail.com>
Authored: Mon Apr 27 19:21:33 2015 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Mon Apr 27 19:21:33 2015 -0400
----------------------------------------------------------------------
.../nifi-web/nifi-web-api/pom.xml | 2 +-
.../nifi/web/api/BulletinBoardResource.java | 2 +
.../apache/nifi/web/api/ClusterResource.java | 485 +++++++++++++++++--
.../apache/nifi/web/api/ConnectionResource.java | 157 +++++-
.../apache/nifi/web/api/ControllerResource.java | 183 ++++---
.../nifi/web/api/ProcessGroupResource.java | 38 +-
.../apache/nifi/web/api/ProcessorResource.java | 82 +++-
.../src/main/resources/templates/endpoint.hbs | 9 +-
.../src/main/resources/templates/example.hbs | 16 +
.../src/main/resources/templates/index.html.hbs | 191 +++++++-
.../src/main/resources/templates/operation.hbs | 175 ++++---
.../src/main/resources/templates/type.hbs | 51 ++
12 files changed, 1200 insertions(+), 191 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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 3734985..3639016 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
@@ -230,7 +230,7 @@
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
- <artifactId>swagger-core</artifactId>
+ <artifactId>swagger-annotations</artifactId>
<version>1.5.3-M1</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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 9af8c5d..cf255b9 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
@@ -17,6 +17,7 @@
package org.apache.nifi.web.api;
import com.wordnik.swagger.annotations.Api;
+import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -65,6 +66,7 @@ public class BulletinBoardResource extends ApplicationResource {
* @return A bulletinBoardEntity.
*/
@GET
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(BulletinBoardEntity.class)
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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 872ef22..80d1af3 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
@@ -71,6 +71,10 @@ 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 com.wordnik.swagger.annotations.ApiParam;
+import com.wordnik.swagger.annotations.ApiResponse;
+import com.wordnik.swagger.annotations.ApiResponses;
+import com.wordnik.swagger.annotations.Authorization;
import org.apache.nifi.web.api.dto.status.ClusterProcessGroupStatusDTO;
import org.apache.nifi.web.api.entity.ClusterProcessGroupStatusEntity;
import org.codehaus.enunciate.jaxrs.TypeHint;
@@ -111,11 +115,34 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterStatusEntity
*/
@GET
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Path("/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterStatusEntity.class)
- public Response getClusterStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) {
+ @ApiOperation(
+ value = "Gets the status of the cluster",
+ response = ClusterStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getClusterStatus(
+ @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()) {
@@ -144,7 +171,8 @@ public class ClusterResource extends ApplicationResource {
* @return An OK response with an empty entity body.
*/
@HEAD
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response getClusterHead() {
if (properties.isClusterManager()) {
return Response.ok().build();
@@ -160,10 +188,34 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterEntity.class)
- public Response getCluster(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) {
+ @ApiOperation(
+ value = "Gets the contents of the cluster",
+ notes = "Returns the contents of the cluster including all nodes and their status.",
+ response = ClusterEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getCluster(
+ @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()) {
@@ -192,11 +244,35 @@ public class ClusterResource extends ApplicationResource {
* @return Nodes that match the specified criteria
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/search-results")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterSearchResultsEntity.class)
- public Response searchCluster(@QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) {
+ @ApiOperation(
+ value = "Searches the cluster for a node with the specified address",
+ response = ClusterSearchResultsEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 searchCluster(
+ @ApiParam(
+ value = "Node address to search for",
+ required = true
+ )
+ @QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) {
// ensure this is the cluster manager
if (properties.isClusterManager()) {
@@ -243,11 +319,41 @@ public class ClusterResource extends ApplicationResource {
* @return A processorEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/processors/{id}")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ProcessorEntity.class)
- public Response getProcessor(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets the specified processor",
+ response = ProcessorEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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(
+ @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) {
+
if (!properties.isClusterManager()) {
final ProcessorDTO dto = serviceFacade.getProcessor(id);
@@ -280,7 +386,7 @@ public class ClusterResource extends ApplicationResource {
*/
@PUT
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/processors/{id}")
@PreAuthorize("hasAnyRole('ROLE_DFM')")
@TypeHint(ProcessorEntity.class)
@@ -331,13 +437,39 @@ public class ClusterResource extends ApplicationResource {
*/
@PUT
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/processors/{id}")
@PreAuthorize("hasAnyRole('ROLE_DFM')")
@TypeHint(ProcessorEntity.class)
+ @ApiOperation(
+ value = "Updates processor annotation data",
+ response = ProcessorEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 updateProcessor(
@Context HttpServletRequest httpServletRequest,
+ @ApiParam(
+ value = "The processor id",
+ required = true
+ )
@PathParam("id") final String processorId,
+ @ApiParam(
+ value = "The processor configuration details. The only configuration that will be honored at this endpoint is the processor annontation data.",
+ required = true
+ )
final ProcessorEntity processorEntity) {
if (!properties.isClusterManager()) {
@@ -402,11 +534,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterProcessorStatusEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/processors/{id}/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterProcessorStatusEntity.class)
- public Response getProcessorStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets the processor status across the cluster",
+ response = ClusterProcessorStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getProcessorStatus(
+ @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) {
if (properties.isClusterManager()) {
@@ -436,11 +597,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterProcessorStatusHistoryEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/processors/{id}/status/history")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterStatusHistoryEntity.class)
- public Response getProcessorStatusHistory(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets processor status history across the cluster",
+ response = ClusterStatusHistoryEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getProcessorStatusHistory(
+ @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) {
if (properties.isClusterManager()) {
final ClusterStatusHistoryDTO dto = serviceFacade.getClusterProcessorStatusHistory(id);
@@ -469,11 +659,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterProcessorStatusEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/connections/{id}/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterConnectionStatusEntity.class)
- public Response getConnectionStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets connection status across the cluster",
+ response = ClusterConnectionStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getConnectionStatus(
+ @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 connection id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
@@ -503,11 +722,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterProcessorStatusHistoryEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/connections/{id}/status/history")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterStatusHistoryEntity.class)
- public Response getConnectionStatusHistory(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets connection status history across the cluster",
+ response = ClusterStatusHistoryEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getConnectionStatusHistory(
+ @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 connection id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
final ClusterStatusHistoryDTO dto = serviceFacade.getClusterConnectionStatusHistory(id);
@@ -536,11 +784,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterProcessGroupStatusEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/process-groups/{id}/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
- @TypeHint(ClusterConnectionStatusEntity.class)
- public Response getProcessGroupStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @TypeHint(ClusterProcessGroupStatusEntity.class)
+ @ApiOperation(
+ value = "Gets process group status across the cluster",
+ response = ClusterProcessGroupStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getProcessGroupStatus(
+ @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 process group id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
@@ -570,11 +847,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterProcessGroupStatusHistoryEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/process-groups/{id}/status/history")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterStatusHistoryEntity.class)
- public Response getProcessGroupStatusHistory(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets process group status history across the cluster",
+ response = ClusterStatusHistoryEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getProcessGroupStatusHistory(
+ @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 process group id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
final ClusterStatusHistoryDTO dto = serviceFacade.getClusterProcessGroupStatusHistory(id);
@@ -603,11 +909,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterRemoteProcessGroupStatusEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/remote-process-groups/{id}/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterRemoteProcessGroupStatusEntity.class)
- public Response getRemoteProcessGroupStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets remote process group status across the cluster",
+ response = ClusterRemoteProcessGroupStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getRemoteProcessGroupStatus(
+ @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 remote process group id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
@@ -637,11 +972,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterPortStatusEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/input-ports/{id}/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterPortStatusEntity.class)
- public Response getInputPortStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets input port status across the cluster",
+ response = ClusterPortStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getInputPortStatus(
+ @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 input port id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
@@ -671,11 +1035,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterPortStatusEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/output-ports/{id}/status")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterPortStatusEntity.class)
- public Response getOutputPortStatus(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets output port status across the cluster",
+ response = ClusterPortStatusEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getOutputPortStatus(
+ @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 output port id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
@@ -705,11 +1098,40 @@ public class ClusterResource extends ApplicationResource {
* @return A clusterRemoteProcessGroupStatusHistoryEntity
*/
@GET
- @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ @Consumes(MediaType.WILDCARD)
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@Path("/remote-process-groups/{id}/status/history")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ClusterStatusHistoryEntity.class)
- public Response getRemoteProcessGroupStatusHistory(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets the remote process group status history across the cluster",
+ response = ClusterStatusHistoryEntity.class,
+ authorizations = {
+ @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+ @Authorization(value = "DFM", type = "ROLE_DFM"),
+ @Authorization(value = "Admin", 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 getRemoteProcessGroupStatusHistory(
+ @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 remote process group id",
+ required = true
+ )
+ @PathParam("id") String id) {
if (properties.isClusterManager()) {
final ClusterStatusHistoryDTO dto = serviceFacade.getClusterRemoteProcessGroupStatusHistory(id);
@@ -731,6 +1153,7 @@ public class ClusterResource extends ApplicationResource {
}
// setters
+
public void setServiceFacade(NiFiServiceFacade serviceFacade) {
this.serviceFacade = serviceFacade;
}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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 eb61310..181658a 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
@@ -18,6 +18,7 @@ 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;
@@ -122,10 +123,33 @@ public class ConnectionResource extends ApplicationResource {
* @return A connectionsEntity.
*/
@GET
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ConnectionsEntity.class)
- public Response getConnections(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId) {
+ @ApiOperation(
+ value = "Gets all connections",
+ response = ConnectionsEntity.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 getConnections(
+ @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()) {
@@ -158,25 +182,39 @@ public class ConnectionResource extends ApplicationResource {
* @return A connectionEntity.
*/
@GET
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Path("/{id}")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(ConnectionEntity.class)
@ApiOperation(
- value = "Gets the specified connection",
+ value = "Gets a 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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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 getConnection(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
+ public Response getConnection(
+ @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 connection id",
+ required = true
+ )
@PathParam("id") String id) {
// replicate if cluster manager
@@ -210,11 +248,40 @@ public class ConnectionResource extends ApplicationResource {
* @return A statusHistoryEntity.
*/
@GET
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Path("/{id}/status/history")
@PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
@TypeHint(StatusHistoryEntity.class)
- public Response getConnectionStatusHistory(@QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @PathParam("id") String id) {
+ @ApiOperation(
+ value = "Gets the status history for a connection",
+ response = StatusHistoryEntity.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 getConnectionStatusHistory(
+ @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 connection id",
+ required = true
+ )
+ @PathParam("id") String id) {
// replicate if cluster manager
if (properties.isClusterManager()) {
@@ -407,8 +474,28 @@ public class ConnectionResource extends ApplicationResource {
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@PreAuthorize("hasRole('ROLE_DFM')")
@TypeHint(ConnectionEntity.class)
+ @ApiOperation(
+ value = "Creates a connection",
+ response = ConnectionEntity.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 createConnection(
@Context HttpServletRequest httpServletRequest,
+ @ApiParam(
+ value = "The connection configuration details",
+ required = true
+ )
ConnectionEntity connectionEntity) {
if (connectionEntity == null || connectionEntity.getConnection() == null) {
@@ -658,9 +745,33 @@ public class ConnectionResource extends ApplicationResource {
@Path("/{id}")
@PreAuthorize("hasRole('ROLE_DFM')")
@TypeHint(ConnectionEntity.class)
+ @ApiOperation(
+ value = "Updates a connection",
+ response = ConnectionEntity.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 updateConnection(
@Context HttpServletRequest httpServletRequest,
+ @ApiParam(
+ value = "The connection id",
+ required = true
+ )
@PathParam("id") String id,
+ @ApiParam(
+ value = "The connection configuration details",
+ required = true
+ )
ConnectionEntity connectionEntity) {
if (connectionEntity == null || connectionEntity.getConnection() == null) {
@@ -728,14 +839,43 @@ public class ConnectionResource extends ApplicationResource {
* @return An Entity containing the client id and an updated revision.
*/
@DELETE
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Path("/{id}")
@PreAuthorize("hasRole('ROLE_DFM')")
@TypeHint(ConnectionEntity.class)
+ @ApiOperation(
+ value = "Deletes a connection",
+ response = ConnectionEntity.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 deleteRelationshipTarget(
@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 connection id",
+ required = true
+ )
@PathParam("id") String id) {
// replicate if cluster manager
@@ -773,6 +913,7 @@ public class ConnectionResource extends ApplicationResource {
}
// setters
+
public void setServiceFacade(NiFiServiceFacade serviceFacade) {
this.serviceFacade = serviceFacade;
}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/ead451fc/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 6eb66c1..bb1310c 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
@@ -237,7 +237,12 @@ public class ControllerResource extends ApplicationResource {
value = "Gets the process group resource",
response = ProcessGroupResource.class
)
- public ProcessGroupResource getGroupResource(@PathParam("process-group-id") String groupId) {
+ 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;
@@ -268,17 +273,21 @@ 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)
@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")
+ authorizations = @Authorization(value = "NiFi", type = "ROLE_NIFI")
)
@ApiResponses(
value = {
- @ApiResponse(code = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -315,6 +324,7 @@ 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')")
@@ -323,14 +333,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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) {
@@ -383,12 +396,15 @@ public class ControllerResource extends ApplicationResource {
+ "request URI is returned.",
response = ProcessGroupEntity.class,
authorizations = {
- @Authorization(value = "ROLE_DFM", type = "ROLE_DFM")
+ @Authorization(value = "Data Flow Manager", type = "ROLE_DFM")
}
)
@ApiResponses(
value = {
- @ApiResponse(code = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -445,6 +461,7 @@ 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')")
@@ -453,14 +470,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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() {
@@ -484,6 +504,7 @@ 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')")
@@ -492,14 +513,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -533,6 +557,7 @@ 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')")
@@ -541,14 +566,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -584,6 +612,7 @@ public class ControllerResource extends ApplicationResource {
* @return A counterEntity.
*/
@PUT
+ @Consumes(MediaType.WILDCARD)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Path("/counters/{id}")
@PreAuthorize("hasRole('ROLE_DFM')")
@@ -592,12 +621,16 @@ public class ControllerResource extends ApplicationResource {
value = "Updates the specified counter. This will reset the counter value to 0",
response = CounterEntity.class,
authorizations = {
- @Authorization(value = "ROLE_DFM", type = "ROLE_DFM")
+ @Authorization(value = "Data Flow Manager", type = "ROLE_DFM")
}
)
@ApiResponses(
value = {
- @ApiResponse(code = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -645,6 +678,7 @@ 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')")
@@ -653,15 +687,18 @@ public class ControllerResource extends ApplicationResource {
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 = "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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -771,12 +808,15 @@ public class ControllerResource extends ApplicationResource {
value = "Retrieves the configuration for this NiFi",
response = ControllerConfigurationEntity.class,
authorizations = {
- @Authorization(value = "ROLE_DFM", type = "ROLE_DFM")
+ @Authorization(value = "Data Flow Manager", type = "ROLE_DFM")
}
)
@ApiResponses(
value = {
- @ApiResponse(code = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -840,6 +880,7 @@ 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')")
@@ -848,14 +889,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -894,6 +938,7 @@ 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')")
@@ -902,14 +947,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -953,6 +1001,7 @@ 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')")
@@ -961,14 +1010,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -1006,6 +1058,7 @@ 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')")
@@ -1014,14 +1067,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -1063,6 +1119,7 @@ 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')")
@@ -1071,14 +1128,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -1115,6 +1175,7 @@ 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')")
@@ -1123,14 +1184,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -1167,6 +1231,7 @@ 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')")
@@ -1175,14 +1240,17 @@ public class ControllerResource extends ApplicationResource {
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")
+ @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 = 403, message = "Client is not authorized to make this request")
+ @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(
@@ -1218,6 +1286,7 @@ public class ControllerResource extends ApplicationResource {
}
// setters
+
public void setServiceFacade(NiFiServiceFacade serviceFacade) {
this.serviceFacade = serviceFacade;
}