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 2022/12/01 09:57:16 UTC

[camel-kamelets] 02/04: Added Microsoft Exchange IMAP OAUTH source kamelet

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

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

commit 6092cd401bf22da1bb1ab1f003d04e21b6a4e804
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 1 10:54:55 2022 +0100

    Added Microsoft Exchange IMAP OAUTH source kamelet
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 ...-exchange-online-imap-oauth-source.kamelet.yaml | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/library/camel-kamelets/src/main/resources/kamelets/ms-exchange-online-imap-oauth-source.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/ms-exchange-online-imap-oauth-source.kamelet.yaml
new file mode 100644
index 00000000..3c1f7f1a
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/ms-exchange-online-imap-oauth-source.kamelet.yaml
@@ -0,0 +1,104 @@
+# ---------------------------------------------------------------------------
+# 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:   name:ms-exchange-online-imap-oauth-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "main-SNAPSHOT"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjQgOCA1NSA0OCI+PHRpdGxlPkV4Y2hhbmdlXzY0eDwvdGl0bGU+PHBhdGggZD0iTTU1LjUwOTc3LDhoLTEyLjIwN0EzLjQ4ODM1LDMuNDg4MzUsMCwwLDAsNDAuODM1LDkuMDIyNDZMMTIuMDIyNDYsMzcuODM1QTMuNDg4MzUsMy40ODgzNSwwLDAsMCwxMSw0MC4zMDI3M3YxMi4yMDdBMy40OTAwNiwzLjQ5MDA2LDAsMCwwLDE0LjQ5MDIzLDU2aDEyLjIwN0EzLjQ4ODM1LDMuNDg4MzUsMCwwLDAsMjkuMTY1LDU0Ljk3NzU0TDU3Ljk3OCwyNi4xNjVBMy40ODk5NCwzLjQ4OTk0LDAsMC [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Mail"
+  labels:
+    camel.apache.org/kamelet.type: "source"
+spec:
+  definition:
+    title: "Microsoft Exchange IMAP OAuth2 Source"
+    description: |-
+      Receive unread emails from an IMAP Microsoft Exchange mail server, marking them as read once they are received.
+      It uses OAuth2 to authenticate IMAP session.
+    required:
+      - tenantId
+      - clientId
+      - clientSecret
+      - username
+    type: object
+    properties:
+      connectionHost:
+        title: Connection Host
+        description: The IMAP server host
+        type: string
+        default: outlook.office365.com
+      connectionPort:
+        title: Connection Port
+        description: The IMAP server port
+        type: string
+        default: 993
+      tenantId:
+        title: Tenant ID
+        description: Azure Active Directory Tenant ID
+        type: string
+      clientId:
+        title: Client ID
+        description: Azure Active Directory Application Client ID
+        type: string
+        x-descriptors:
+          - urn:camel:group:credentials
+      clientSecret:
+        title: Client Secret
+        description: The Azure Active Directory Application Client Secret
+        type: string
+        format: password
+        x-descriptors:
+          - urn:alm:descriptor:com.tectonic.ui:password
+          - urn:camel:group:credentials
+      username:
+        title: Username
+        description: The username to access the mail box
+        type: string
+        example: arthur@mycompany.com
+        x-descriptors:
+          - urn:camel:group:credentials
+      fetchSize:
+        title: Fetch Size
+        description: The number of messages fetched for each poll (-1 for no limits)
+        type: integer
+        default: 10
+      delay:
+        title: Delay
+        description: The delay between fetches in milliseconds
+        type: integer
+        default: 60000
+  dependencies:
+    - "camel:core"
+    - "camel:kamelet"
+    - "camel:mail-microsoft-oauth"
+  template:
+    beans:
+      - name: exchangeAuthenticator
+        type: "#class:org.apache.camel.component.mail.microsoft.authenticator.MicrosoftExchangeOnlineOAuth2MailAuthenticator({{tenantId}}, {{clientId}}, {{clientSecret}}, {{username}})"
+    from:
+      uri: "imaps:{{connectionHost}}:{{connectionPort}}"
+      parameters:
+        mail.imaps.auth.mechanisms: "XOAUTH2"
+        username: "{{username}}"
+        fetchSize: "{{fetchSize}}"
+        delay: "{{delay}}"
+        authenticator: "#bean:{{exchangeAuthenticator}}"
+      steps:
+        - to: "kamelet:sink"