# ---------------------------------------------------------------------------
# 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/v1alpha1
kind: Kamelet
metadata:
  name: google-storage-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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBoZWlnaHQ9IjgwMCIgd2lkdGg9IjEyMDAiIHZpZXdCb3g9Ii0xOS4yMDAxNSAtMjguNDgzIDE2Ni40MDEzIDE3MC44OTgiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGxpbmVhckdyYWRpZW50IHkyPSIxMjAuNzg5IiB4Mj0iNjQiIHkxPSI3LjAzNCIgeDE9IjY0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImEiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzQzODdmZCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzQ2ODNlYSIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTI3Ljc5IDExNS4yMTdMMS41NCA2OS43NDlhMTEuNDk5IDExLjQ5OSAwIDAxMC0xMS40OTlsMjYuMjUtNDUuNDY3YTExLj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jU0Ni0xLjIxMiAxLjIxNHY4LjU2NmMwIC42NjYuNTQ2IDEuMjEyIDEuMjEyIDEuMjEySDg0LjdjLjY2NyAwIDEuMjEzLS41NDYgMS4yMTMtMS4yMTJ2LTguNTY4YzAtLjY2Ni0uNTQ1LTEuMjEzLTEuMjEyLTEuMjEzbS02LjQxNiA3Ljk3NmEyLjQ4NCAyLjQ4NCAwIDAxLTIuNDc3LTIuNDggMi40NzUgMi40NzUgMCAwMTIuNDc3LTIuNDc3YzEuMzcgMCAyLjQ4IDEuMTAzIDIuNDggMi40NzdhMi40OCAyLjQ4IDAgMDEtMi40OCAyLjQ4bTYuNDE1IDguNDkxbC00MS40MzYuMDAyYy0uNjY3IDAtMS4yMTIuNTQ2LTEuMjEyIDEuMjE0djguNTY1YzAgLjY2Ni41NDYgMS4yMTMgMS4yMTIgMS4yMTNIODQuN2MuNjY3IDAgMS4yMTMtLjU0NyAxLjIxMy0xLjIxM3YtOC41NjdjMC0uNjY2LS41NDUtMS4yMTQtMS4yMTItMS4yMTRtLTYuNDE2IDcuOTc2YTIuNDgzIDIuNDgzIDAgMDEtMi40NzctMi40OCAyLjQ3NSAyLjQ3NSAwIDAxMi40NzctMi40NzcgMi40OCAyLjQ4IDAgMTEwIDQuOTU2IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
    camel.apache.org/provider: "Apache Software Foundation"
    camel.apache.org/kamelet.group: "Google Storage"
    camel.apache.org/kamelet.namespace: "GCP"
  labels:
    camel.apache.org/kamelet.type: "source"
spec:
  definition:
    title: "Google Storage Source"
    description: |-
      Consume objects from Google Cloud Storage.

      If you specify the `serviceAccountKey` property, you must base64 encode it before you pass it as a parameter.
    required:
      - bucketNameOrArn
    type: object
    properties:
      bucketNameOrArn:
        title: Bucket Name Or ARN
        description: The Google Cloud Storage bucket name or Bucket Amazon Resource Name (ARN).
        type: string
      serviceAccountKey:
        title: Service Account Key
        description: The service account key to use as credentials for Google Cloud Storage access. You must encode this value in base64.
        type: binary
        x-descriptors:
        - urn:camel:group:credentials
      deleteAfterRead:
        title: Auto-delete Objects
        description: Specifies to delete objects after consuming them.
        type: boolean
        x-descriptors:
        - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
        default: true
      autoCreateBucket:
        title: Autocreate Bucket
        description: Specifies to automatically create the Google Cloud Storage bucket.
        type: boolean
        x-descriptors:
        - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
        default: false
  dependencies:
    - "camel:kamelet"
    - "camel:google-storage"
    - "camel:jackson"
  template:
    from:
      uri: "google-storage://{{bucketNameOrArn}}"
      parameters:
        autoCreateBucket: "{{autoCreateBucket}}"
        serviceAccountKey: "base64:{{?serviceAccountKey}}"
        deleteAfterRead: "{{deleteAfterRead}}"
      steps:
      - to: kamelet:sink