Skip to content

Commit

Permalink
Add AWS CloudWatch Kamelet
Browse files Browse the repository at this point in the history
When regenerating the doc, it updated the aws s3 doc.
  • Loading branch information
claudio4j committed Apr 8, 2021
1 parent 61a9fc2 commit 676c99d
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 3 deletions.
86 changes: 86 additions & 0 deletions aws-cloudwatch-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: aws-cloudwatch-sink
annotations:
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIwNyIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDI5MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTI1NiAxOTkuMzA1bC0xMjcuOTU3LTE4Ljc5N0wwIDE5OS4zMjlsMTI4LjAxIDQ3LjQzOUwyNTYgMTk5LjMwNSIgZmlsbD0iI0I3Q0E5RCIvPjxwYXRoIGQ9Ik0yNS42MjEgMTk3LjExM2wyMS42MyA2Ljc2MSAxLjk3MS0yLjIzOFY1MC4yODRsLTEuOTcxLTIuNTg1LTIxLjYzIDguMjc0djE0MS4xNCIgZmlsbD0iIzRCNjEyQyIvPjxwYXRoIGQ9Ik0xMjMuODMyIDE5MC40MjNsLTc2LjU4MSAxMy40NTFWNDcuNzAzbDc2LjU4MSAxNy4yMjJ2MTI1LjQ5OCIgZmlsbD0iIzc1OUMzRSIvPjxwYXRoIGQ9Ik04OS42ODYgMjE2Ljg4OWwtMjkuODQ4LTkuMjAxVjE0LjkyOEw4OS42ODYuMDA0bDIuNjEyIDIuODQ1djIxMC44NThsLTIuNjEyIDMuMTgyIiBmaWxsPSIjNEI2MTJDIi8+PHBhdGggZD0iTTE5MS45NjcgMTkyLjg5NEw4OS42ODYgMjE2Ljg4OVYwbDEwMi4yODEgMzkuODY2djE1My4wMjgiIGZpbGw9IiM3NTlDM0UiLz48cGF0aCBkPSJNMTI3Ljk2NSAyNDQuNzE0TDAgMTk5LjMyOXYyNi4zMjRsMTI3Ljk2NSA2My45ODN2LTQ0LjkyMiIgZmlsbD0iIzRCNjEyQyIvPjxwYXRoIGQ9Ik0yNTYgMjI1LjYyMmwtMTI4LjAzNSA2NC4wMTR2LTQ0LjkyMkwyNTYgMTk5LjMwNXYyNi4zMTciIGZpbGw9IiM3NTlDM0UiLz48cGF0aCBkPSJNMjIwLjAzOSAxNTUuNjkyaC0zMS4wMjZsLTg4LjQ0NSA2LjAyNkwxMjggMTY2Ljc3NWw5Mi4wMzktMTEuMDgzIiBmaWxsPSIjQjdDQTlEIi8+PHBhdGggZD0iTTEwMC41NjggMjE5LjkwNmwyNy40MiA4LjIyNi43ODktLjg0OS0uMDIzLTYxLjg0OS0uNzg5LS43NTgtMjcuMzk3LTIuOTU4djU4LjE4OCIgZmlsbD0iIzRCNjEyQyIvPjxwYXRoIGQ9Ik0yMjAuMDM5IDE1NS42OTJsLTkyLjA3NCA4Ljk4LjAyMyA2My40NiA5Mi4wNTEtMjcuNzExdi00NC43MjkiIGZpbGw9IiM3NTlDM0UiLz48L3N2Zz4K"
camel.apache.org/provider: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "AWS CloudWatch Metrics Sink"
description: |-
Send messages to AWS CloudWatch metrics.
You can set the Dimensions in the header, by using CamelAwsCwMetricDimensionName for the dimension name
and CamelAwsCwMetricDimensionValue for the dimension value.
Most of the property values can be defined in headers, overwriting any parameter previously defined:
- CamelAwsCwMetricNamespace
- CamelAwsCwMetricName
- CamelAwsCwMetricValue
- CamelAwsCwMetricUnit
- CamelAwsCwMetricTimestamp
- CamelAwsCwMetricDimensionName
- CamelAwsCwMetricDimensionValue
required:
- cw_namespace
- accessKey
- secretKey
- region
- metricName
- metricValue
properties:
cw_namespace:
title: Cloud Watch Namespace
description: The cloud watch metric namespace.
type: string
accessKey:
title: Access Key
description: The access key obtained from AWS.
type: string
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
secretKey:
title: Secret Key
description: The secret key obtained from AWS.
type: string
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
region:
title: AWS Region
description: The AWS region to connect to.
type: string
example: eu-west-1
metricName:
title: Metric Name
description: The metric name.
type: string
metricValue:
title: Metric Value
description: The metric value.
type: double
example: "1.2"
unit:
title: Metric Unit
description: The metric unit
type: string
timestamp:
title: Metric Timestamp
description: The metric timestamp.
type: long
flow:
from:
uri: kamelet:source
steps:
- to:
uri: "aws2-cw:{{cw_namespace}}"
parameters:
secretKey: "{{secretKey}}"
accessKey: "{{accessKey}}"
region: "{{region}}"
name: "{{metricName}}"
value: "{{metricValue}}"
unit: "{{unit}}"
timestamp: "{{timestamp}}"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
* xref:ROOT:aws-cloudwatch-sink.adoc[image:kamelets/aws-cloudwatch-sink.svg[] AWS CloudWatch Metrics Sink]
* xref:ROOT:aws-ddb-streams-source.adoc[image:kamelets/aws-ddb-streams-source.svg[] AWS DynamoDB Streams Source]
* xref:ROOT:aws-kinesis-firehose-sink.adoc[image:kamelets/aws-kinesis-firehose-sink.svg[] AWS Kinesis Firehose Sink]
* xref:ROOT:aws-kinesis-source.adoc[image:kamelets/aws-kinesis-source.svg[] AWS Kinesis Source]
Expand Down
84 changes: 84 additions & 0 deletions docs/modules/ROOT/pages/aws-cloudwatch-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/aws-cloudwatch-sink.svg[] AWS CloudWatch Metrics Sink

