You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/12/21 12:33:57 UTC

(camel-kamelets) 02/05: Add an AWS STS Assume Role Action Kamelet

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

acosentino pushed a commit to branch 1816
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 3f94d27dd5b95bc8694c61577be166917fb624bd
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 21 13:28:01 2023 +0100

    Add an AWS STS Assume Role Action Kamelet
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../aws-sts-assume-role-action.kamelet.yaml        | 111 +++++++++++++++++++++
 1 file changed, 111 insertions(+)

diff --git a/library/camel-kamelets/src/main/resources/kamelets/aws-sts-assume-role-action.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/aws-sts-assume-role-action.kamelet.yaml
new file mode 100644
index 00000000..d53c864b
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/aws-sts-assume-role-action.kamelet.yaml
@@ -0,0 +1,111 @@
+# ---------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+  name: aws-sts-assume-role-action
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "4.4.0-SNAPSHOT"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ5MCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiIHZpZXdCb3g9IjAgMCAyNTYgNDkwIiB3aWR0aD0iMjU2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnIGZpbGw9IiMzYzQ5MjkiPjxwYXRoIGQ9Im0yMSAxNjUuNzUtMjEgNi44NTYgMjEuNzUgMi41MTl6Ii8+PHBhdGggZD0ibTE5Ljk1NSAyMDYuODA2IDEwOC4wNDUgNi45MDggMTA4LjA0NS02LjkwOC0xMDguMDQ1LTIxLjA1NnoiLz48cGF0aCBkPSJtMjM0LjUgMTc1LjEyNSAyMS41LTIuNTE5LTIxLjUtNS43MzF6Ii8+PC9nPjxwYXRoIGQ9Im0xNTcuMzg3ID [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "AWS STS"
+    camel.apache.org/kamelet.namespace: "AWS"
+  labels:
+    camel.apache.org/kamelet.type: "action"
+spec:
+  definition:
+    title: "AWS STS Assume Role Action"
+    description: |-
+      Assume a role through STS
+
+      Access Key/Secret Key are the basic method for authenticating to the AWS STS Service. These parameters are optional because the Kamelet provides the 'useDefaultCredentialsProvider'.
+      
+      When using a default Credentials Provider the Translate 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.
+      
+      In the headers, you have to specify the `role-arn` / `ce-role-arn` property to specify the role ARN you want to assume.
+
+      In the headers, you have to specify the `role-session-name` / `ce-role-session-name` property to specify the role Session name you want to use.
+    required:
+      - region
+    type: object
+    properties:
+      accessKey:
+        title: Access Key
+        description: The access key obtained from AWS.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      secretKey:
+        title: Secret Key
+        description: The secret key obtained from AWS.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      region:
+        title: AWS Region
+        description: The AWS region to access.
+        type: string
+        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 [...]
+      useDefaultCredentialsProvider:
+        title: Default Credentials Provider
+        description: Set whether the STS client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in.
+        type: boolean
+        default: false
+  dependencies:
+    - "camel:dns"
+    - "camel:kamelet"
+    - "camel:aws2-translate"
+  template:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[role-arn]}"
+            steps:
+            - setHeader:
+                name: CamelAwsStsRoleArn
+                simple: "${header[role-arn]}"
+          - simple: "${header[ce-role-arn]}"
+            steps:
+            - setHeader:
+                name: CamelAwsStsRoleArn
+                simple: "${header[ce-role-arn]}"
+      - choice:
+          when:
+          - simple: "${header[role-session-name]}"
+            steps:
+            - setHeader:
+                name: CamelAwsStsRoleSessionName
+                simple: "${header[role-session-name]}"
+          - simple: "${header[ce-role-session-name]}"
+            steps:
+            - setHeader:
+                name: CamelAwsStsRoleSessionName
+                simple: "${header[ce-role-session-name]}"
+      - to:
+          uri: "aws2-sts://default"
+          parameters:
+            secretKey: "{{?secretKey}}"
+            accessKey: "{{?accessKey}}"
+            region: "{{region}}"
+            operation: "assumeRole"
+            useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"