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/16 19:12:59 UTC

[camel] 10/33: CAMEL-17792: Add doc about the message headers of camel-aws2-cw

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 61189f25e873f670eb7d7f9fdc098cc35c2fa960
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Wed Mar 16 08:06:57 2022 +0100

    CAMEL-17792: Add doc about the message headers of camel-aws2-cw
---
 .../apache/camel/component/aws2/cw/aws2-cw.json    | 10 +++++++++
 .../src/main/docs/aws2-cw-component.adoc           | 25 +++-------------------
 .../camel/component/aws2/cw/Cw2Constants.java      | 10 +++++++++
 .../camel/component/aws2/cw/Cw2Endpoint.java       |  2 +-
 4 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/components/camel-aws/camel-aws2-cw/src/generated/resources/org/apache/camel/component/aws2/cw/aws2-cw.json b/components/camel-aws/camel-aws2-cw/src/generated/resources/org/apache/camel/component/aws2/cw/aws2-cw.json
index 8d7dcaa..83681b3 100644
--- a/components/camel-aws/camel-aws2-cw/src/generated/resources/org/apache/camel/component/aws2/cw/aws2-cw.json
+++ b/components/camel-aws/camel-aws2-cw/src/generated/resources/org/apache/camel/component/aws2/cw/aws2-cw.json
@@ -41,6 +41,16 @@
     "accessKey": { "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
     "secretKey": { "kind": "property", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }
   },
+  "headers": {
+    "CamelAwsCwMetricNamespace": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric namespace." },
+    "CamelAwsCwMetricName": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric name." },
+    "CamelAwsCwMetricValue": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Double", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric value." },
+    "CamelAwsCwMetricUnit": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric unit." },
+    "CamelAwsCwMetricTimestamp": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric timestamp." },
+    "CamelAwsCwMetricDimensions": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Map<String, String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A map of dimension names and dimension values." },
+    "CamelAwsCwMetricDimensionName": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric dimension name." },
+    "CamelAwsCwMetricDimensionValue": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Amazon CW metric dimension value." }
+  },
   "properties": {
     "namespace": { "kind": "path", "displayName": "Namespace", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "The metric namespace" },
     "amazonCwClient": { "kind": "parameter", "displayName": "Amazon Cw Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.cloudwatch.CloudWatchClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.cw.Cw2Configuration", "configurationField": "configuration", "description": "To use the AmazonCloudWatch as the client" },
diff --git a/components/camel-aws/camel-aws2-cw/src/main/docs/aws2-cw-component.adoc b/components/camel-aws/camel-aws2-cw/src/main/docs/aws2-cw-component.adoc
index 6fe75d2..d924781 100644
--- a/components/camel-aws/camel-aws2-cw/src/main/docs/aws2-cw-component.adoc
+++ b/components/camel-aws/camel-aws2-cw/src/main/docs/aws2-cw-component.adoc
@@ -70,28 +70,9 @@ You have the possibility of avoiding the usage of explicit static credentials, b
 
 For more information about this you can look at https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html[AWS credentials documentation]
 
-=== Message headers evaluated by the CW producer
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-
-|`CamelAwsCwMetricName` |`String` |The Amazon CW metric name.
-
-|`CamelAwsCwMetricValue` |`Double` |The Amazon CW metric value.
-
-|`CamelAwsCwMetricUnit` |`String` |The Amazon CW metric unit.
-
-|`CamelAwsCwMetricNamespace` |`String` |The Amazon CW metric namespace.
-
-|`CamelAwsCwMetricTimestamp` |`Date` |The Amazon CW metric timestamp.
-
-|`CamelAwsCwMetricDimensionName` |`String` |The Amazon CW metric dimension name.
-
-|`CamelAwsCwMetricDimensionValue` |`String` |The Amazon CW metric dimension value.
-
-|`CamelAwsCwMetricDimensions` |`Map<String, String>` |A map of dimension names and dimension values.
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 === Advanced CloudWatchClient configuration
 
diff --git a/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Constants.java b/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Constants.java
index b8a12d5..95ee0e4 100644
--- a/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Constants.java
+++ b/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Constants.java
@@ -16,16 +16,26 @@
  */
 package org.apache.camel.component.aws2.cw;
 
+import org.apache.camel.spi.Metadata;
+
 /**
  * Constants used in Camel AWS CloudWatch module SDK v2
  */
 public interface Cw2Constants {
+    @Metadata(description = "The Amazon CW metric namespace.", javaType = "String")
     String METRIC_NAMESPACE = "CamelAwsCwMetricNamespace";
+    @Metadata(description = "The Amazon CW metric name.", javaType = "String")
     String METRIC_NAME = "CamelAwsCwMetricName";
+    @Metadata(description = "The Amazon CW metric value.", javaType = "Double")
     String METRIC_VALUE = "CamelAwsCwMetricValue";
+    @Metadata(description = "The Amazon CW metric unit.", javaType = "String")
     String METRIC_UNIT = "CamelAwsCwMetricUnit";
+    @Metadata(description = "The Amazon CW metric timestamp.", javaType = "Date")
     String METRIC_TIMESTAMP = "CamelAwsCwMetricTimestamp";
+    @Metadata(description = "A map of dimension names and dimension values.", javaType = "Map<String, String>")
     String METRIC_DIMENSIONS = "CamelAwsCwMetricDimensions";
+    @Metadata(description = "The Amazon CW metric dimension name.", javaType = "String")
     String METRIC_DIMENSION_NAME = "CamelAwsCwMetricDimensionName";
+    @Metadata(description = "The Amazon CW metric dimension value.", javaType = "String")
     String METRIC_DIMENSION_VALUE = "CamelAwsCwMetricDimensionValue";
 }
diff --git a/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java b/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java
index 213fb84..4bd1768 100644
--- a/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java
+++ b/components/camel-aws/camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/Cw2Endpoint.java
@@ -32,7 +32,7 @@ import software.amazon.awssdk.services.cloudwatch.CloudWatchClient;
  * Sending metrics to AWS CloudWatch using AWS SDK version 2.x.
  */
 @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-cw", title = "AWS CloudWatch", syntax = "aws2-cw:namespace",
-             producerOnly = true, category = { Category.CLOUD, Category.MONITORING })
+             producerOnly = true, category = { Category.CLOUD, Category.MONITORING }, headersClass = Cw2Constants.class)
 public class Cw2Endpoint extends DefaultEndpoint {
 
     @UriParam