From ed326f74d144fb2cbfc323756dac96871d83b342 Mon Sep 17 00:00:00 2001 From: Andrea Tarocchi Date: Fri, 6 May 2022 16:35:25 +0200 Subject: [PATCH] Added default value for keyName in aws-s3-sink.kamelet.yaml --- kamelets/aws-s3-sink.kamelet.yaml | 12 +++++++++--- .../main/resources/kamelets/aws-s3-sink.kamelet.yaml | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/kamelets/aws-s3-sink.kamelet.yaml b/kamelets/aws-s3-sink.kamelet.yaml index 5838d2983..bb8f8ee90 100644 --- a/kamelets/aws-s3-sink.kamelet.yaml +++ b/kamelets/aws-s3-sink.kamelet.yaml @@ -37,11 +37,11 @@ spec: When using a default Credentials Provider the S3 client will load the credentials through this provider and won't use the static credential. This is reason for not having the access key and secret key as mandatory parameter for this Kamelet. - The Kamelet can use the following header to be set: + The Kamelet can use the following headers to be set to: - - `file` / `ce-file`: as the file name to upload + - `file` / `ce-file`: as the file name to be uploaded - If the header won't be set, the Kamelet parameter `keyName` should be populated. The `keyName` parameter could be a simple value language from the Apache Camel. + If neither of those headers are set and the Kamelet parameter `keyName` is not populated, then the default file name used will be the `exchange id`. required: - bucketNameOrArn - region @@ -121,6 +121,12 @@ spec: - set-header: name: CamelAwsS3Key simple: "${header[ce-file]}" + - simple: "${properties:keyName:null} == 'null'" + steps: + - set-header: + name: CamelAwsS3Key + simple: "${exchangeId}" + # this can be simplified when https://issues.apache.org/jira/browse/CAMEL-18070 is resolved - to: uri: "aws2-s3:{{bucketNameOrArn}}" parameters: diff --git a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml index 5838d2983..bb8f8ee90 100644 --- a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml +++ b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml @@ -37,11 +37,11 @@ spec: When using a default Credentials Provider the S3 client will load the credentials through this provider and won't use the static credential. This is reason for not having the access key and secret key as mandatory parameter for this Kamelet. - The Kamelet can use the following header to be set: + The Kamelet can use the following headers to be set to: - - `file` / `ce-file`: as the file name to upload + - `file` / `ce-file`: as the file name to be uploaded - If the header won't be set, the Kamelet parameter `keyName` should be populated. The `keyName` parameter could be a simple value language from the Apache Camel. + If neither of those headers are set and the Kamelet parameter `keyName` is not populated, then the default file name used will be the `exchange id`. required: - bucketNameOrArn - region @@ -121,6 +121,12 @@ spec: - set-header: name: CamelAwsS3Key simple: "${header[ce-file]}" + - simple: "${properties:keyName:null} == 'null'" + steps: + - set-header: + name: CamelAwsS3Key + simple: "${exchangeId}" + # this can be simplified when https://issues.apache.org/jira/browse/CAMEL-18070 is resolved - to: uri: "aws2-s3:{{bucketNameOrArn}}" parameters: