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 2021/04/26 12:45:41 UTC

[camel-kamelets] 01/03: Added DNS Lookup Action Kamelet

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

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

commit e9f75d8070d9fed9e71e0eea87b4798722adcdbe
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 26 14:43:36 2021 +0200

    Added DNS Lookup Action Kamelet
---
 dns-lookup-action.kamelet.yaml | 50 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dns-lookup-action.kamelet.yaml b/dns-lookup-action.kamelet.yaml
new file mode 100644
index 0000000..a0d929c
--- /dev/null
+++ b/dns-lookup-action.kamelet.yaml
@@ -0,0 +1,50 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: dns-ip-action
+  annotations:
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTIyLjg3OSAxMjIuODgxIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMjIuODc5IDEyMi44ODEiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGQ9Ik0xMDkuNDY3LDg5LjUwNWMwLjE4MiwwLDAuMzU5LDAuMDE5LDAuNTMxLDAuMDUzYzEuMT [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+  labels:
+    camel.apache.org/kamelet.type: "action"
+spec:
+  definition:
+    title: "DNS IP Action"
+    description: |-
+      Get an IP from a DNS
+
+      The Kamelet expects the following headers to be set:
+
+      - `domain-name` / `ce-domain-name`: as the domain for which we are looking up
+
+      If the domain-name header won't be set the body will be used as domain name.
+  types:
+    out:
+      mediaType: application/json
+  dependencies:
+  - "camel:jackson"
+  flow:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[domain-name]}"
+            steps:
+            - set-header:
+                name: dns.domain
+                simple: "${header[domain-name]}"
+          - simple: "${header[ce-domain-name]}"
+            steps:
+            - set-header:
+                name: dns.domain
+                simple: "${header[ce-domain-name]}"
+          otherwise:
+            steps:
+            - set-header:
+                name: dns.domain
+                simple: "${body}"
+      - marshal:
+          json: {}
+      - to:
+          uri: "dns:lookup"