# ---------------------------------------------------------------------------
# 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: splunk-hec-sink
  annotations:
    camel.apache.org/kamelet.support.level: "Stable"
    camel.apache.org/catalog.version: "4.10.2"
    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjRweCIgaGVpZ2h0PSIyNHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHJvbGU9ImltZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+U3BsdW5rIGljb248L3RpdGxlPjxwYXRoIGQ9Ik0yMy4zNDggMTEuOTExbC0yLjI0MS0xLjA5MXYtLjY1TDI0IDExLjYyMXYuNTkzbC0yLjg5MyAxLjQzOHYtLjYzNnptLTUuMzk3IDEuODQxaC0uOTYxdi01LjMxaC45NjF2My4xMTZoLjEwMmwxLjI4LTEuNDgxLjcyMy4zMS0xLjIzIDEuMzE2IDEuNDUzIDEuODA5LS44ODguMzExLTEuNDQtMS45OTZ6bS0yLjU3Ny0uMDAydi0yLjA2OGEyLjY4NSAyLjY4NSAwIDAgMC0uMDI2LS40Mi43OTEuNzkxIDAgMCAwLS4wOS0uMjZjLS4xMTMtLjIwMi0uMzA4LS4zMDQtLjU5LS4zMDRhLjg4OC44ODggMCAwIDAtLjQ2MS4xMTMuNjczLjY3MyAwIDAgMC0uMjg2LjMzIDEuMDEyIDEuMDEy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jMxOCAxLjMwNiAxLjMwNiAwIDAgMC0uMTg3LS4xNzMgOS4yMzEgOS4yMzEgMCAwIDAtLjMwOC0uMjMyIDYuNzg3IDYuNzg3IDAgMCAxLS4yODEtLjIxIDIuMTEgMi4xMSAwIDAgMS0uMjUyLS4yMzIgMS4wMzkgMS4wMzkgMCAwIDEtLjE4LS4yNzUuODI2LjgyNiAwIDAgMS0uMDY5LS4zNDcuODkzLjg5MyAwIDAgMSAuMDk0LS40MDkuOTM1LjkzNSAwIDAgMSAuMjU1LS4zMTQgMS4yMiAxLjIyIDAgMCAxIC4zOS0uMjAzYy4xNi0uMDUuMzI3LS4wNzQuNDk0LS4wNzIuMTg0IDAgLjM2OC4wMjYuNTQ1LjA3Ni4xNzQuMDUuMzM4LjEyMy40ODguMjE5bC0uMjgyLjQ1NGExLjA1IDEuMDUgMCAwIDAtLjYwOC0uMjAxLjUwNC41MDQgMCAwIDAtLjMyMy4xMDIuMzA3LjMwNyAwIDAgMC0uMTI2LjI1M2MwIC4wOTguMDQxLjE5My4xMTMuMjYuMDc0LjA3OC4yMDMuMTg2LjM4NS4zMjUuMTg1LjEzNi4zMzYuMjUzLjQ1Ny4zNTUuMTA0LjA4NS4yMDIuMTgyLjI4Ni4yODYuMDY1LjA4LjExNS4xNzMuMTQ1LjI3M2EuODA4LjgwOCAwIDAgMSAuMDQ2LjI5OVoiLz48L3N2Zz4="
    camel.apache.org/provider: "Apache Software Foundation"
    camel.apache.org/kamelet.group: "SPLUNK"
    camel.apache.org/kamelet.namespace: "Monitoring"
  labels:
    camel.apache.org/kamelet.type: "sink"
spec:
  definition:
    title: "Splunk HEC Sink"
    description: |-
      The Splunk HEC sink allows to send data to Splunk using the https://docs.splunk.com/Documentation/Splunk/latest/Data/UsetheHTTPEventCollector[HTTP Event Collector].

    required:
      - splunkUrl
      - token
    type: object
    properties:
      splunkUrl:
        title: Splunk URL
        description: The URL of your Splunk server. No need to set the protocol prefix.
        type: string
        example: my_server.splunkcloud.com:8088
      token:
        title: Token
        description: The Token of the HEC. Note it is not the user's authentication token.
        type: string
        format: password
        x-descriptors:
        - urn:camel:group:credentials
      hostPayload:
        title: Host of the Event
        description: The host field set in the data sent to Splunk, it is not related to the Splunk URL or the connection to Splunk server.
        type: string
      bodyOnly:
        title: Body Only
        description: Send to Splunk only data contained in the body.
        type: boolean
        default: false
      headersOnly:
        title: Headers Only
        description: Send to Splunk only data contained in the headers.
        type: boolean
        default: false
      index:
        title: Index
        description: Splunk index to write to.
        type: string
      source:
        title: Source
        description: The source named field of the data.
        type: string
      sourceType:
        title: Source Type
        description: The source named field of the data.
        type: string
      skipTlsVerify:
        title: Skip TLS Verification
        description: Skip TLS verification.
        type: boolean
        default: false
      https:
        title: Secure
        description: Use a secure HTTPS connection.
        type: boolean
        default: true
      time:
        title: Time
        description: Time this even occurred. By default, the time will be when this event hits the splunk server.
        type: string
  types:
    in:
      mediaType: application/json
  dependencies:
  - "camel:core"
  - "camel:splunk-hec"
  - "camel:kamelet"
  template:
    from:
      uri: "kamelet:source"
      steps:
      - to:
          uri: "splunk-hec:{{splunkUrl}}"
          parameters:
            host: "{{?hostPayload}}"
            token: "{{token}}"
            bodyOnly: "{{?bodyOnly}}"
            headersOnly: "{{?headersOnly}}"
            index: "{{?index}}"
            source: "{{?source}}"
            sourceType: "{{?sourceType}}"
            skipTlsVerify: "{{?skipTlsVerify}}"
            https: "{{?https}}"
            time: "{{?time}}"