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 11:20:16 UTC

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

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

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

commit d21e635799334b85b351fcdec7b5d61e1f87514e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 26 13:16:37 2021 +0200

    Added DNS Dig Action Kamelet
---
 dns-dig-action.kamelet.yaml | 66 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/dns-dig-action.kamelet.yaml b/dns-dig-action.kamelet.yaml
new file mode 100644
index 0000000..c2fb484
--- /dev/null
+++ b/dns-dig-action.kamelet.yaml
@@ -0,0 +1,66 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: dns-dig-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 DIG Action"
+    description: |-
+      Query a DNS through Dig
+
+      The Kamelet expects the following headers to be set:
+
+      - `domain-name` / `ce-domain-name`: as the domain for which we are querying the DNS
+
+      - `dns-type` / `ce-dns-type`: as the DNS type
+
+      If the domain-name header won't be set the body will be used as domain name.
+
+      If the dns-type header won't be set, the DNS Type A will be used.
+  flow:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[domain-name]}"
+            steps:
+            - set-header:
+                name: dns.name
+                simple: "${header[domain-name]}"
+          - simple: "${header[ce-domain-name]}"
+            steps:
+            - set-header:
+                name: dns.name
+                simple: "${header[ce-domain-name]}"
+          otherwise:
+            steps:
+            - set-header:
+                name: dns.name
+                simple: "${body}"
+      - choice:
+          when:
+          - simple: "${header[dns-type]}"
+            steps:
+            - set-header:
+                name: dns.type
+                simple: "${header[dns-type]}"
+          - simple: "${header[ce-dns-type]}"
+            steps:
+            - set-header:
+                name: dns.type
+                simple: "${header[ce-dns-type]}"
+          otherwise:
+            steps:
+            - set-header:
+                name: dns.type
+                constant: "A"
+      - to:
+          uri: "dns:dig"
+      - convert-body-to:
+          type: "java.lang.String"