You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/06/06 15:48:10 UTC

[pulsar] branch master updated: [Improve DOC] Update functions rest api doc (#4368)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 3db648e  [Improve DOC] Update functions rest api doc (#4368)
3db648e is described below

commit 3db648e074aeb158e886962b1221096cb8540135
Author: 冉小龙 <ra...@gmail.com>
AuthorDate: Thu Jun 6 23:48:05 2019 +0800

    [Improve DOC] Update functions rest api doc (#4368)
    
    * [Improve DOC] Update functions rest api doc
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
    
    * fix comments
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
    
    * adjust output format
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
    
    * fix comments
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
    
    * fix comments
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
    
    * fix comments
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
---
 .../pulsar/broker/admin/impl/FunctionsBase.java    | 368 +++++++++++++++++----
 1 file changed, 307 insertions(+), 61 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/FunctionsBase.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/FunctionsBase.java
index ec94d04..8a0f99c 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/FunctionsBase.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/FunctionsBase.java
@@ -18,9 +18,7 @@
  */
 package org.apache.pulsar.broker.admin.impl;
 
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.annotations.*;
 import org.apache.pulsar.broker.admin.AdminResource;
 import org.apache.pulsar.client.api.Message;
 import org.apache.pulsar.common.functions.FunctionConfig;
@@ -73,13 +71,104 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}")
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public void registerFunction(final @PathParam("tenant") String tenant,
-                                 final @PathParam("namespace") String namespace,
-                                 final @PathParam("functionName") String functionName,
-                                 final @FormDataParam("data") InputStream uploadedInputStream,
-                                 final @FormDataParam("data") FormDataContentDisposition fileDetail,
-                                 final @FormDataParam("url") String functionPkgUrl,
-                                 final @FormDataParam("functionConfig") String functionConfigJson) {
+    public void registerFunction(
+            @ApiParam(value = "The functions tenant")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The functions namespace")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The functions name")
+            final @PathParam("functionName") String functionName,
+            final @FormDataParam("data") InputStream uploadedInputStream,
+            final @FormDataParam("data") FormDataContentDisposition fileDetail,
+            final @FormDataParam("url") String functionPkgUrl,
+            @ApiParam(
+                    value = "A JSON value presenting functions configuration payload. An example of the expected functions can be found here.  \n" +
+                            "autoAck  \n" +
+                            "  Whether or not the framework will automatically acknowledge messages.  \n" +
+                            "runtime  \n" +
+                            "  What is the runtime of the function. Possible Values: [JAVA, PYTHON, GO]  \n" +
+                            "resources  \n" +
+                            "  The size of the system resources allowed by the function runtime. The resources include: cpu, ram, disk.  \n" +
+                            "className  \n" +
+                            "  The class name of functions.  \n" +
+                            "tenant  \n" +
+                            "  The tenant of functions.  \n" +
+                            "namespace  \n" +
+                            "  The namespace of functions.  \n" +
+                            "name  \n" +
+                            "  The name of functions.  \n" +
+                            "customSchemaInputs  \n" +
+                            "  The map of input topics to Schema class names (The customSchemaInputs is JSON string).  \n" +
+                            "customSerdeInputs  \n" +
+                            "  The map of input topics to SerDe class names (The customSerdeInputs is JSON string).  \n" +
+                            "deadLetterTopic  \n" +
+                            "  Messages that are not processed successfully are sent to `deadLetterTopic`.  \n" +
+                            "runtimeFlags  \n" +
+                            "  Any flags that you want to pass to the runtime. Note that in thread mode, these flags have no impact.  \n" +
+                            "fqfn  \n" +
+                            "  The Fully Qualified Function Name (FQFN) for the function.  \n" +
+                            "inputSpecs  \n" +
+                            "  A generalized way of specifying inputs.  \n" +
+                            "inputs  \n" +
+                            "  The input topic or topics (multiple topics can be specified as a comma-separated list) of functions.  \n" +
+                            "jar  \n" +
+                            "  Path to the JAR file for the function (if the function is written in Java). " +
+                            "  It also supports URL path [http/https/file (file protocol assumes that file " +
+                            "  already exists on worker host)] from which worker can download the package.  \n" +
+                            "py  \n" +
+                            "  Path to the main Python file/Python Wheel file for the function (if the function is written in Python).  \n" +
+                            "go  \n" +
+                            "  Path to the main Go executable binary for the function (if the function is written in Go).  \n" +
+                            "logTopic  \n" +
+                            "  The topic to which the functions logs are produced.  \n" +
+                            "maxMessageRetries  \n" +
+                            "  How many times should we try to process a message before giving up.  \n" +
+                            "output  \n" +
+                            "  The functions output topic (If none is specified, no output is written).  \n" +
+                            "outputSerdeClassName  \n" +
+                            "  The SerDe class to be used for messages output by the function.  \n" +
+                            "parallelism  \n" +
+                            "  The functions parallelism factor (i.e. the number of function instances to run).  \n" +
+                            "processingGuarantees  \n" +
+                            "  The processing guarantees (that is, delivery semantics) applied to the function." +
+                            "  Possible Values: [ATLEAST_ONCE, ATMOST_ONCE, EFFECTIVELY_ONCE]  \n" +
+                            "retainOrdering  \n" +
+                            "  Function consumes and processes messages in order.  \n" +
+                            "outputSchemaType  \n" +
+                            "   Represents either a builtin schema type (for example: 'avro', 'json', ect) or the class name for a Schema implementation." +
+                            "subName  \n" +
+                            "  Pulsar source subscription name. User can specify a subscription-name for the input-topic consumer.  \n" +
+                            "windowConfig  \n" +
+                            "  The window functions configuration.  \n" +
+                            "timeoutMs  \n" +
+                            "  The message timeout in milliseconds.  \n" +
+                            "topicsPattern  \n" +
+                            "  The topic pattern to consume from a list of topics under a namespace that match the pattern." +
+                            "  [--input] and [--topic-pattern] are mutually exclusive. Add SerDe class name for a " +
+                            "  pattern in --custom-serde-inputs (supported for java fun only)  \n" +
+                            "userConfig  \n" +
+                            "  User-defined config key/values  \n" +
+                            "secrets  \n" +
+                            "  This is a map of secretName(that is how the secret is going to be accessed in the function via context) to an object that" +
+                            "  encapsulates how the secret is fetched by the underlying secrets provider. The type of an value here can be found by the" +
+                            "  SecretProviderConfigurator.getSecretObjectType() method. \n" +
+                            "cleanupSubscription  \n" +
+                            "  Whether the subscriptions the functions created/used should be deleted when the functions are deleted.  \n",
+                    examples = @Example(
+                            value = @ExampleProperty(
+                                    mediaType = MediaType.APPLICATION_JSON,
+                                    value = "{\n"
+                                            + "  \"inputs\": persistent://public/default/input-topic,\n"
+                                            + "  \"parallelism\": 4\n"
+                                            + "  \"output\": persistent://public/default/output-topic\n"
+                                            + "  \"log-topic\": persistent://public/default/log-topic\n"
+                                            + "  \"classname\": org.example.test.ExclamationFunction\n"
+                                            + "  \"jar\": java-function-1.0-SNAPSHOT.jar\n"
+                                            + "}\n"
+                            )
+                    )
+            )
+            final @FormDataParam("functionConfig") String functionConfigJson) {
 
         functions.registerFunction(tenant, namespace, functionName, uploadedInputStream, fileDetail,
             functionPkgUrl, functionConfigJson, clientAppId(), clientAuthData());
@@ -94,14 +183,106 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}")
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public void updateFunction(final @PathParam("tenant") String tenant,
-                               final @PathParam("namespace") String namespace,
-                               final @PathParam("functionName") String functionName,
-                               final @FormDataParam("data") InputStream uploadedInputStream,
-                               final @FormDataParam("data") FormDataContentDisposition fileDetail,
-                               final @FormDataParam("url") String functionPkgUrl,
-                               final @FormDataParam("functionConfig") String functionConfigJson,
-                               final @FormDataParam("updateOptions") UpdateOptions updateOptions) throws IOException {
+    public void updateFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName,
+            final @FormDataParam("data") InputStream uploadedInputStream,
+            final @FormDataParam("data") FormDataContentDisposition fileDetail,
+            final @FormDataParam("url") String functionPkgUrl,
+            @ApiParam(
+                    value = "A JSON value presenting a functions config playload. An example of the expected functions can be found down here.  \n" +
+                            "autoAck  \n" +
+                            "  Whether or not the framework will automatically acknowledge messages.  \n" +
+                            "runtime  \n" +
+                            "  What is the runtime of the function. Possible Values: [JAVA, PYTHON, GO]  \n" +
+                            "resources  \n" +
+                            "  The size of the system resources allowed by the function runtime. The resources include: cpu, ram, disk.  \n" +
+                            "className  \n" +
+                            "  The class name of functions.  \n" +
+                            "tenant  \n" +
+                            "  The tenant of functions.  \n" +
+                            "namespace  \n" +
+                            "  The namespace of functions.  \n" +
+                            "name  \n" +
+                            "  The name of functions.  \n" +
+                            "customSchemaInputs  \n" +
+                            "  The map of input topics to Schema class names (The customSchemaInputs is JSON string).  \n" +
+                            "customSerdeInputs  \n" +
+                            "  The map of input topics to SerDe class names (The customSerdeInputs is JSON string).  \n" +
+                            "deadLetterTopic  \n" +
+                            "  Messages that are not processed successfully are sent to `deadLetterTopic`.  \n" +
+                            "runtimeFlags  \n" +
+                            "  Any flags that you want to pass to the runtime. Note that in thread mode, these flags have no impact.  \n" +
+                            "fqfn  \n" +
+                            "  The Fully Qualified Function Name (FQFN) for the function.  \n" +
+                            "inputSpecs  \n" +
+                            "  A generalized way of specifying inputs.  \n" +
+                            "inputs  \n" +
+                            "  The input topic or topics (multiple topics can be specified as a comma-separated list) of functions.  \n" +
+                            "jar  \n" +
+                            "  Path to the JAR file for the function (if the function is written in Java). " +
+                            "  It also supports URL path [http/https/file (file protocol assumes that file " +
+                            "  already exists on worker host)] from which worker can download the package.  \n" +
+                            "py  \n" +
+                            "  Path to the main Python file/Python Wheel file for the function (if the function is written in Python).  \n" +
+                            "go  \n" +
+                            "  Path to the main Go executable binary for the function (if the function is written in Go).  \n" +
+                            "logTopic  \n" +
+                            "  The topic to which the functions logs are produced.  \n" +
+                            "maxMessageRetries  \n" +
+                            "  How many times should we try to process a message before giving up.  \n" +
+                            "output  \n" +
+                            "  The functions output topic (If none is specified, no output is written).  \n" +
+                            "outputSerdeClassName  \n" +
+                            "  The SerDe class to be used for messages output by the function.  \n" +
+                            "parallelism  \n" +
+                            "  The functions parallelism factor (i.e. the number of function instances to run).  \n" +
+                            "processingGuarantees  \n" +
+                            "  The processing guarantees (that is, delivery semantics) applied to the function." +
+                            "  Possible Values: [ATLEAST_ONCE, ATMOST_ONCE, EFFECTIVELY_ONCE]  \n" +
+                            "retainOrdering  \n" +
+                            "  Function consumes and processes messages in order.  \n" +
+                            "outputSchemaType  \n" +
+                            "   Represents either a builtin schema type (for example: 'avro', 'json', ect) or the class name for a Schema implementation." +
+                            "subName  \n" +
+                            "  Pulsar source subscription name. User can specify a subscription-name for the input-topic consumer.  \n" +
+                            "windowConfig  \n" +
+                            "  The window functions configuration.  \n" +
+                            "timeoutMs  \n" +
+                            "  The message timeout in milliseconds.  \n" +
+                            "topicsPattern  \n" +
+                            "  The topic pattern to consume from a list of topics under a namespace that match the pattern." +
+                            "  [--input] and [--topic-pattern] are mutually exclusive. Add SerDe class name for a " +
+                            "  pattern in --custom-serde-inputs (supported for java fun only)  \n" +
+                            "userConfig  \n" +
+                            "  User-defined config key/values  \n" +
+                            "secrets  \n" +
+                            "  This is a map of secretName(that is how the secret is going to be accessed in the function via context) to an object that" +
+                            "  encapsulates how the secret is fetched by the underlying secrets provider. The type of an value here can be found by the" +
+                            "  SecretProviderConfigurator.getSecretObjectType() method. \n" +
+                            "cleanupSubscription  \n" +
+                            "  Whether the subscriptions the functions created/used should be deleted when the functions are deleted.  \n",
+                    examples = @Example(
+                            value = @ExampleProperty(
+                                    mediaType = MediaType.APPLICATION_JSON,
+                                    value = "{\n"
+                                            + "  \"inputs\": persistent://public/default/input-topic,\n"
+                                            + "  \"parallelism\": 4\n"
+                                            + "  \"output\": persistent://public/default/output-topic\n"
+                                            + "  \"log-topic\": persistent://public/default/log-topic\n"
+                                            + "  \"classname\": org.example.test.ExclamationFunction\n"
+                                            + "  \"jar\": java-function-1.0-SNAPSHOT.jar\n"
+                                            + "}\n"
+                            )
+                    )
+            )
+            final @FormDataParam("functionConfig") String functionConfigJson,
+            @ApiParam(value = "The update options is for the Pulsar Function that needs to be updated.")
+            final @FormDataParam("updateOptions") UpdateOptions updateOptions) throws IOException {
 
         functions.updateFunction(tenant, namespace, functionName, uploadedInputStream, fileDetail,
                 functionPkgUrl, functionConfigJson, clientAppId(), clientAuthData(), updateOptions);
@@ -118,9 +299,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
             @ApiResponse(code = 200, message = "The function was successfully deleted")
     })
     @Path("/{tenant}/{namespace}/{functionName}")
