# ---------------------------------------------------------------------------
# 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: rest-openapi-sink
  annotations:
    camel.apache.org/kamelet.support.level: "Stable"
    camel.apache.org/catalog.version: "3.21.0"
    camel.apache.org/kamelet.icon: "data:image/png;base64,[encoded data, 12960 characters]"
    camel.apache.org/provider: "Apache Software Foundation"
    camel.apache.org/kamelet.group: "HTTP"
    camel.apache.org/kamelet.namespace: "HTTP"
  labels:
    camel.apache.org/kamelet.type: sink
spec:
  definition:
    title: REST OpenAPI Sink
    description: Load an OpenAPI specification from a URI and call an operation on a HTTP service. The request that is generated respects the rules given in the OpenAPI specification (for example, path parameters and Content-Type).
    required:
    - specification
    - operation
    type: object
    properties:
      specification:
        title: Specification URI
        description: The URI to the OpenApi specification file.
        type: string
        example: "https://api.example.com/openapi.json"
        pattern: "^(http|https|file|classpath)://.*"
      operation:
        title: Operation ID
        description: The operation to call.
        type: string
  dependencies:
  - "camel:rest-openapi"
  - "camel:http"
  - "camel:kamelet"
  - "camel:core"
  template:
    from:
      uri: kamelet:source
      steps:
      - to: "rest-openapi:{{specification}}#{{operation}}"