This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 0fcb54db4 chore: the Lambda, EC2 and Secrets Manager sinks can do more
than one operation, Translate can detect the language and use terminologies,
Polly can use lexicons (#3170) (#3235)
0fcb54db4 is described below
commit 0fcb54db4c087bc4d04cad27d19785de16e5bf9f
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 18 22:38:31 2026 +0100
chore: the Lambda, EC2 and Secrets Manager sinks can do more than one
operation, Translate can detect the language and use terminologies, Polly can
use lexicons (#3170) (#3235)
- aws-lambda-sink: `operation`, to read the settings, versions or aliases
of the function, list the functions of the region, or publish a new
version, instead of calling the function. Unset, the function is called
as before.
- aws-ec2-sink: `operation` (default describeInstancesStatus, as before):
also describeInstances, startInstances, stopInstances and
rebootInstances, which act on the instances of the instanceIds header.
Creating and terminating instances is not offered.
- aws-secrets-manager-sink: `operation` (default createSecret, as before):
also updateSecret and getSecret, which work on the secret in the new
`secretId` option (name or ARN) and fail when it is not set; createSecret
names the secret as before. And `binaryPayload`, to store the body as
the binary value of a secret.
- aws-translate-action: `autodetectSourceLanguage`, so `sourceLanguage` is
no longer required, and `terminologyNames`, set as the terminology names
header only when the option is set.
- aws-polly-sink: `lexiconNames`.
With the new options unset, the endpoint URIs are the same as on main.
Asynchronous Lambda invocation and paging of aws-timestream-query-sink
need a change in Camel first, so they are left out.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../ROOT/partials/aws-ec2-sink-description.adoc | 24 ++++-
.../ROOT/partials/aws-lambda-sink-description.adoc | 26 ++++++
.../ROOT/partials/aws-polly-sink-description.adoc | 15 +++
.../aws-secrets-manager-sink-description.adoc | 27 +++++-
.../partials/aws-translate-action-description.adoc | 20 ++++
kamelets/aws-ec2-sink.kamelet.yaml | 34 ++++---
kamelets/aws-lambda-sink.kamelet.yaml | 9 +-
kamelets/aws-polly-sink.kamelet.yaml | 9 +-
kamelets/aws-secrets-manager-sink.kamelet.yaml | 101 +++++++++++++++------
kamelets/aws-translate-action.kamelet.yaml | 31 ++++++-
.../main/resources/META-INF/kamelets-index.json | 14 +--
.../resources/kamelets/aws-ec2-sink.kamelet.yaml | 34 ++++---
.../kamelets/aws-lambda-sink.kamelet.yaml | 9 +-
.../resources/kamelets/aws-polly-sink.kamelet.yaml | 9 +-
.../kamelets/aws-secrets-manager-sink.kamelet.yaml | 101 +++++++++++++++------
.../kamelets/aws-translate-action.kamelet.yaml | 31 ++++++-
16 files changed, 393 insertions(+), 101 deletions(-)
diff --git a/docs/modules/ROOT/partials/aws-ec2-sink-description.adoc
b/docs/modules/ROOT/partials/aws-ec2-sink-description.adoc
index 8b930a732..5a0680ee1 100644
--- a/docs/modules/ROOT/partials/aws-ec2-sink-description.adoc
+++ b/docs/modules/ROOT/partials/aws-ec2-sink-description.adoc
@@ -23,7 +23,29 @@ For more information, see the
https://docs.aws.amazon.com/sdk-for-java/latest/de
The Kamelet reads the following optional header:
-- `instanceIds` / `ce-instanceids`: as a comma separated list of EC2 instance
ids. Without it, the status of all the running instances of the region is
returned.
+- `instanceIds` / `ce-instanceids`: as a comma separated list of EC2 instance
ids. Without it, the status of all the running instances of the region is
returned. To start, stop or reboot, it is required.
+
+=== Starting, Stopping and Rebooting Instances
+
+By default, the Kamelet only reads the status of the instances. Set
`operation` to choose another action:
+
+ - `describeInstancesStatus` (the default): the status of the instances and
the results of their status checks.
+ - `describeInstances`: the full details of the instances, such as their type,
image, IP addresses and tags.
+ - `startInstances`, `stopInstances` and `rebootInstances`: start, stop or
reboot the instances in the `instanceIds` header. Without the header, the
message fails with `Instances Ids must be specified`.
+
+The Kamelet cannot create or terminate instances.
+
+For example, to stop test machines every evening, a route sends a message with
the `instanceIds` header to this step:
+
+[source,yaml,subs='+attributes,macros']
+----
+- to:
+ uri: "kamelet:aws-ec2-sink"
+ parameters:
+ region: "eu-west-1"
+ useDefaultCredentialsProvider: true
+ operation: "stopInstances"
+----
=== Through an HTTP Proxy
diff --git a/docs/modules/ROOT/partials/aws-lambda-sink-description.adoc
b/docs/modules/ROOT/partials/aws-lambda-sink-description.adoc
index 13b1e2894..856e0a9b9 100644
--- a/docs/modules/ROOT/partials/aws-lambda-sink-description.adoc
+++ b/docs/modules/ROOT/partials/aws-lambda-sink-description.adoc
@@ -19,6 +19,32 @@ Only one of access key/secret key or default credentials
provider could be used
For more information, see the
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html[AWS
credentials documentation]
+=== Reading the Settings of a Function or Publishing a Version
+
+By default, the Kamelet calls the function for each message and waits for its
result. Set `operation` to do something else with the function named in
`function`:
+
+ - `getFunction` and `getFunctionConfiguration`: read the settings of the
function, such as its runtime, memory and timeout; `getFunction` adds the
location of its code and its tags.
+ - `listVersions` and `listAliases`: list the published versions and the
aliases of the function.
+ - `publishVersion`: publish the current code and settings of the function as
a new version.
+ - `listFunctions`: list all the functions of the region.
+
+These operations do not use the body. The body afterwards is the answer of
AWS, an object of the AWS SDK for Java, such as a
`GetFunctionConfigurationResponse`, not JSON text.
+
+The function cannot be called asynchronously (invocation type `Event`): each
call waits until the function ends.
+
+The step that sends to the Kamelet, in a route, to publish a new version of
the function:
+
+[source,yaml,subs='+attributes,macros']
+----
+- to:
+ uri: "kamelet:aws-lambda-sink"
+ parameters:
+ function: "my-function"
+ region: "eu-west-1"
+ useDefaultCredentialsProvider: true
+ operation: "publishVersion"
+----
+
=== Through an HTTP Proxy
Where AWS can be reached only through an HTTP proxy, as in many company
networks, set `proxyHost` and `proxyPort` to the proxy. `proxyProtocol` is how
the Kamelet talks to the proxy itself, not to AWS: it is `HTTPS` when it is not
set, so set it to `HTTP` for a proxy that takes plain HTTP, such as Squid. The
calls to AWS stay encrypted, as the proxy only passes them on. The Kamelet has
no option for a proxy user or password.
diff --git a/docs/modules/ROOT/partials/aws-polly-sink-description.adoc
b/docs/modules/ROOT/partials/aws-polly-sink-description.adoc
index 5f014260c..ffeabaf33 100644
--- a/docs/modules/ROOT/partials/aws-polly-sink-description.adoc
+++ b/docs/modules/ROOT/partials/aws-polly-sink-description.adoc
@@ -49,6 +49,21 @@ The following output formats are supported:
Set the `textType` parameter to `SSML` to use Speech Synthesis Markup Language
for fine-grained control over pronunciation, volume, pitch, and speech rate.
+=== Pronunciation Lexicons
+
+A pronunciation lexicon says how to pronounce given words, for example to say
`W3C` as `World Wide Web Consortium`. Store the lexicon in Polly beforehand, in
the PLS format, and name it in `lexiconNames`; several names are separated by
commas.
+
+[source,yaml,subs='+attributes,macros']
+----
+- to:
+ uri: "kamelet:aws-polly-sink"
+ parameters:
+ region: "eu-west-1"
+ useDefaultCredentialsProvider: true
+ voiceId: "Joanna"
+ lexiconNames: "w3c"
+----
+
=== Through an HTTP Proxy
Where AWS can be reached only through an HTTP proxy, as in many company
networks, set `proxyHost` and `proxyPort` to the proxy. `proxyProtocol` is how
the Kamelet talks to the proxy itself, not to AWS: it is `HTTPS` when it is not
set, so set it to `HTTP` for a proxy that takes plain HTTP, such as Squid. The
calls to AWS stay encrypted, as the proxy only passes them on. The Kamelet has
no option for a proxy user or password.
diff --git
a/docs/modules/ROOT/partials/aws-secrets-manager-sink-description.adoc
b/docs/modules/ROOT/partials/aws-secrets-manager-sink-description.adoc
index 9d35e562a..bc8cb2dde 100644
--- a/docs/modules/ROOT/partials/aws-secrets-manager-sink-description.adoc
+++ b/docs/modules/ROOT/partials/aws-secrets-manager-sink-description.adoc
@@ -23,10 +23,35 @@ For more information, see the
https://docs.aws.amazon.com/sdk-for-java/latest/de
The Kamelet reads the following header:
-- `secret-name` / `ce-secret-name`: as the secret name to create.
+- `secret-name` / `ce-secret-name`: as the name of the secret to create.
If the header is not set, the ID of the message is used as secret name.
+=== Changing or Reading a Secret
+
+By default, the Kamelet creates a new secret for each message, and a message
for a name that already exists fails. Set `operation` to work with the existing
secret named in `secretId`, by its name or its ARN:
+
+ - `createSecret` (the default): creates a new secret with the body as its
value, named from the `secret-name` header as above. `secretId` is not used.
+ - `updateSecret`: stores the body as the new value of the secret, as a new
version. The version before stays available as the previous one (`AWSPREVIOUS`).
+ - `getSecret`: reads the current value of the secret into the body, as text,
or as bytes for a binary secret. The `CamelAwsSecretsManagerSecretVersionId`
header holds the ID of the version that was read.
+
+`updateSecret` and `getSecret` need `secretId`: without it, each message fails
with `The secretId option must be set`. They also fail for a secret that does
not exist.
+
+With `binaryPayload` set to `true`, `createSecret` and `updateSecret` store
the bytes of the body as the binary value of the secret, for example a keystore
file, instead of as text.
+
+The step that sends to the Kamelet, in a route, to rotate a password, with the
new password in the body:
+
+[source,yaml,subs='+attributes,macros']
+----
+- to:
+ uri: "kamelet:aws-secrets-manager-sink"
+ parameters:
+ region: "eu-west-1"
+ useDefaultCredentialsProvider: true
+ operation: "updateSecret"
+ secretId: "prod/db-password"
+----
+
=== Through an HTTP Proxy
Where AWS can be reached only through an HTTP proxy, as in many company
networks, set `proxyHost` and `proxyPort` to the proxy. `proxyProtocol` is how
the Kamelet talks to the proxy itself, not to AWS: it is `HTTPS` when it is not
set, so set it to `HTTP` for a proxy that takes plain HTTP, such as Squid. The
calls to AWS stay encrypted, as the proxy only passes them on. The Kamelet has
no option for a proxy user or password.
diff --git a/docs/modules/ROOT/partials/aws-translate-action-description.adoc
b/docs/modules/ROOT/partials/aws-translate-action-description.adoc
index 0f3645a10..da628ce84 100644
--- a/docs/modules/ROOT/partials/aws-translate-action-description.adoc
+++ b/docs/modules/ROOT/partials/aws-translate-action-description.adoc
@@ -19,6 +19,26 @@ Only one of access key/secret key or default credentials
provider could be used
For more information, see the
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html[AWS
credentials documentation]
+=== Detecting the Language and Custom Terminologies
+
+When the messages come in different languages, set `autodetectSourceLanguage`
to `true` instead of `sourceLanguage`: Amazon Translate then detects the
language of each message. When both are set, the language is detected, and
`sourceLanguage` is not used.
+
+A custom terminology is a list of terms with their translations, such as
product or brand names that must not be translated. Create it in Amazon
Translate beforehand, and name it in `terminologyNames`; several names are
separated by commas.
+
+The step that sends to the Kamelet, in a route:
+
+[source,yaml,subs='+attributes,macros']
+----
+- to:
+ uri: "kamelet:aws-translate-action"
+ parameters:
+ region: "eu-west-1"
+ useDefaultCredentialsProvider: true
+ autodetectSourceLanguage: true
+ targetLanguage: "en"
+ terminologyNames: "product-names"
+----
+
=== Through an HTTP Proxy
Where AWS can be reached only through an HTTP proxy, as in many company
networks, set `proxyHost` and `proxyPort` to the proxy. `proxyProtocol` is how
the Kamelet talks to the proxy itself, not to AWS: it is `HTTPS` when it is not
set, so set it to `HTTP` for a proxy that takes plain HTTP, such as Squid. The
calls to AWS stay encrypted, as the proxy only passes them on. The Kamelet has
no option for a proxy user or password.
diff --git a/kamelets/aws-ec2-sink.kamelet.yaml
b/kamelets/aws-ec2-sink.kamelet.yaml
index 28dea49cb..bb0f40bb7 100644
--- a/kamelets/aws-ec2-sink.kamelet.yaml
+++ b/kamelets/aws-ec2-sink.kamelet.yaml
@@ -32,15 +32,15 @@ spec:
definition:
title: "AWS EC2 Sink"
description: |-
- Asks Amazon EC2 for the status of virtual machines (instances), such as
whether they run and pass their health checks, each time a message arrives.
+ Asks Amazon EC2 for the status of virtual machines (instances), such as
whether they run and pass their health checks, each time a message arrives, or
starts, stops or reboots them.
- Use it to check regularly that your EC2 instances are running and
healthy, for example every few minutes from `timer-source`, and raise an alert
when a check fails.
+ Use it to check regularly that your EC2 instances are running and
healthy, for example every few minutes from `timer-source`, and raise an alert
when a check fails, or to start and stop test machines on a schedule.
- Input: the body is not used. The optional `instanceIds` header (or
`ce-instanceids`) is a comma-separated list of the IDs of the instances to
check, such as `i-0abc123,i-0def456`; without it, the status of all the running
instances of the region is returned.
+ Input: the body is not used. The `instanceIds` header (or
`ce-instanceids`) is a comma-separated list of the IDs of the instances, such
as `i-0abc123,i-0def456`. For the status, it is optional; without it, the
status of all the running instances of the region is returned. To start, stop
or reboot, it is required.
- Output: the body is the answer of AWS, a
`DescribeInstanceStatusResponse` object of the AWS SDK for Java (not JSON
text), with for each instance its ID, availability zone, state (such as
`running`) and the results of the instance and system status checks. When there
are more results than fit, the `CamelAwsEC2NextToken` header holds the token of
the next page.
+ Output: the body is the answer of AWS, an object of the AWS SDK for Java
(not JSON text). By default, a `DescribeInstanceStatusResponse`, with for each
instance its ID, availability zone, state (such as `running`) and the results
of the instance and system status checks. When there are more results than fit,
the `CamelAwsEC2NextToken` header holds the token of the next page.
`describeInstances` gives a `DescribeInstancesResponse`, and `startInstances`
and `stopInstances` a `StartIn [...]
- Good to know: it only reads; it never starts, stops or changes an
instance. With Camel 4.23, the `instanceIds` header is ignored, and the status
of all the instances is returned. To reach AWS through an HTTP proxy, set
`proxyHost` and `proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that
takes plain HTTP, such as Squid.
+ Good to know: by default it only reads, and never starts, stops or
changes an instance; `operation` chooses another action. It cannot create or
terminate instances. With Camel 4.23, the `instanceIds` header is ignored: the
status of all the instances is returned, and start, stop and reboot reach no
instance. To reach AWS through an HTTP proxy, set `proxyHost` and `proxyPort`,
and set `proxyProtocol` to `HTTP` for a proxy that takes plain HTTP, such as
Squid.
required:
- region
type: object
@@ -118,16 +118,23 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ operation:
+ title: Operation
+ description: "What to do with each message: `describeInstancesStatus`
gives the status of the instances and the results of their status checks;
`describeInstances` gives their full details, such as type, image, IP addresses
and tags; `startInstances`, `stopInstances` and `rebootInstances` start, stop
or reboot the instances in the `instanceIds` header, which is then required."
+ type: string
+ default: describeInstancesStatus
+ example: stopInstances
+ enum: ["describeInstancesStatus", "describeInstances",
"startInstances", "stopInstances", "rebootInstances"]
dataTypes:
in:
headers:
instanceIds:
title: Instance IDs
- description: A comma-separated list of the IDs of the instances to
check, such as `i-0abc123,i-0def456`. When it is not set, `ce-instanceids` is
used, and without either the status of all the running instances is returned.
+ description: A comma-separated list of the IDs of the instances,
such as `i-0abc123,i-0def456`. When it is not set, `ce-instanceids` is used.
For the status, without either the status of all the running instances is
returned; to start, stop or reboot, one of them is required.
type: string
ce-instanceids:
title: Instance IDs (CloudEvents)
- description: The IDs of the instances to check, when the message is
a CloudEvent. Used only when `instanceIds` is not set.
+ description: The IDs of the instances, when the message is a
CloudEvent. Used only when `instanceIds` is not set.
type: string
out:
headers:
@@ -143,11 +150,12 @@ spec:
uri: kamelet:source
steps:
# Strip the whole camel-aws2-ec2 header family up-front, before this
- # Kamelet applies its own contract below: the operation is pinned to
the
- # read-only describeInstancesStatus and instanceIds / ce-instanceids is
- # the only interface the definition advertises. Using a pattern also
- # covers CamelAwsEC2* keys the component may add in the future. The
- # pagination headers that describeInstancesStatus itself reads are
kept.
+ # Kamelet applies its own contract below: the operation comes only from
+ # the operation option (by default the read-only
describeInstancesStatus)
+ # and instanceIds / ce-instanceids is the only interface the definition
+ # advertises. Using a pattern also covers CamelAwsEC2* keys the
component
+ # may add in the future. The pagination headers that
+ # describeInstancesStatus and describeInstances read are kept.
- removeHeaders:
pattern: CamelAwsEC2*
excludePattern: CamelAwsEC2(NextToken|MaxResults)
@@ -176,7 +184,7 @@ spec:
parameters:
label: ec2-route
accessKey: "RAW({{?accessKey}})"
- operation: describeInstancesStatus
+ operation: "{{operation}}"
overrideEndpoint: "{{overrideEndpoint}}"
profileCredentialsName: "{{?profileCredentialsName}}"
region: "{{region}}"
diff --git a/kamelets/aws-lambda-sink.kamelet.yaml
b/kamelets/aws-lambda-sink.kamelet.yaml
index 5a8d8ed4d..aa5c94e58 100644
--- a/kamelets/aws-lambda-sink.kamelet.yaml
+++ b/kamelets/aws-lambda-sink.kamelet.yaml
@@ -40,7 +40,7 @@ spec:
Output: when it is used inside a route, the body afterwards is what the
function returned, as text (JSON text for most functions). The
`CamelAwsLambdaStatusCode` header holds the status code of the call.
- Good to know: an error raised inside the function does not fail the
message: the body is then the error that the function reported, and the
`CamelAwsLambdaFunctionError` header is set, for example to `Unhandled`. A
function that does not exist fails the message. Each call waits until the
function ends. To reach AWS through an HTTP proxy, set `proxyHost` and
`proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that takes plain
HTTP, such as Squid.
+ Good to know: an error raised inside the function does not fail the
message: the body is then the error that the function reported, and the
`CamelAwsLambdaFunctionError` header is set, for example to `Unhandled`. A
function that does not exist fails the message. Each call waits until the
function ends; the function cannot be called asynchronously (invocation type
`Event`). Set `operation` to read the settings, versions or aliases of the
function instead of calling it, or to publish [...]
required:
- function
- region
@@ -114,6 +114,12 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ operation:
+ title: Operation
+ description: "What to do with each message: `invokeFunction` calls the
function; `getFunction` and `getFunctionConfiguration` read the settings of the
function, such as its runtime, memory and timeout (`getFunction` adds the
location of its code and its tags); `listVersions` and `listAliases` list its
published versions and aliases; `publishVersion` publishes the current code and
settings as a new version; `listFunctions` lists all the functions of the
region. Only `invokeFunctio [...]
+ type: string
+ example: getFunctionConfiguration
+ enum: ["invokeFunction", "getFunction", "getFunctionConfiguration",
"listVersions", "listAliases", "publishVersion", "listFunctions"]
dataTypes:
out:
headers:
@@ -147,3 +153,4 @@ spec:
proxyHost: "{{?proxyHost}}"
proxyPort: "{{?proxyPort}}"
proxyProtocol: "{{?proxyProtocol}}"
+ operation: "{{?operation}}"
diff --git a/kamelets/aws-polly-sink.kamelet.yaml
b/kamelets/aws-polly-sink.kamelet.yaml
index 133bfbf01..18b3ae6b7 100644
--- a/kamelets/aws-polly-sink.kamelet.yaml
+++ b/kamelets/aws-polly-sink.kamelet.yaml
@@ -40,7 +40,7 @@ spec:
Output: when it is used inside a route, the body afterwards is the
audio, as a stream in the format of `outputFormat`, and the
`CamelAwsPollyContentType` header holds its content type, such as `audio/mpeg`.
- Good to know: the stream can be read only once, so write it to a file or
a bucket right away. A voice that is not available with the chosen `engine`
fails the message. To reach AWS through an HTTP proxy, set `proxyHost` and
`proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that takes plain
HTTP, such as Squid.
+ Good to know: the stream can be read only once, so write it to a file or
a bucket right away. A voice that is not available with the chosen `engine`
fails the message. To change how words are pronounced, such as an abbreviation
or a product name, store a pronunciation lexicon in Polly and name it in
`lexiconNames`. To reach AWS through an HTTP proxy, set `proxyHost` and
`proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that takes plain
HTTP, such as Squid.
required:
- region
type: object
@@ -150,6 +150,12 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ lexiconNames:
+ title: Lexicon Names
+ description: "The names of pronunciation lexicons to apply, separated
by commas, such as `w3c,acronyms`. A lexicon says how to pronounce given words,
for example to say `W3C` as `World Wide Web Consortium`; you store it in Polly
beforehand, in the PLS format, under a name of letters and digits only. When it
is not set, no lexicon is applied."
+ type: string
+ pattern: "^[0-9A-Za-z]{1,20}(,[0-9A-Za-z]{1,20})*$"
+ example: w3c
dataTypes:
in:
headers:
@@ -194,3 +200,4 @@ spec:
proxyHost: "{{?proxyHost}}"
proxyPort: "{{?proxyPort}}"
proxyProtocol: "{{?proxyProtocol}}"
+ lexiconNames: "{{?lexiconNames}}"
diff --git a/kamelets/aws-secrets-manager-sink.kamelet.yaml
b/kamelets/aws-secrets-manager-sink.kamelet.yaml
index e76526dc5..bb52e63fd 100644
--- a/kamelets/aws-secrets-manager-sink.kamelet.yaml
+++ b/kamelets/aws-secrets-manager-sink.kamelet.yaml
@@ -32,15 +32,15 @@ spec:
definition:
title: "AWS Secrets Manager Sink"
description: |-
- Creates a new secret in AWS Secrets Manager for each message, with the
body as the value of the secret.
+ Creates a secret in AWS Secrets Manager for each message, with the body
as its value, or changes or reads the value of an existing secret.
- Use it to store passwords, API keys or certificates that another system
generates, so that your applications can read them from Secrets Manager.
+ Use it to store passwords, API keys or certificates that another system
generates, so that your applications can read them from Secrets Manager, to
rotate such a value, or to read one inside a route.
- Input: the body is the value of the secret, as text, for example a
password, or several values as a JSON object in JSON text. The name of the
secret comes from the `secret-name` header, else from the `ce-secret-name`
header; without either, the ID of the message is used as the name.
+ Input: the body is the value of the secret, as text, for example a
password, or several values as a JSON object in JSON text. With `operation` set
to `getSecret`, the body is not used. For `createSecret`, the name of the new
secret comes from the `secret-name` header, else from the `ce-secret-name`
header; without either, the ID of the message is used as the name.
`updateSecret` and `getSecret` work on the secret in `secretId`.
- Output: when it is used inside a route, the body afterwards is the
answer of AWS, a `CreateSecretResponse` object of the AWS SDK for Java with the
ARN, the name and the version ID of the new secret.
+ Output: when it is used inside a route, the body afterwards is the
answer of AWS, a `CreateSecretResponse` object of the AWS SDK for Java with the
ARN, the name and the version ID of the new secret; for `updateSecret`, an
`UpdateSecretResponse` with the ARN, the name and the new version ID. For
`getSecret`, the body is the value of the secret, as text, or as bytes for a
binary secret, and the `CamelAwsSecretsManagerSecretVersionId` header holds the
ID of its version.
- Good to know: it only creates secrets. A message for a name that already
exists fails, so it cannot change the value of an existing secret. A message
without a name header creates a secret with a generated name, such as
`4D678616B8AFAA1-0000000000000002`. To reach AWS through an HTTP proxy, set
`proxyHost` and `proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that
takes plain HTTP, such as Squid.
+ Good to know: by default it only creates secrets, and a message for a
name that already exists fails. Set `operation` to `updateSecret` to change the
value of the existing secret in `secretId`, or to `getSecret` to read it; both
fail when `secretId` is not set or the secret does not exist. A message without
a name header creates a secret with a generated name, such as
`4D678616B8AFAA1-0000000000000002`. With `binaryPayload`, the body is stored as
the binary value of the secret inst [...]
required:
- region
type: object
@@ -108,6 +108,24 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ operation:
+ title: Operation
+ description: "What to do with each message: `createSecret` creates a
new secret with the body as its value; `updateSecret` stores the body as the
new value of an existing secret, as a new version; `getSecret` reads the
current value of an existing secret into the body. `createSecret` names the new
secret from the `secret-name` header; `updateSecret` and `getSecret` work on
the secret in `secretId`, which they need."
+ type: string
+ default: createSecret
+ example: updateSecret
+ enum: ["createSecret", "updateSecret", "getSecret"]
+ secretId:
+ title: Secret ID
+ description: "The name or the ARN of the secret that `updateSecret`
and `getSecret` work on, such as `prod/db-password`. Required for these two
operations: without it, each of their messages fails with `The secretId option
must be set`. Not used by `createSecret`."
+ type: string
+ pattern: "^[A-Za-z0-9/_+=.@:-]+$"
+ example: prod/db-password
+ binaryPayload:
+ title: Binary Payload
+ description: If true, `createSecret` and `updateSecret` store the
bytes of the body as the binary value of the secret (`SecretBinary`), for
example a keystore file, instead of as text (`SecretString`). `getSecret` gives
the bytes of a binary secret whatever this option says. When it is not set, the
value is stored as text.
+ type: boolean
+ example: true
dataTypes:
in:
headers:
@@ -119,6 +137,12 @@ spec:
title: Secret Name (CloudEvents)
description: The name of the secret to create, when the message is a
CloudEvent. Used only when `secret-name` is not set.
type: string
+ out:
+ headers:
+ CamelAwsSecretsManagerSecretVersionId:
+ title: Secret Version ID
+ description: Set by `getSecret`; the ID of the version of the secret
that was read.
+ type: string
dependencies:
- "camel:aws-secrets-manager"
- "camel:kamelet"
@@ -130,35 +154,59 @@ spec:
when:
- expression:
simple:
- expression: "${header[secret-name]}"
- steps:
- - setHeader:
- name: CamelAwsSecretsManagerSecretName
- expression:
- simple:
- expression: "${header[secret-name]}"
- - expression:
- simple:
- expression: "${header[ce-secret-name]}"
+ expression: "'{{operation}}' == 'createSecret'"
steps:
- - setHeader:
- name: CamelAwsSecretsManagerSecretName
- expression:
- simple:
- expression: "${header[ce-secret-name]}"
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header[secret-name]}"
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretName
+ expression:
+ simple:
+ expression: "${header[secret-name]}"
+ - expression:
+ simple:
+ expression: "${header[ce-secret-name]}"
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretName
+ expression:
+ simple:
+ expression: "${header[ce-secret-name]}"
+ otherwise:
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretName
+ expression:
+ simple:
+ expression: "${exchangeId}"
otherwise:
steps:
- - setHeader:
- name: CamelAwsSecretsManagerSecretName
- expression:
- simple:
- expression: "${exchangeId}"
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "'{{?secretId}}' == ''"
+ steps:
+ - throwException:
+ exceptionType: java.lang.IllegalArgumentException
+ message: "The secretId option must be set for
the {{operation}} operation"
+ otherwise:
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretId
+ expression:
+ constant:
+ expression: "{{?secretId}}"
- to:
uri: aws-secrets-manager
parameters:
label: kamelet
accessKey: "RAW({{?accessKey}})"
- operation: createSecret
+ operation: "{{operation}}"
profileCredentialsName: "{{?profileCredentialsName}}"
region: "{{region}}"
secretKey: "RAW({{?secretKey}})"
@@ -169,3 +217,4 @@ spec:
proxyHost: "{{?proxyHost}}"
proxyPort: "{{?proxyPort}}"
proxyProtocol: "{{?proxyProtocol}}"
+ binaryPayload: "{{?binaryPayload}}"
diff --git a/kamelets/aws-translate-action.kamelet.yaml
b/kamelets/aws-translate-action.kamelet.yaml
index 57292e3c0..cfc5e5450 100644
--- a/kamelets/aws-translate-action.kamelet.yaml
+++ b/kamelets/aws-translate-action.kamelet.yaml
@@ -34,16 +34,15 @@ spec:
description: |-
Translates the text of each message from one language into another with
Amazon Translate.
- Use it to translate customer messages, support tickets or product
descriptions, for example from Italian into English before they are analyzed or
stored.
+ Use it to translate customer messages, support tickets or product
descriptions, for example from Italian into English before they are analyzed or
stored, also when the messages come in several languages.
Input: the body is the text to translate.
Output: the body is the translated text.
- Good to know: both languages are fixed by the options. Only the listed
language codes can be chosen, although Amazon Translate knows more languages.
To reach AWS through an HTTP proxy, set `proxyHost` and `proxyPort`, and set
`proxyProtocol` to `HTTP` for a proxy that takes plain HTTP, such as Squid.
+ Good to know: the target language is fixed by `targetLanguage`. The
source language is fixed by `sourceLanguage`, or, with
`autodetectSourceLanguage`, Amazon Translate detects it in each message. Only
the listed language codes can be chosen, although Amazon Translate knows more
languages. With `terminologyNames`, your own translations of terms, such as
product and brand names, are applied. To reach AWS through an HTTP proxy, set
`proxyHost` and `proxyPort`, and set `proxyProtocol` [...]
required:
- region
- - sourceLanguage
- targetLanguage
type: object
properties:
@@ -69,7 +68,7 @@ spec:
enum: ["ap-south-1", "eu-south-1", "us-gov-east-1", "me-central-1",
"ca-central-1", "eu-central-1", "us-iso-west-1", "us-west-1", "us-west-2",
"af-south-1", "eu-north-1", "eu-west-3", "eu-west-2", "eu-west-1",
"ap-northeast-3", "ap-northeast-2", "ap-northeast-1", "me-south-1",
"sa-east-1", "ap-east-1", "cn-north-1", "us-gov-west-1", "ap-southeast-1",
"ap-southeast-2", "us-iso-east-1", "ap-southeast-3", "us-east-1", "us-east-2",
"cn-northwest-1", "us-isob-east-1", "aws-global", "a [...]
sourceLanguage:
title: Source Language
- description: The language of the text, as a language code, such as
`it` for Italian or `en` for English.
+ description: The language of the text, as a language code, such as
`it` for Italian or `en` for English. Required, unless
`autodetectSourceLanguage` is true; without either, a message fails unless it
carries the `CamelAwsTranslateSourceLanguage` header.
type: string
example: it
enum: ["ar", "zh", "zh-TW", "cs", "da", "nl", "en", "fi", "fr", "de",
"he", "hi", "id", "it", "ja", "ko", "ms", "no", "fa", "pl", "pt", "ru", "es",
"sv", "tr"]
@@ -122,6 +121,17 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ autodetectSourceLanguage:
+ title: Detect Source Language
+ description: If true, Amazon Translate detects the language of each
message, so messages in different languages can be translated into
`targetLanguage`; `sourceLanguage` is then not used. When it is not set, the
language is `sourceLanguage`.
+ type: boolean
+ example: true
+ terminologyNames:
+ title: Terminology Names
+ description: The name of a custom terminology to apply, such as
`product-names`. A custom terminology is a list of terms with their
translations, such as brand names that must not be translated, which you create
in Amazon Translate beforehand. Several names are separated by commas. When it
is not set, no custom terminology is used.
+ type: string
+ pattern: "^([A-Za-z0-9-]_?)+(,([A-Za-z0-9-]_?)+)*$"
+ example: product-names
dependencies:
- "camel:kamelet"
- "camel:aws2-translate"
@@ -129,5 +139,16 @@ spec:
from:
uri: kamelet:source
steps:
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "'{{?terminologyNames}}' != ''"
+ steps:
+ - setHeader:
+ name: CamelAwsTranslateTerminologyNames
+ expression:
+ simple:
+ expression: "${split('{{?terminologyNames}}',',')}"
- to:
- uri:
"aws2-translate://translate?accessKey=RAW({{?accessKey}})&profileCredentialsName={{?profileCredentialsName}}®ion={{region}}&secretKey=RAW({{?secretKey}})&sessionToken=RAW({{?sessionToken}})&sourceLanguage={{sourceLanguage}}&targetLanguage={{targetLanguage}}&useDefaultCredentialsProvider={{useDefaultCredentialsProvider}}&useProfileCredentialsProvider={{useProfileCredentialsProvider}}&useSessionCredentials={{useSessionCredentials}}&proxyHost={{?proxyHost}}&proxyPort={{?
[...]
+ uri:
"aws2-translate://translate?accessKey=RAW({{?accessKey}})&profileCredentialsName={{?profileCredentialsName}}®ion={{region}}&secretKey=RAW({{?secretKey}})&sessionToken=RAW({{?sessionToken}})&sourceLanguage={{?sourceLanguage}}&targetLanguage={{targetLanguage}}&useDefaultCredentialsProvider={{useDefaultCredentialsProvider}}&useProfileCredentialsProvider={{useProfileCredentialsProvider}}&useSessionCredentials={{useSessionCredentials}}&proxyHost={{?proxyHost}}&proxyPort={{
[...]
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 43265e3ef..6600e8c3c 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -104,8 +104,8 @@
"type" : "sink",
"supportLevel" : "Stable",
"title" : "AWS EC2 Sink",
- "summary" : "Asks Amazon EC2 for the status of virtual machines
(instances), such as whether they run and pass their health checks, each time a
message arrives.",
- "description" : "Asks Amazon EC2 for the status of virtual machines
(instances), such as whether they run and pass their health checks, each time a
message arrives.\n\nUse it to check regularly that your EC2 instances are
running and healthy, for example every few minutes from `timer-source`, and
raise an alert when a check fails.\n\nInput: the body is not used. The optional
`instanceIds` header (or `ce-instanceids`) is a comma-separated list of the IDs
of the instances to check, suc [...]
+ "summary" : "Asks Amazon EC2 for the status of virtual machines
(instances), such as whether they run and pass their health checks, each time a
message arrives, or starts, stops or reboots them.",
+ "description" : "Asks Amazon EC2 for the status of virtual machines
(instances), such as whether they run and pass their health checks, each time a
message arrives, or starts, stops or reboots them.\n\nUse it to check regularly
that your EC2 instances are running and healthy, for example every few minutes
from `timer-source`, and raise an alert when a check fails, or to start and
stop test machines on a schedule.\n\nInput: the body is not used. The
`instanceIds` header (or `ce-instan [...]
"group" : "AWS EC2",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
@@ -155,7 +155,7 @@
"supportLevel" : "Stable",
"title" : "AWS Lambda Sink",
"summary" : "Calls an AWS Lambda function for each message, with the body
as the event of the function, and waits for its result.",
- "description" : "Calls an AWS Lambda function for each message, with the
body as the event of the function, and waits for its result.\n\nUse it to run
your own serverless code on each message, such as enriching an order, checking
a document or calling another API, without running a server for it.\n\nInput:
the body is the event given to the function, as JSON text, such as
`{\"orderId\":\"A-1\"}`. Turn structured data such as a Map into JSON text
first, for example with `json-serializ [...]
+ "description" : "Calls an AWS Lambda function for each message, with the
body as the event of the function, and waits for its result.\n\nUse it to run
your own serverless code on each message, such as enriching an order, checking
a document or calling another API, without running a server for it.\n\nInput:
the body is the event given to the function, as JSON text, such as
`{\"orderId\":\"A-1\"}`. Turn structured data such as a Map into JSON text
first, for example with `json-serializ [...]
"group" : "AWS Lambda",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
@@ -165,7 +165,7 @@
"supportLevel" : "Preview",
"title" : "AWS Polly Sink",
"summary" : "Turns the text of each message into speech with Amazon Polly,
and gives the audio, such as an MP3 file.",
- "description" : "Turns the text of each message into speech with Amazon
Polly, and gives the audio, such as an MP3 file.\n\nUse it to create voice
messages, audio versions of articles or spoken announcements from text. Write
the audio to a file or a bucket as the next step, for example with
`aws-s3-sink`.\n\nInput: the body is the text to speak, as plain text, or as
SSML when `textType` is `SSML`. The voice comes from `voiceId`, or when that is
not set from the `CamelAwsPollyVoiceId` [...]
+ "description" : "Turns the text of each message into speech with Amazon
Polly, and gives the audio, such as an MP3 file.\n\nUse it to create voice
messages, audio versions of articles or spoken announcements from text. Write
the audio to a file or a bucket as the next step, for example with
`aws-s3-sink`.\n\nInput: the body is the text to speak, as plain text, or as
SSML when `textType` is `SSML`. The voice comes from `voiceId`, or when that is
not set from the `CamelAwsPollyVoiceId` [...]
"group" : "AWS Polly",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
@@ -234,8 +234,8 @@
"type" : "sink",
"supportLevel" : "Stable",
"title" : "AWS Secrets Manager Sink",
- "summary" : "Creates a new secret in AWS Secrets Manager for each message,
with the body as the value of the secret.",
- "description" : "Creates a new secret in AWS Secrets Manager for each
message, with the body as the value of the secret.\n\nUse it to store
passwords, API keys or certificates that another system generates, so that your
applications can read them from Secrets Manager.\n\nInput: the body is the
value of the secret, as text, for example a password, or several values as a
JSON object in JSON text. The name of the secret comes from the `secret-name`
header, else from the `ce-secret-name` [...]
+ "summary" : "Creates a secret in AWS Secrets Manager for each message,
with the body as its value, or changes or reads the value of an existing
secret.",
+ "description" : "Creates a secret in AWS Secrets Manager for each message,
with the body as its value, or changes or reads the value of an existing
secret.\n\nUse it to store passwords, API keys or certificates that another
system generates, so that your applications can read them from Secrets Manager,
to rotate such a value, or to read one inside a route.\n\nInput: the body is
the value of the secret, as text, for example a password, or several values as
a JSON object in JSON text. [...]
"group" : "AWS Secrets Manager",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
@@ -325,7 +325,7 @@
"supportLevel" : "Stable",
"title" : "AWS Translate Action",
"summary" : "Translates the text of each message from one language into
another with Amazon Translate.",
- "description" : "Translates the text of each message from one language
into another with Amazon Translate.\n\nUse it to translate customer messages,
support tickets or product descriptions, for example from Italian into English
before they are analyzed or stored.\n\nInput: the body is the text to
translate.\n\nOutput: the body is the translated text.\n\nGood to know: both
languages are fixed by the options. Only the listed language codes can be
chosen, although Amazon Translate knows [...]
+ "description" : "Translates the text of each message from one language
into another with Amazon Translate.\n\nUse it to translate customer messages,
support tickets or product descriptions, for example from Italian into English
before they are analyzed or stored, also when the messages come in several
languages.\n\nInput: the body is the text to translate.\n\nOutput: the body is
the translated text.\n\nGood to know: the target language is fixed by
`targetLanguage`. The source languag [...]
"group" : "AWS Translate",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-ec2-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-ec2-sink.kamelet.yaml
index 28dea49cb..bb0f40bb7 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/aws-ec2-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-ec2-sink.kamelet.yaml
@@ -32,15 +32,15 @@ spec:
definition:
title: "AWS EC2 Sink"
description: |-
- Asks Amazon EC2 for the status of virtual machines (instances), such as
whether they run and pass their health checks, each time a message arrives.
+ Asks Amazon EC2 for the status of virtual machines (instances), such as
whether they run and pass their health checks, each time a message arrives, or
starts, stops or reboots them.
- Use it to check regularly that your EC2 instances are running and
healthy, for example every few minutes from `timer-source`, and raise an alert
when a check fails.
+ Use it to check regularly that your EC2 instances are running and
healthy, for example every few minutes from `timer-source`, and raise an alert
when a check fails, or to start and stop test machines on a schedule.
- Input: the body is not used. The optional `instanceIds` header (or
`ce-instanceids`) is a comma-separated list of the IDs of the instances to
check, such as `i-0abc123,i-0def456`; without it, the status of all the running
instances of the region is returned.
+ Input: the body is not used. The `instanceIds` header (or
`ce-instanceids`) is a comma-separated list of the IDs of the instances, such
as `i-0abc123,i-0def456`. For the status, it is optional; without it, the
status of all the running instances of the region is returned. To start, stop
or reboot, it is required.
- Output: the body is the answer of AWS, a
`DescribeInstanceStatusResponse` object of the AWS SDK for Java (not JSON
text), with for each instance its ID, availability zone, state (such as
`running`) and the results of the instance and system status checks. When there
are more results than fit, the `CamelAwsEC2NextToken` header holds the token of
the next page.
+ Output: the body is the answer of AWS, an object of the AWS SDK for Java
(not JSON text). By default, a `DescribeInstanceStatusResponse`, with for each
instance its ID, availability zone, state (such as `running`) and the results
of the instance and system status checks. When there are more results than fit,
the `CamelAwsEC2NextToken` header holds the token of the next page.
`describeInstances` gives a `DescribeInstancesResponse`, and `startInstances`
and `stopInstances` a `StartIn [...]
- Good to know: it only reads; it never starts, stops or changes an
instance. With Camel 4.23, the `instanceIds` header is ignored, and the status
of all the instances is returned. To reach AWS through an HTTP proxy, set
`proxyHost` and `proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that
takes plain HTTP, such as Squid.
+ Good to know: by default it only reads, and never starts, stops or
changes an instance; `operation` chooses another action. It cannot create or
terminate instances. With Camel 4.23, the `instanceIds` header is ignored: the
status of all the instances is returned, and start, stop and reboot reach no
instance. To reach AWS through an HTTP proxy, set `proxyHost` and `proxyPort`,
and set `proxyProtocol` to `HTTP` for a proxy that takes plain HTTP, such as
Squid.
required:
- region
type: object
@@ -118,16 +118,23 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ operation:
+ title: Operation
+ description: "What to do with each message: `describeInstancesStatus`
gives the status of the instances and the results of their status checks;
`describeInstances` gives their full details, such as type, image, IP addresses
and tags; `startInstances`, `stopInstances` and `rebootInstances` start, stop
or reboot the instances in the `instanceIds` header, which is then required."
+ type: string
+ default: describeInstancesStatus
+ example: stopInstances
+ enum: ["describeInstancesStatus", "describeInstances",
"startInstances", "stopInstances", "rebootInstances"]
dataTypes:
in:
headers:
instanceIds:
title: Instance IDs
- description: A comma-separated list of the IDs of the instances to
check, such as `i-0abc123,i-0def456`. When it is not set, `ce-instanceids` is
used, and without either the status of all the running instances is returned.
+ description: A comma-separated list of the IDs of the instances,
such as `i-0abc123,i-0def456`. When it is not set, `ce-instanceids` is used.
For the status, without either the status of all the running instances is
returned; to start, stop or reboot, one of them is required.
type: string
ce-instanceids:
title: Instance IDs (CloudEvents)
- description: The IDs of the instances to check, when the message is
a CloudEvent. Used only when `instanceIds` is not set.
+ description: The IDs of the instances, when the message is a
CloudEvent. Used only when `instanceIds` is not set.
type: string
out:
headers:
@@ -143,11 +150,12 @@ spec:
uri: kamelet:source
steps:
# Strip the whole camel-aws2-ec2 header family up-front, before this
- # Kamelet applies its own contract below: the operation is pinned to
the
- # read-only describeInstancesStatus and instanceIds / ce-instanceids is
- # the only interface the definition advertises. Using a pattern also
- # covers CamelAwsEC2* keys the component may add in the future. The
- # pagination headers that describeInstancesStatus itself reads are
kept.
+ # Kamelet applies its own contract below: the operation comes only from
+ # the operation option (by default the read-only
describeInstancesStatus)
+ # and instanceIds / ce-instanceids is the only interface the definition
+ # advertises. Using a pattern also covers CamelAwsEC2* keys the
component
+ # may add in the future. The pagination headers that
+ # describeInstancesStatus and describeInstances read are kept.
- removeHeaders:
pattern: CamelAwsEC2*
excludePattern: CamelAwsEC2(NextToken|MaxResults)
@@ -176,7 +184,7 @@ spec:
parameters:
label: ec2-route
accessKey: "RAW({{?accessKey}})"
- operation: describeInstancesStatus
+ operation: "{{operation}}"
overrideEndpoint: "{{overrideEndpoint}}"
profileCredentialsName: "{{?profileCredentialsName}}"
region: "{{region}}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-lambda-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-lambda-sink.kamelet.yaml
index 5a8d8ed4d..aa5c94e58 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/aws-lambda-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-lambda-sink.kamelet.yaml
@@ -40,7 +40,7 @@ spec:
Output: when it is used inside a route, the body afterwards is what the
function returned, as text (JSON text for most functions). The
`CamelAwsLambdaStatusCode` header holds the status code of the call.
- Good to know: an error raised inside the function does not fail the
message: the body is then the error that the function reported, and the
`CamelAwsLambdaFunctionError` header is set, for example to `Unhandled`. A
function that does not exist fails the message. Each call waits until the
function ends. To reach AWS through an HTTP proxy, set `proxyHost` and
`proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that takes plain
HTTP, such as Squid.
+ Good to know: an error raised inside the function does not fail the
message: the body is then the error that the function reported, and the
`CamelAwsLambdaFunctionError` header is set, for example to `Unhandled`. A
function that does not exist fails the message. Each call waits until the
function ends; the function cannot be called asynchronously (invocation type
`Event`). Set `operation` to read the settings, versions or aliases of the
function instead of calling it, or to publish [...]
required:
- function
- region
@@ -114,6 +114,12 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ operation:
+ title: Operation
+ description: "What to do with each message: `invokeFunction` calls the
function; `getFunction` and `getFunctionConfiguration` read the settings of the
function, such as its runtime, memory and timeout (`getFunction` adds the
location of its code and its tags); `listVersions` and `listAliases` list its
published versions and aliases; `publishVersion` publishes the current code and
settings as a new version; `listFunctions` lists all the functions of the
region. Only `invokeFunctio [...]
+ type: string
+ example: getFunctionConfiguration
+ enum: ["invokeFunction", "getFunction", "getFunctionConfiguration",
"listVersions", "listAliases", "publishVersion", "listFunctions"]
dataTypes:
out:
headers:
@@ -147,3 +153,4 @@ spec:
proxyHost: "{{?proxyHost}}"
proxyPort: "{{?proxyPort}}"
proxyProtocol: "{{?proxyProtocol}}"
+ operation: "{{?operation}}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-polly-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-polly-sink.kamelet.yaml
index 133bfbf01..18b3ae6b7 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/aws-polly-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-polly-sink.kamelet.yaml
@@ -40,7 +40,7 @@ spec:
Output: when it is used inside a route, the body afterwards is the
audio, as a stream in the format of `outputFormat`, and the
`CamelAwsPollyContentType` header holds its content type, such as `audio/mpeg`.
- Good to know: the stream can be read only once, so write it to a file or
a bucket right away. A voice that is not available with the chosen `engine`
fails the message. To reach AWS through an HTTP proxy, set `proxyHost` and
`proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that takes plain
HTTP, such as Squid.
+ Good to know: the stream can be read only once, so write it to a file or
a bucket right away. A voice that is not available with the chosen `engine`
fails the message. To change how words are pronounced, such as an abbreviation
or a product name, store a pronunciation lexicon in Polly and name it in
`lexiconNames`. To reach AWS through an HTTP proxy, set `proxyHost` and
`proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that takes plain
HTTP, such as Squid.
required:
- region
type: object
@@ -150,6 +150,12 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ lexiconNames:
+ title: Lexicon Names
+ description: "The names of pronunciation lexicons to apply, separated
by commas, such as `w3c,acronyms`. A lexicon says how to pronounce given words,
for example to say `W3C` as `World Wide Web Consortium`; you store it in Polly
beforehand, in the PLS format, under a name of letters and digits only. When it
is not set, no lexicon is applied."
+ type: string
+ pattern: "^[0-9A-Za-z]{1,20}(,[0-9A-Za-z]{1,20})*$"
+ example: w3c
dataTypes:
in:
headers:
@@ -194,3 +200,4 @@ spec:
proxyHost: "{{?proxyHost}}"
proxyPort: "{{?proxyPort}}"
proxyProtocol: "{{?proxyProtocol}}"
+ lexiconNames: "{{?lexiconNames}}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-secrets-manager-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-secrets-manager-sink.kamelet.yaml
index e76526dc5..bb52e63fd 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/aws-secrets-manager-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-secrets-manager-sink.kamelet.yaml
@@ -32,15 +32,15 @@ spec:
definition:
title: "AWS Secrets Manager Sink"
description: |-
- Creates a new secret in AWS Secrets Manager for each message, with the
body as the value of the secret.
+ Creates a secret in AWS Secrets Manager for each message, with the body
as its value, or changes or reads the value of an existing secret.
- Use it to store passwords, API keys or certificates that another system
generates, so that your applications can read them from Secrets Manager.
+ Use it to store passwords, API keys or certificates that another system
generates, so that your applications can read them from Secrets Manager, to
rotate such a value, or to read one inside a route.
- Input: the body is the value of the secret, as text, for example a
password, or several values as a JSON object in JSON text. The name of the
secret comes from the `secret-name` header, else from the `ce-secret-name`
header; without either, the ID of the message is used as the name.
+ Input: the body is the value of the secret, as text, for example a
password, or several values as a JSON object in JSON text. With `operation` set
to `getSecret`, the body is not used. For `createSecret`, the name of the new
secret comes from the `secret-name` header, else from the `ce-secret-name`
header; without either, the ID of the message is used as the name.
`updateSecret` and `getSecret` work on the secret in `secretId`.
- Output: when it is used inside a route, the body afterwards is the
answer of AWS, a `CreateSecretResponse` object of the AWS SDK for Java with the
ARN, the name and the version ID of the new secret.
+ Output: when it is used inside a route, the body afterwards is the
answer of AWS, a `CreateSecretResponse` object of the AWS SDK for Java with the
ARN, the name and the version ID of the new secret; for `updateSecret`, an
`UpdateSecretResponse` with the ARN, the name and the new version ID. For
`getSecret`, the body is the value of the secret, as text, or as bytes for a
binary secret, and the `CamelAwsSecretsManagerSecretVersionId` header holds the
ID of its version.
- Good to know: it only creates secrets. A message for a name that already
exists fails, so it cannot change the value of an existing secret. A message
without a name header creates a secret with a generated name, such as
`4D678616B8AFAA1-0000000000000002`. To reach AWS through an HTTP proxy, set
`proxyHost` and `proxyPort`, and set `proxyProtocol` to `HTTP` for a proxy that
takes plain HTTP, such as Squid.
+ Good to know: by default it only creates secrets, and a message for a
name that already exists fails. Set `operation` to `updateSecret` to change the
value of the existing secret in `secretId`, or to `getSecret` to read it; both
fail when `secretId` is not set or the secret does not exist. A message without
a name header creates a secret with a generated name, such as
`4D678616B8AFAA1-0000000000000002`. With `binaryPayload`, the body is stored as
the binary value of the secret inst [...]
required:
- region
type: object
@@ -108,6 +108,24 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ operation:
+ title: Operation
+ description: "What to do with each message: `createSecret` creates a
new secret with the body as its value; `updateSecret` stores the body as the
new value of an existing secret, as a new version; `getSecret` reads the
current value of an existing secret into the body. `createSecret` names the new
secret from the `secret-name` header; `updateSecret` and `getSecret` work on
the secret in `secretId`, which they need."
+ type: string
+ default: createSecret
+ example: updateSecret
+ enum: ["createSecret", "updateSecret", "getSecret"]
+ secretId:
+ title: Secret ID
+ description: "The name or the ARN of the secret that `updateSecret`
and `getSecret` work on, such as `prod/db-password`. Required for these two
operations: without it, each of their messages fails with `The secretId option
must be set`. Not used by `createSecret`."
+ type: string
+ pattern: "^[A-Za-z0-9/_+=.@:-]+$"
+ example: prod/db-password
+ binaryPayload:
+ title: Binary Payload
+ description: If true, `createSecret` and `updateSecret` store the
bytes of the body as the binary value of the secret (`SecretBinary`), for
example a keystore file, instead of as text (`SecretString`). `getSecret` gives
the bytes of a binary secret whatever this option says. When it is not set, the
value is stored as text.
+ type: boolean
+ example: true
dataTypes:
in:
headers:
@@ -119,6 +137,12 @@ spec:
title: Secret Name (CloudEvents)
description: The name of the secret to create, when the message is a
CloudEvent. Used only when `secret-name` is not set.
type: string
+ out:
+ headers:
+ CamelAwsSecretsManagerSecretVersionId:
+ title: Secret Version ID
+ description: Set by `getSecret`; the ID of the version of the secret
that was read.
+ type: string
dependencies:
- "camel:aws-secrets-manager"
- "camel:kamelet"
@@ -130,35 +154,59 @@ spec:
when:
- expression:
simple:
- expression: "${header[secret-name]}"
- steps:
- - setHeader:
- name: CamelAwsSecretsManagerSecretName
- expression:
- simple:
- expression: "${header[secret-name]}"
- - expression:
- simple:
- expression: "${header[ce-secret-name]}"
+ expression: "'{{operation}}' == 'createSecret'"
steps:
- - setHeader:
- name: CamelAwsSecretsManagerSecretName
- expression:
- simple:
- expression: "${header[ce-secret-name]}"
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "${header[secret-name]}"
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretName
+ expression:
+ simple:
+ expression: "${header[secret-name]}"
+ - expression:
+ simple:
+ expression: "${header[ce-secret-name]}"
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretName
+ expression:
+ simple:
+ expression: "${header[ce-secret-name]}"
+ otherwise:
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretName
+ expression:
+ simple:
+ expression: "${exchangeId}"
otherwise:
steps:
- - setHeader:
- name: CamelAwsSecretsManagerSecretName
- expression:
- simple:
- expression: "${exchangeId}"
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "'{{?secretId}}' == ''"
+ steps:
+ - throwException:
+ exceptionType: java.lang.IllegalArgumentException
+ message: "The secretId option must be set for
the {{operation}} operation"
+ otherwise:
+ steps:
+ - setHeader:
+ name: CamelAwsSecretsManagerSecretId
+ expression:
+ constant:
+ expression: "{{?secretId}}"
- to:
uri: aws-secrets-manager
parameters:
label: kamelet
accessKey: "RAW({{?accessKey}})"
- operation: createSecret
+ operation: "{{operation}}"
profileCredentialsName: "{{?profileCredentialsName}}"
region: "{{region}}"
secretKey: "RAW({{?secretKey}})"
@@ -169,3 +217,4 @@ spec:
proxyHost: "{{?proxyHost}}"
proxyPort: "{{?proxyPort}}"
proxyProtocol: "{{?proxyProtocol}}"
+ binaryPayload: "{{?binaryPayload}}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-translate-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-translate-action.kamelet.yaml
index 57292e3c0..cfc5e5450 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/aws-translate-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-translate-action.kamelet.yaml
@@ -34,16 +34,15 @@ spec:
description: |-
Translates the text of each message from one language into another with
Amazon Translate.
- Use it to translate customer messages, support tickets or product
descriptions, for example from Italian into English before they are analyzed or
stored.
+ Use it to translate customer messages, support tickets or product
descriptions, for example from Italian into English before they are analyzed or
stored, also when the messages come in several languages.
Input: the body is the text to translate.
Output: the body is the translated text.
- Good to know: both languages are fixed by the options. Only the listed
language codes can be chosen, although Amazon Translate knows more languages.
To reach AWS through an HTTP proxy, set `proxyHost` and `proxyPort`, and set
`proxyProtocol` to `HTTP` for a proxy that takes plain HTTP, such as Squid.
+ Good to know: the target language is fixed by `targetLanguage`. The
source language is fixed by `sourceLanguage`, or, with
`autodetectSourceLanguage`, Amazon Translate detects it in each message. Only
the listed language codes can be chosen, although Amazon Translate knows more
languages. With `terminologyNames`, your own translations of terms, such as
product and brand names, are applied. To reach AWS through an HTTP proxy, set
`proxyHost` and `proxyPort`, and set `proxyProtocol` [...]
required:
- region
- - sourceLanguage
- targetLanguage
type: object
properties:
@@ -69,7 +68,7 @@ spec:
enum: ["ap-south-1", "eu-south-1", "us-gov-east-1", "me-central-1",
"ca-central-1", "eu-central-1", "us-iso-west-1", "us-west-1", "us-west-2",
"af-south-1", "eu-north-1", "eu-west-3", "eu-west-2", "eu-west-1",
"ap-northeast-3", "ap-northeast-2", "ap-northeast-1", "me-south-1",
"sa-east-1", "ap-east-1", "cn-north-1", "us-gov-west-1", "ap-southeast-1",
"ap-southeast-2", "us-iso-east-1", "ap-southeast-3", "us-east-1", "us-east-2",
"cn-northwest-1", "us-isob-east-1", "aws-global", "a [...]
sourceLanguage:
title: Source Language
- description: The language of the text, as a language code, such as
`it` for Italian or `en` for English.
+ description: The language of the text, as a language code, such as
`it` for Italian or `en` for English. Required, unless
`autodetectSourceLanguage` is true; without either, a message fails unless it
carries the `CamelAwsTranslateSourceLanguage` header.
type: string
example: it
enum: ["ar", "zh", "zh-TW", "cs", "da", "nl", "en", "fi", "fr", "de",
"he", "hi", "id", "it", "ja", "ko", "ms", "no", "fa", "pl", "pt", "ru", "es",
"sv", "tr"]
@@ -122,6 +121,17 @@ spec:
type: string
enum: ["HTTP", "HTTPS"]
example: HTTP
+ autodetectSourceLanguage:
+ title: Detect Source Language
+ description: If true, Amazon Translate detects the language of each
message, so messages in different languages can be translated into
`targetLanguage`; `sourceLanguage` is then not used. When it is not set, the
language is `sourceLanguage`.
+ type: boolean
+ example: true
+ terminologyNames:
+ title: Terminology Names
+ description: The name of a custom terminology to apply, such as
`product-names`. A custom terminology is a list of terms with their
translations, such as brand names that must not be translated, which you create
in Amazon Translate beforehand. Several names are separated by commas. When it
is not set, no custom terminology is used.
+ type: string
+ pattern: "^([A-Za-z0-9-]_?)+(,([A-Za-z0-9-]_?)+)*$"
+ example: product-names
dependencies:
- "camel:kamelet"
- "camel:aws2-translate"
@@ -129,5 +139,16 @@ spec:
from:
uri: kamelet:source
steps:
+ - choice:
+ when:
+ - expression:
+ simple:
+ expression: "'{{?terminologyNames}}' != ''"
+ steps:
+ - setHeader:
+ name: CamelAwsTranslateTerminologyNames
+ expression:
+ simple:
+ expression: "${split('{{?terminologyNames}}',',')}"
- to:
- uri:
"aws2-translate://translate?accessKey=RAW({{?accessKey}})&profileCredentialsName={{?profileCredentialsName}}®ion={{region}}&secretKey=RAW({{?secretKey}})&sessionToken=RAW({{?sessionToken}})&sourceLanguage={{sourceLanguage}}&targetLanguage={{targetLanguage}}&useDefaultCredentialsProvider={{useDefaultCredentialsProvider}}&useProfileCredentialsProvider={{useProfileCredentialsProvider}}&useSessionCredentials={{useSessionCredentials}}&proxyHost={{?proxyHost}}&proxyPort={{?
[...]
+ uri:
"aws2-translate://translate?accessKey=RAW({{?accessKey}})&profileCredentialsName={{?profileCredentialsName}}®ion={{region}}&secretKey=RAW({{?secretKey}})&sessionToken=RAW({{?sessionToken}})&sourceLanguage={{?sourceLanguage}}&targetLanguage={{targetLanguage}}&useDefaultCredentialsProvider={{useDefaultCredentialsProvider}}&useProfileCredentialsProvider={{useProfileCredentialsProvider}}&useSessionCredentials={{useSessionCredentials}}&proxyHost={{?proxyHost}}&proxyPort={{
[...]