apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: aws-cloudtrail-source
  annotations:
    camel.apache.org/kamelet.support.level: "Stable"
    camel.apache.org/catalog.version: "3.21.0"
    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNzQuMzc1IDg1IiBmaWxsPSIjZmZmIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIHhsaW5rOmhyZWY9IiNBIiB4PSIyLjE4OCIgeT0iMi41Ii8+PHN5bWJvbCBpZD0iQSIgb3ZlcmZsb3c9InZpc2libGUiPjxnIHN0cm9rZT0ibm9uZSI+PHBhdGggZD0iTTkuOTY2IDM1LjQ5M2wtMi4yODguMTc2TDAgMzUuMzc2bDIuMTIzLTEwLjAzOSA3Ljg0MyAxMC4xNTZ6IiBmaWxsPSIjM2M0OTI5Ii8+PHBhdGggZD0iTTkuOTY2IDQ0LjgzbC0yLjI4OC0uMTc2TDAgNDQuOTQ3bDIuMTIzIDEwLjAzOUw5Ljk2NiA0NC44M3oiIGZpbGw9IiNiN2NhOWQiLz48cGF0aCBkPSJNMi4xMjMgNDUuMTQxTDAgNDQuOTQ2djkuNDM0bDIuMTIzLjYwNXYtOS44NDR6IiBmaWxsPSIjNGI2MTJjIi8+PHBhdGggZD0iTTkuOTY2IDU0LjAxOWwtNy44NDMuOTY2di05LjgzNGw3Ljg0My0uMzIydjkuMTl6IiBmaWxsPSIjNzU5YzNlIi8+PHBhdGggZD0iTTI0LjM0MyA0NS42MDFsLTYuMzA3LS40NTktMTEuMDI4LjUyNyA1LjkwNSAxNy45NjEgMTEuNDMtMTguMDI5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udtrail"
    camel.apache.org/kamelet.namespace: "AWS"
  labels:
    camel.apache.org/kamelet.type: "source"
spec:
  definition:
    title: "AWS Cloudtrail Source"
    description: |-
      Receive data from an AWS Cloudtrail.

      The basic authentication method for the Cloudtrail service is to specify an access key and a secret key. These parameters are optional because the Kamelet provides a default credentials provider.
    required:
      - region
    type: object
    properties:
      accessKey:
        title: Access Key
        description: The access key obtained from AWS.
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - urn:camel:group:credentials
      secretKey:
        title: Secret Key
        description: The secret key obtained from AWS.
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - 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", "aws-cn-global", "aws-us-gov-global", "aws-iso-global", "aws-iso-b-global"]
      useDefaultCredentialsProvider:
        title: Default Credentials Provider
        description: If true, the Cloudtrail client loads credentials through a default credentials provider. If false, it uses the basic authentication method (access key and secret key).
        type: boolean
        x-descriptors:
        - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
        default: false
      uriEndpointOverride:
        title: Overwrite Endpoint URI
        description: The overriding endpoint URI. To use this option, you must also select the `overrideEndpoint` option.
        type: string
      overrideEndpoint:
        title: Endpoint Overwrite
        description: Select this option to override the endpoint URI. To use this option, you must also provide a URI for the `uriEndpointOverride` option.
        type: boolean
        x-descriptors:
          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
        default: false
      maxResults:
        title: Max Results
        description: Maximum number of records that will be fetched in each poll.
        type: integer
        default: 1
      eventSource:
        title: Event Source
        description: Specify an event source to select events.
        type: string
        example: secretsmanager.amazonaws.com
  dependencies:
    - "camel:core"
    - "camel:aws-cloudtrail"
    - "camel:kamelet"
  template:
    from:
      uri: "aws-cloudtrail:cloudtrail"
      parameters:
        secretKey: "{{?secretKey}}"
        accessKey: "{{?accessKey}}"
        region: "{{region}}"
        eventSource: "{{?eventSource}}"
        useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
        uriEndpointOverride: "{{?uriEndpointOverride}}"
        overrideEndpoint: "{{overrideEndpoint}}"
        maxResults: "{{maxResults}}"
      steps:
      - to: "kamelet:sink"