*Provided by: "Apache Software Foundation"*

Send messages to AWS CloudWatch metrics.

You can set the Dimensions in the header, by using CamelAwsCwMetricDimensionName for the dimension name
and CamelAwsCwMetricDimensionValue for the dimension value.

Most of the property values can be defined in headers, overwriting any parameter previously defined:
- CamelAwsCwMetricNamespace
- CamelAwsCwMetricName
- CamelAwsCwMetricValue
- CamelAwsCwMetricUnit
- CamelAwsCwMetricTimestamp
- CamelAwsCwMetricDimensionName
- CamelAwsCwMetricDimensionValue

== Configuration Options

The following table summarizes the configuration options available for the `aws-cloudwatch-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessKey {empty}* *| Access Key| The access key obtained from AWS.| string| |
| *cw_namespace {empty}* *| Cloud Watch Namespace| The cloud watch metric namespace.| string| |
| *metricName {empty}* *| Metric Name| The metric name.| string| |
| *metricValue {empty}* *| Metric Value| The metric value.| double| | `"1.2"`
| *region {empty}* *| AWS Region| The AWS region to connect to.| string| | `"eu-west-1"`
| *secretKey {empty}* *| Secret Key| The secret key obtained from AWS.| string| |
| timestamp| Metric Timestamp| The metric timestamp.| long| |
| unit| Metric Unit| The metric unit| string| |
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `aws-cloudwatch-sink` can be used in various contexts.

=== Knative Sink

The `aws-cloudwatch-sink` Kamelet can be used as Knative sink by binding it to a Knative object.

.aws-cloudwatch-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: aws-cloudwatch-sink-binding
spec:
source:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: aws-cloudwatch-sink
properties:
accessKey: "The Access Key"
cw_namespace: "The Cloud Watch Namespace"
metricName: "The Metric Name"
metricValue: "1.2"
region: "eu-west-1"
secretKey: "The Secret Key"
----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-cloudwatch-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f aws-cloudwatch-sink-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
10 changes: 7 additions & 3 deletions docs/modules/ROOT/pages/aws-s3-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

*Provided by: "Apache Software Foundation"*

Send data to AWS S3.
Upload data to AWS S3.

The Kamelet expects the following headers to be set:

- `file` / `ce-file`: as the file name to upload

If the header won't be set the exchange ID will be used as file name.

== Configuration Options

Expand All @@ -13,7 +19,6 @@ The following table summarizes the configuration options available for the `aws-
| Property| Name| Description| Type| Default| Example
| *accessKey {empty}* *| Access Key| The access key obtained from AWS.| string| |
| *bucketNameOrArn {empty}* *| Bucket Name| The S3 Bucket name or ARN.| string| |
| *filename {empty}* *| Filename (S3 Key)| The target filename created on S3.| string| |
| *region {empty}* *| AWS Region| The AWS region to connect to.| string| | `"eu-west-1"`
| *secretKey {empty}* *| Secret Key| The secret key obtained from AWS.| string| |
| autoCreateBucket| Autocreate bucket| Setting the autocreation of the S3 bucket bucketName.| boolean| `false`|
Expand Down Expand Up @@ -52,7 +57,6 @@ spec:
properties:
accessKey: "The Access Key"
bucketNameOrArn: "The Bucket Name"
filename: "The Filename (S3 Key)"
region: "eu-west-1"
secretKey: "The Secret Key"
Expand Down

0 comments on commit 676c99d

Please sign in to comment.