-    public void deregisterFunction(final @PathParam("tenant") String tenant,
-                                   final @PathParam("namespace") String namespace,
-                                   final @PathParam("functionName") String functionName) {
+    public void deregisterFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName) {
         functions.deregisterFunction(tenant, namespace, functionName, clientAppId(), clientAuthData());
     }
 
@@ -136,10 +321,14 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
             @ApiResponse(code = 404, message = "The function doesn't exist")
     })
     @Path("/{tenant}/{namespace}/{functionName}")
-    public FunctionConfig getFunctionInfo(final @PathParam("tenant") String tenant,
-                                          final @PathParam("namespace") String namespace,
-                                          final @PathParam("functionName") String functionName) throws IOException {
-         return functions.getFunctionInfo(tenant, namespace, functionName, clientAppId(), clientAuthData());
+    public FunctionConfig getFunctionInfo(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName) throws IOException {
+        return functions.getFunctionInfo(tenant, namespace, functionName, clientAppId(), clientAuthData());
     }
 
     @GET
@@ -155,9 +344,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/{tenant}/{namespace}/{functionName}/{instanceId}/status")
     public FunctionStatus.FunctionInstanceStatus.FunctionInstanceStatusData getFunctionInstanceStatus(
+            @ApiParam(value = "The tenant of functions")
             final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
             final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
             final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The function instanceId (if instance-id is not provided, the stats of all instances is returned")
             final @PathParam("instanceId") String instanceId) throws IOException {
         return functions.getFunctionInstanceStatus(tenant, namespace, functionName, instanceId, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
@@ -175,8 +368,11 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/{tenant}/{namespace}/{functionName}/status")
     public FunctionStatus getFunctionStatus(
+            @ApiParam(value = "The tenant of functions")
             final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
             final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
             final @PathParam("functionName") String functionName) throws IOException {
         return functions.getFunctionStatus(tenant, namespace, functionName, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
@@ -193,9 +389,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/{tenant}/{namespace}/{functionName}/stats")
-    public FunctionStats getFunctionStats(final @PathParam("tenant") String tenant,
-                                        final @PathParam("namespace") String namespace,
-                                        final @PathParam("functionName") String functionName) throws IOException {
+    public FunctionStats getFunctionStats(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName) throws IOException {
         return functions.getFunctionStats(tenant, namespace, functionName, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
 
@@ -212,9 +412,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     @Produces(MediaType.APPLICATION_JSON)
     @Path("/{tenant}/{namespace}/{functionName}/{instanceId}/stats")
     public FunctionStats.FunctionInstanceStats.FunctionInstanceStatsData getFunctionInstanceStats(
+            @ApiParam(value = "The tenant of functions")
             final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
             final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
             final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The function instanceId (if instance-id is not provided, the stats of all instances is returned")
             final @PathParam("instanceId") String instanceId) throws IOException {
         return functions.getFunctionsInstanceStats(tenant, namespace, functionName, instanceId, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
@@ -230,8 +434,11 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
             @ApiResponse(code = 403, message = "The requester doesn't have admin permissions")
     })
     @Path("/{tenant}/{namespace}")
-    public List<String> listFunctions(final @PathParam("tenant") String tenant,
-                                      final @PathParam("namespace") String namespace) {
+    public List<String> listFunctions(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace) {
         return functions.listFunctions(tenant, namespace, clientAppId(), clientAuthData());
     }
 
@@ -248,12 +455,19 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/trigger")
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public String triggerFunction(final @PathParam("tenant") String tenant,
-                                  final @PathParam("namespace") String namespace,
-                                  final @PathParam("functionName") String functionName,
-                                  final @FormDataParam("data") String triggerValue,
-                                  final @FormDataParam("dataStream") InputStream triggerStream,
-                                  final @FormDataParam("topic") String topic) {
+    public String triggerFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The value with which you want to trigger the function")
+            final @FormDataParam("data") String triggerValue,
+            @ApiParam(value = "The path to the file that contains the data with which you'd like to trigger the function")
+            final @FormDataParam("dataStream") InputStream triggerStream,
+            @ApiParam(value = "The specific topic name that the function consumes from which you want to inject the data to")
+            final @FormDataParam("topic") String topic) {
         return functions.triggerFunction(tenant, namespace, functionName, triggerValue, triggerStream, topic, clientAppId(), clientAuthData());
     }
 
@@ -269,10 +483,15 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
         @ApiResponse(code = 500, message = "Internal server error")
     })
     @Path("/{tenant}/{namespace}/{functionName}/state/{key}")
-    public FunctionState getFunctionState(final @PathParam("tenant") String tenant,
-                                          final @PathParam("namespace") String namespace,
-                                          final @PathParam("functionName") String functionName,
-                                          final @PathParam("key") String key) {
+    public FunctionState getFunctionState(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The stats key")
+            final @PathParam("key") String key) {
         return functions.getFunctionState(tenant, namespace, functionName, key, clientAppId(), clientAuthData());
     }
 
@@ -305,10 +524,15 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/{instanceId}/restart")
     @Consumes(MediaType.APPLICATION_JSON)
-    public void restartFunction(final @PathParam("tenant") String tenant,
-                                    final @PathParam("namespace") String namespace,
-                                    final @PathParam("functionName") String functionName,
-                                    final @PathParam("instanceId") String instanceId) {
+    public void restartFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The function instanceId (if instance-id is not provided, all instances are restarted")
+            final @PathParam("instanceId") String instanceId) {
         functions.restartFunctionInstance(tenant, namespace, functionName, instanceId, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
 
@@ -321,9 +545,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/restart")
     @Consumes(MediaType.APPLICATION_JSON)
-    public void restartFunction(final @PathParam("tenant") String tenant,
-                                final @PathParam("namespace") String namespace,
-                                final @PathParam("functionName") String functionName) {
+    public void restartFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName) {
         functions.restartFunctionInstances(tenant, namespace, functionName, clientAppId(), clientAuthData());
     }
 
@@ -336,10 +564,15 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/{instanceId}/stop")
     @Consumes(MediaType.APPLICATION_JSON)
-    public void stopFunction(final @PathParam("tenant") String tenant,
-                             final @PathParam("namespace") String namespace,
-                             final @PathParam("functionName") String functionName,
-                             final @PathParam("instanceId") String instanceId) {
+    public void stopFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The function instanceId (if instance-id is not provided, all instances are stopped. ")
+            final @PathParam("instanceId") String instanceId) {
         functions.stopFunctionInstance(tenant, namespace, functionName, instanceId, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
 
@@ -352,9 +585,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/stop")
     @Consumes(MediaType.APPLICATION_JSON)
-    public void stopFunction(final @PathParam("tenant") String tenant,
-                             final @PathParam("namespace") String namespace,
-                             final @PathParam("functionName") String functionName) {
+    public void stopFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName) {
         functions.stopFunctionInstances(tenant, namespace, functionName, clientAppId(), clientAuthData());
     }
 
@@ -367,10 +604,15 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/{instanceId}/start")
     @Consumes(MediaType.APPLICATION_JSON)
-    public void startFunction(final @PathParam("tenant") String tenant,
-                              final @PathParam("namespace") String namespace,
-                              final @PathParam("functionName") String functionName,
-                              final @PathParam("instanceId") String instanceId) {
+    public void startFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName,
+            @ApiParam(value = "The function instanceId (if instance-id is not provided, all instances sre started. ")
+            final @PathParam("instanceId") String instanceId) {
         functions.startFunctionInstance(tenant, namespace, functionName, instanceId, uri.getRequestUri(), clientAppId(), clientAuthData());
     }
 
@@ -383,9 +625,13 @@ public class FunctionsBase extends AdminResource implements Supplier<WorkerServi
     })
     @Path("/{tenant}/{namespace}/{functionName}/start")
     @Consumes(MediaType.APPLICATION_JSON)
-    public void startFunction(final @PathParam("tenant") String tenant,
-                              final @PathParam("namespace") String namespace,
-                              final @PathParam("functionName") String functionName) {
+    public void startFunction(
+            @ApiParam(value = "The tenant of functions")
+            final @PathParam("tenant") String tenant,
+            @ApiParam(value = "The namespace of functions")
+            final @PathParam("namespace") String namespace,
+            @ApiParam(value = "The name of functions")
+            final @PathParam("functionName") String functionName) {
         functions.startFunctionInstances(tenant, namespace, functionName, clientAppId(), clientAuthData());
     }