You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/03/22 16:51:56 UTC

[camel] 07/14: CAMEL-17792: Add doc about the message headers of camel-google-functions

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

nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0151fcf403681fdbfab844c2d825fdc950dde47f
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Mar 22 13:02:18 2022 +0100

    CAMEL-17792: Add doc about the message headers of camel-google-functions
---
 .../google/functions/google-functions.json         |  7 +++++++
 .../src/main/docs/google-functions-component.adoc  | 22 +++-------------------
 .../functions/GoogleCloudFunctionsConstants.java   | 15 +++++++++++++++
 .../functions/GoogleCloudFunctionsEndpoint.java    |  2 +-
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/components/camel-google/camel-google-functions/src/generated/resources/org/apache/camel/component/google/functions/google-functions.json b/components/camel-google/camel-google-functions/src/generated/resources/org/apache/camel/component/google/functions/google-functions.json
index 9e81621..f38dc9a 100644
--- a/components/camel-google/camel-google-functions/src/generated/resources/org/apache/camel/component/google/functions/google-functions.json
+++ b/components/camel-google/camel-google-functions/src/generated/resources/org/apache/camel/component/google/functions/google-functions.json
@@ -25,6 +25,13 @@
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
   },
+  "headers": {
+    "GoogleCloudFunctionsOperation": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.google.functions.GoogleCloudFunctionsOperations", "enum": [ "listFunctions", "getFunction", "callFunction", "generateDownloadUrl", "generateUploadUrl", "createFunction", "updateFunction", "deleteFunction" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to p [...]
+    "GoogleCloudFunctionsEntryPoint": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the function (as defined in source code) that will be executed. Used for createFunction operation" },
+    "GoogleCloudFunctionsRuntime": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The runtime in which to run the function.\n\nPossible values are:\n\n* `nodejs10`\n* `nodejs12`\n* `nodejs14`\n* `python37`\n* `python38`\n* `python39`\n* `go111`\n* `go113`\n* `java11`\n* `dotnet3`\n* `ruby26`\n* `nodejs6`\n* `nodejs8`\n\nUsed f [...]
+    "GoogleCloudFunctionsSourceArchiveUrl": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Google Cloud Storage URL, starting with `gs:\/\/`, pointing to the zip archive which contains the function. Used for createFunction operation." },
+    "GoogleCloudFunctionsResponseObject": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The response object resulting from the Google Functions Client invocation" }
+  },
   "properties": {
     "functionName": { "kind": "path", "displayName": "Function Name", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.functions.GoogleCloudFunctionsConfiguration", "configurationField": "configuration", "description": "The user-defined name of the function" },
     "serviceAccountKey": { "kind": "parameter", "displayName": "Service Account Key", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.google.functions.GoogleCloudFunctionsConfiguration", "configurationField": "configuration", "description": "Service account key to authenticate an application as a service account" },
diff --git a/components/camel-google/camel-google-functions/src/main/docs/google-functions-component.adoc b/components/camel-google/camel-google-functions/src/main/docs/google-functions-component.adoc
index 3e9cc9e..b1743b3 100644
--- a/components/camel-google/camel-google-functions/src/main/docs/google-functions-component.adoc
+++ b/components/camel-google/camel-google-functions/src/main/docs/google-functions-component.adoc
@@ -88,25 +88,9 @@ include::partial$component-endpoint-options.adoc[]
 
 == Usage
 
-=== Message headers evaluated by the Google Functions Producer
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-|`GoogleCloudFunctionsOperation` |`String` |The operation to perform. Permitted values are listFunctions, getFunction, callFunction, generateDownloadUrl, generateUploadUrl, createFunction, updateFunction, deleteFunction
-|`GoogleCloudFunctionsEntryPoint` |`String` |The name of the function (as defined in source code) that will be executed. Used for createFunction operation.
-|`GoogleCloudFunctionsRuntime` |`String` |The runtime in which to run the function. Possible values are `nodejs10`, `nodejs12`, `nodejs14`, `python37`, `python38`, `python39`, `go111`, `go113`, `java11`, `dotnet3`, `ruby26`, `nodejs6`, `nodejs8`. Used for createFunction operation.
-|`GoogleCloudFunctionsSourceArchiveUrl` |`String` |The Google Cloud Storage URL, starting with `gs://`, pointing to the zip archive which contains the function. Used for createFunction operation.
-
-|=======================================================================
-
-=== Message headers set by the Google Functions Producer
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-|`GoogleCloudFunctionsResponseObject` |`Object` |The response object resulting from the Google Functions Client invocation
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 === Google Functions Producer operations
 
diff --git a/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsConstants.java b/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsConstants.java
index b56df85..d900d37 100644
--- a/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsConstants.java
+++ b/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsConstants.java
@@ -16,10 +16,25 @@
  */
 package org.apache.camel.component.google.functions;
 
+import org.apache.camel.spi.Metadata;
+
 public interface GoogleCloudFunctionsConstants {
+    @Metadata(description = "The operation to perform",
+              javaType = "org.apache.camel.component.google.functions.GoogleCloudFunctionsOperations")
     String OPERATION = "GoogleCloudFunctionsOperation";
+    @Metadata(description = "The name of the function (as defined in source code) that will be executed. Used for createFunction operation",
+              javaType = "String")
     String ENTRY_POINT = "GoogleCloudFunctionsEntryPoint";
+    @Metadata(description = "The runtime in which to run the function.\n\nPossible values are:\n\n" +
+                            "* `nodejs10`\n* `nodejs12`\n* `nodejs14`\n* `python37`\n* `python38`\n* `python39`\n* `go111`\n* `go113`\n"
+                            +
+                            "* `java11`\n* `dotnet3`\n* `ruby26`\n* `nodejs6`\n* `nodejs8`\n" +
+                            "\nUsed for createFunction operation.",
+              javaType = "String")
     String RUNTIME = "GoogleCloudFunctionsRuntime";
+    @Metadata(description = "The Google Cloud Storage URL, starting with `gs://`, pointing to the zip archive which contains the function. Used for createFunction operation.",
+              javaType = "String")
     String SOURCE_ARCHIVE_URL = "GoogleCloudFunctionsSourceArchiveUrl";
+    @Metadata(description = "The response object resulting from the Google Functions Client invocation", javaType = "Object")
     String RESPONSE_OBJECT = "GoogleCloudFunctionsResponseObject";
 }
diff --git a/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsEndpoint.java b/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsEndpoint.java
index bc4cc4e..28b705b 100644
--- a/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsEndpoint.java
+++ b/components/camel-google/camel-google-functions/src/main/java/org/apache/camel/component/google/functions/GoogleCloudFunctionsEndpoint.java
@@ -34,7 +34,7 @@ import org.apache.camel.support.DefaultEndpoint;
 @UriEndpoint(firstVersion = "3.9.0", scheme = "google-functions", title = "Google Cloud Functions",
              syntax = "google-functions:functionName", category = {
                      Category.CLOUD },
-             producerOnly = true)
+             producerOnly = true, headersClass = GoogleCloudFunctionsConstants.class)
 public class GoogleCloudFunctionsEndpoint extends DefaultEndpoint {
 
     @UriParam