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

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


The following commit(s) were added to refs/heads/main by this push:
     new 83a792abb chore: the Snowflake Kamelets can log in with a key pair 
(#3170) (#3208)
83a792abb is described below

commit 83a792abb341e1a49f9fd48957f2245a324d6c48
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Nov 18 21:38:23 2026 +0100

    chore: the Snowflake Kamelets can log in with a key pair (#3170) (#3208)
    
    snowflake-source and snowflake-sink logged in only with a username and a
    password. A Snowflake user of TYPE=SERVICE cannot log in with a password,
    and Snowflake is phasing out sign-in with a password alone for the other
    users, so such a Kamelet stops working for a service user.
    
    The Kamelets now take a private key, either as text in privateKey (the PEM
    file encoded in base64, the driver's private_key_base64) or as a path in
    privateKeyFile (private_key_file), and privateKeyPassphrase
    (private_key_pwd) for an encrypted key. They go into the properties map of
    the Snowflake data source, as its two-argument setters cannot be bound.
    With a key present and no authenticator set, the driver logs in with
    SNOWFLAKE_JWT and does not send the password.
    
    password is now optional. It is bound as {{password:}}, an empty default,
    because an optional placeholder skips the setter and the data source then
    refuses to connect without a password, before the driver looks at the key.
    With neither a password nor a key, the driver fails with "Missing password."
    
    With the new options unset, the endpoint URIs and the login request sent
    to Snowflake are the same as before.
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .../ROOT/partials/snowflake-sink-description.adoc  | 34 +++++++++++++++++++++-
 .../partials/snowflake-source-description.adoc     | 32 ++++++++++++++++++--
 kamelets/snowflake-sink.kamelet.yaml               | 29 +++++++++++++++---
 kamelets/snowflake-source.kamelet.yaml             | 29 +++++++++++++++---
 .../main/resources/META-INF/kamelets-index.json    |  4 +--
 .../resources/kamelets/snowflake-sink.kamelet.yaml | 29 +++++++++++++++---
 .../kamelets/snowflake-source.kamelet.yaml         | 29 +++++++++++++++---
 7 files changed, 165 insertions(+), 21 deletions(-)

diff --git a/docs/modules/ROOT/partials/snowflake-sink-description.adoc 
b/docs/modules/ROOT/partials/snowflake-sink-description.adoc
index d4c0bdd03..7bed7d3cb 100644
--- a/docs/modules/ROOT/partials/snowflake-sink-description.adoc
+++ b/docs/modules/ROOT/partials/snowflake-sink-description.adoc
@@ -12,6 +12,16 @@ Uses the Snowflake JDBC driver for native connectivity to 
Snowflake instances. T
 
 Requires configuration of the Snowflake instance URL (e.g., 
`instance.snowflakecomputing.com`) which uniquely identifies your Snowflake 
account and region.
 
+=== Authentication Methods
+
+The Kamelet logs in to Snowflake as the Snowflake user `username`, either with 
`password` or with a key pair. A Snowflake user of type SERVICE, meant for 
applications, cannot log in with a password, and Snowflake is phasing out 
sign-in with a password alone for the other users too, so use a key pair for an 
integration. When a key is set, the password is not used.
+
+- `privateKey` is the private key file in PEM format, encoded in base64 on a 
single line, such as the output of `base64 -w0 rsa_key.p8`.
+- `privateKeyFile` is instead the path of that file, such as a Kubernetes 
Secret mounted as a file. Set one of `privateKey` and `privateKeyFile`, not 
both.
+- `privateKeyPassphrase` is the passphrase of the key, when it is encrypted.
+
+Snowflake's guide to 
https://docs.snowflake.com/en/user-guide/key-pair-auth[key-pair authentication] 
shows how to make the key pair, such as with `openssl genrsa 2048 | openssl 
pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt`, and how to set the public 
key on the user with `ALTER USER ... SET RSA_PUBLIC_KEY`.
+
 === Data Processing
 
 Processes JSON input data through unmarshalling before executing SQL queries. 
This enables seamless integration with JSON-based data pipelines and streaming 
applications.
@@ -22,4 +32,26 @@ Supports parameterized SQL queries using named parameters 
that map to JSON data
 
 === Cloud-Native Features
 
-Snowflake's cloud-native architecture provides automatic scaling, performance 
optimization, and enterprise-grade security, making this Kamelet suitable for 
large-scale data operations.
\ No newline at end of file
+Snowflake's cloud-native architecture provides automatic scaling, performance 
optimization, and enterprise-grade security, making this Kamelet suitable for 
large-scale data operations.
+
+=== Example with a Key Pair
+
+The route below stores each order posted to a webhook as a row, logged in with 
a key pair. The key, encoded in base64, comes from a property, such as one set 
from a Kubernetes Secret.
+
+[source,yaml,subs='+attributes,macros']
+----
+- route:
+    from:
+      uri: "kamelet:webhook-source"
+      parameters:
+        subpath: "orders"
+      steps:
+        - to:
+            uri: "kamelet:snowflake-sink"
+            parameters:
+              instanceUrl: "myorg-myaccount.snowflakecomputing.com"
+              username: "ORDERS_SERVICE"
+              privateKey: "{{snowflake.private.key}}"
+              databaseName: "SHOP"
+              query: "INSERT INTO orders (id,customer) VALUES 
(:#id,:#customer)"
+----
diff --git a/docs/modules/ROOT/partials/snowflake-source-description.adoc 
b/docs/modules/ROOT/partials/snowflake-source-description.adoc
index b1399a235..514827895 100644
--- a/docs/modules/ROOT/partials/snowflake-source-description.adoc
+++ b/docs/modules/ROOT/partials/snowflake-source-description.adoc
@@ -2,7 +2,13 @@
 
 === Authentication methods
 
-This Kamelet connects to Snowflake with the user name and password of a 
Snowflake user, set in `username` and `password`.
+This Kamelet logs in to Snowflake as the Snowflake user `username`, either 
with `password` or with a key pair. A Snowflake user of type SERVICE, meant for 
applications, cannot log in with a password, and Snowflake is phasing out 
sign-in with a password alone for the other users too, so use a key pair for an 
integration. When a key is set, the password is not used.
+
+- `privateKey` is the private key file in PEM format, encoded in base64 on a 
single line, such as the output of `base64 -w0 rsa_key.p8`.
+- `privateKeyFile` is instead the path of that file, such as a Kubernetes 
Secret mounted as a file. Set one of `privateKey` and `privateKeyFile`, not 
both.
+- `privateKeyPassphrase` is the passphrase of the key, when it is encrypted.
+
+Snowflake's guide to 
https://docs.snowflake.com/en/user-guide/key-pair-auth[key-pair authentication] 
shows how to make the key pair, such as with `openssl genrsa 2048 | openssl 
pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt`, and how to set the public 
key on the user with `ALTER USER ... SET RSA_PUBLIC_KEY`.
 
 === Output format
 
@@ -14,7 +20,7 @@ The Kamelet requires database connection parameters:
 
 - `instanceUrl`: the host name of your Snowflake account, such as 
`myorg-myaccount.snowflakecomputing.com`
 - `databaseName` (optional): the Snowflake database that holds the tables
-- `username` and `password`: the Snowflake user to log in as
+- `username`: the Snowflake user to log in as, with `password`, or with a key 
pair in `privateKey` or `privateKeyFile`
 - `query`: the SQL query to run, such as `SELECT * FROM accounts WHERE 
processed = false`
 - `consumedQuery` (optional): an SQL statement run for each row once it is 
sent, to mark the row as read or delete it, such as `UPDATE accounts SET 
processed = true WHERE id = :#id`
 
@@ -38,3 +44,25 @@ The route below logs each account that is not processed yet, 
and marks it as pro
         - to:
             uri: "kamelet:log-sink"
 ----
+
+=== Example with a Key Pair
+
+The same route, logged in with a key pair. The key file comes from a 
Kubernetes Secret mounted at `/etc/snowflake`, and the passphrase of the key 
from a property.
+
+[source,yaml,subs='+attributes,macros']
+----
+- route:
+    from:
+      uri: "kamelet:snowflake-source"
+      parameters:
+        instanceUrl: "myorg-myaccount.snowflakecomputing.com"
+        username: "ORDERS_SERVICE"
+        privateKeyFile: "/etc/snowflake/rsa_key.p8"
+        privateKeyPassphrase: "{{snowflake.key.passphrase}}"
+        databaseName: "SHOP"
+        query: "SELECT * FROM accounts WHERE processed = false"
+        consumedQuery: "UPDATE accounts SET processed = true WHERE id = :#id"
+      steps:
+        - to:
+            uri: "kamelet:log-sink"
+----
diff --git a/kamelets/snowflake-sink.kamelet.yaml 
b/kamelets/snowflake-sink.kamelet.yaml
index e3e807be6..5fccd181e 100644
--- a/kamelets/snowflake-sink.kamelet.yaml
+++ b/kamelets/snowflake-sink.kamelet.yaml
@@ -39,11 +39,10 @@ spec:
 
       Output: the body afterwards is the JSON object as a Map, and the 
`CamelSqlUpdateCount` header holds the number of rows the statement changed. 
When `query` is a SELECT, the body is instead a List of the rows found, each a 
Map, and the `CamelSqlRowCount` header holds their number.
 
-      Good to know: a message fails when its body is not a JSON object (a JSON 
array or plain text, for example), or when it has no value for a parameter of 
`query`. The values are sent to the database apart from the SQL text, so the 
content of a message cannot change the statement. Do not write `?` in `query`, 
not even in a quoted string: the Kamelet then fails to start.
+      Good to know: a message fails when its body is not a JSON object (a JSON 
array or plain text, for example), or when it has no value for a parameter of 
`query`. The values are sent to the database apart from the SQL text, so the 
content of a message cannot change the statement. Do not write `?` in `query`, 
not even in a quoted string: the Kamelet then fails to start. Log in with 
`password`, or with a key pair in `privateKey` or `privateKeyFile`: a Snowflake 
user of type SERVICE, mea [...]
     required:
       - instanceUrl
       - username
-      - password
       - query
     type: object
     properties:
@@ -60,7 +59,26 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of the Snowflake user `username`.
+        description: The password of the Snowflake user `username`. Leave it 
empty to log in with a key pair instead, set in `privateKey` or 
`privateKeyFile`; when a key is set, the password is not used. A Snowflake user 
of type SERVICE cannot log in with a password, and Snowflake is phasing out 
sign-in with a password alone for the other users too. With neither a password 
nor a key, every connection fails with `Missing password`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKey:
+        title: Private Key
+        description: 'The private key to log in with instead of a password: 
the key file in PEM format, encoded in base64 on a single line, such as the 
output of `base64 -w0 rsa_key.p8`. The PEM text itself, which starts with 
`-----BEGIN`, is not accepted. The matching public key must be set on the user 
with `ALTER USER ... SET RSA_PUBLIC_KEY`. Set this or `privateKeyFile`, not 
both: with both, every connection fails.'
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKeyFile:
+        title: Private Key File
+        description: 'The path of the private key file to log in with instead 
of a password, in PEM format, such as `rsa_key.p8` made as the Snowflake guide 
to key-pair authentication shows. In Kubernetes, mount the Secret that holds 
the key as a file. The matching public key must be set on the user with `ALTER 
USER ... SET RSA_PUBLIC_KEY`. A path that does not exist makes every connection 
fail with `Invalid parameter value null`.'
+        type: string
+        example: /etc/snowflake/rsa_key.p8
+      privateKeyPassphrase:
+        title: Private Key Passphrase
+        description: 'The passphrase of the key in `privateKey` or 
`privateKeyFile`, when the key is encrypted: its PEM text then starts with 
`-----BEGIN ENCRYPTED PRIVATE KEY-----`. Without it, or with a wrong one, every 
connection fails.'
         type: string
         format: password
         x-descriptors:
@@ -106,9 +124,12 @@ spec:
         factoryMethod: createDataSource
         properties:
           user: "{{username}}"
-          password: "{{password}}"
+          password: "{{password:}}"
           url: "jdbc:snowflake://{{instanceUrl}}"
           databaseName: "{{?databaseName}}"
+          properties[private_key_base64]: "{{?privateKey}}"
+          properties[private_key_file]: "{{?privateKeyFile}}"
+          properties[private_key_pwd]: "{{?privateKeyPassphrase}}"
     from:
       uri: kamelet:source
       steps:
diff --git a/kamelets/snowflake-source.kamelet.yaml 
b/kamelets/snowflake-source.kamelet.yaml
index 157d26ed9..c7621d8ec 100644
--- a/kamelets/snowflake-source.kamelet.yaml
+++ b/kamelets/snowflake-source.kamelet.yaml
@@ -37,11 +37,10 @@ spec:
 
       Output: the body is one row as JSON text, an object with the column 
names as keys, such as `{"id":1,"username":"oscerd","city":"Rome"}`. The 
`Content-Type` header is `application/json`.
 
-      Good to know: the query runs again `delay` milliseconds after the 
previous run, so the same rows are sent again and again, unless `consumedQuery` 
marks or deletes each row once it is sent and `query` leaves such rows out: for 
example `SELECT * FROM accounts WHERE processed = false` with `UPDATE accounts 
SET processed = true WHERE id = :#id`. When the next step fails for a row, 
`consumedQuery` is not run for it, and the row is read again. A query that 
finds no rows sends nothing. `q [...]
+      Good to know: the query runs again `delay` milliseconds after the 
previous run, so the same rows are sent again and again, unless `consumedQuery` 
marks or deletes each row once it is sent and `query` leaves such rows out: for 
example `SELECT * FROM accounts WHERE processed = false` with `UPDATE accounts 
SET processed = true WHERE id = :#id`. When the next step fails for a row, 
`consumedQuery` is not run for it, and the row is read again. A query that 
finds no rows sends nothing. `q [...]
     required:
       - instanceUrl
       - username
-      - password
       - query
     type: object
     properties:
@@ -58,7 +57,26 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of the Snowflake user `username`.
+        description: The password of the Snowflake user `username`. Leave it 
empty to log in with a key pair instead, set in `privateKey` or 
`privateKeyFile`; when a key is set, the password is not used. A Snowflake user 
of type SERVICE cannot log in with a password, and Snowflake is phasing out 
sign-in with a password alone for the other users too. With neither a password 
nor a key, every connection fails with `Missing password`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKey:
+        title: Private Key
+        description: 'The private key to log in with instead of a password: 
the key file in PEM format, encoded in base64 on a single line, such as the 
output of `base64 -w0 rsa_key.p8`. The PEM text itself, which starts with 
`-----BEGIN`, is not accepted. The matching public key must be set on the user 
with `ALTER USER ... SET RSA_PUBLIC_KEY`. Set this or `privateKeyFile`, not 
both: with both, every connection fails.'
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKeyFile:
+        title: Private Key File
+        description: 'The path of the private key file to log in with instead 
of a password, in PEM format, such as `rsa_key.p8` made as the Snowflake guide 
to key-pair authentication shows. In Kubernetes, mount the Secret that holds 
the key as a file. The matching public key must be set on the user with `ALTER 
USER ... SET RSA_PUBLIC_KEY`. A path that does not exist makes every connection 
fail with `Invalid parameter value null`.'
+        type: string
+        example: /etc/snowflake/rsa_key.p8
+      privateKeyPassphrase:
+        title: Private Key Passphrase
+        description: 'The passphrase of the key in `privateKey` or 
`privateKeyFile`, when the key is encrypted: its PEM text then starts with 
`-----BEGIN ENCRYPTED PRIVATE KEY-----`. Without it, or with a wrong one, every 
connection fails.'
         type: string
         format: password
         x-descriptors:
@@ -110,9 +128,12 @@ spec:
         factoryMethod: createDataSource
         properties:
           user: "{{username}}"
-          password: "{{password}}"
+          password: "{{password:}}"
           url: "jdbc:snowflake://{{instanceUrl}}"
           databaseName: "{{?databaseName}}"
+          properties[private_key_base64]: "{{?privateKey}}"
+          properties[private_key_file]: "{{?privateKeyFile}}"
+          properties[private_key_pwd]: "{{?privateKeyPassphrase}}"
     from:
       uri: 
"{{local-sql-snowflake-source}}:{{query}}?dataSource=#bean:{{dsBean}}&onConsume=RAW({{?consumedQuery}})&delay={{delay}}"
       steps:
diff --git 
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json 
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 22e55fe28..48e79ce9b 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -2065,7 +2065,7 @@
     "supportLevel" : "Preview",
     "title" : "Snowflake Sink",
     "summary" : "Runs an SQL statement, such as an INSERT, in a Snowflake 
database for each message, with values taken from the fields of the JSON object 
in the body.",
-    "description" : "Runs an SQL statement, such as an INSERT, in a Snowflake 
database for each message, with values taken from the fields of the JSON object 
in the body.\n\nUse it to store records from another system as rows of a table, 
such as each order that arrives on a Kafka topic, or to update or delete rows. 
To read rows, use `snowflake-source`.\n\nInput: the body is one JSON object, as 
text, such as `{\"username\":\"oscerd\",\"city\":\"Rome\"}`. In `query`, write 
`:#username` whe [...]
+    "description" : "Runs an SQL statement, such as an INSERT, in a Snowflake 
database for each message, with values taken from the fields of the JSON object 
in the body.\n\nUse it to store records from another system as rows of a table, 
such as each order that arrives on a Kafka topic, or to update or delete rows. 
To read rows, use `snowflake-source`.\n\nInput: the body is one JSON object, as 
text, such as `{\"username\":\"oscerd\",\"city\":\"Rome\"}`. In `query`, write 
`:#username` whe [...]
     "group" : "SQL",
     "namespace" : "Database",
     "provider" : "Apache Software Foundation"
@@ -2075,7 +2075,7 @@
     "supportLevel" : "Preview",
     "title" : "Snowflake Source",
     "summary" : "Runs an SQL query in a Snowflake database again and again, 
and sends each row it returns as a message, as a JSON object.",
-    "description" : "Runs an SQL query in a Snowflake database again and 
again, and sends each row it returns as a message, as a JSON object.\n\nUse it 
to pick up the rows that another application adds to a table, such as new 
orders or events, and pass them on to another system. To write rows, use 
`snowflake-sink`.\n\nOutput: the body is one row as JSON text, an object with 
the column names as keys, such as 
`{\"id\":1,\"username\":\"oscerd\",\"city\":\"Rome\"}`. The `Content-Type` 
header [...]
+    "description" : "Runs an SQL query in a Snowflake database again and 
again, and sends each row it returns as a message, as a JSON object.\n\nUse it 
to pick up the rows that another application adds to a table, such as new 
orders or events, and pass them on to another system. To write rows, use 
`snowflake-sink`.\n\nOutput: the body is one row as JSON text, an object with 
the column names as keys, such as 
`{\"id\":1,\"username\":\"oscerd\",\"city\":\"Rome\"}`. The `Content-Type` 
header [...]
     "group" : "SQL",
     "namespace" : "Database",
     "provider" : "Apache Software Foundation"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/snowflake-sink.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/snowflake-sink.kamelet.yaml
index e3e807be6..5fccd181e 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/snowflake-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/snowflake-sink.kamelet.yaml
@@ -39,11 +39,10 @@ spec:
 
       Output: the body afterwards is the JSON object as a Map, and the 
`CamelSqlUpdateCount` header holds the number of rows the statement changed. 
When `query` is a SELECT, the body is instead a List of the rows found, each a 
Map, and the `CamelSqlRowCount` header holds their number.
 
-      Good to know: a message fails when its body is not a JSON object (a JSON 
array or plain text, for example), or when it has no value for a parameter of 
`query`. The values are sent to the database apart from the SQL text, so the 
content of a message cannot change the statement. Do not write `?` in `query`, 
not even in a quoted string: the Kamelet then fails to start.
+      Good to know: a message fails when its body is not a JSON object (a JSON 
array or plain text, for example), or when it has no value for a parameter of 
`query`. The values are sent to the database apart from the SQL text, so the 
content of a message cannot change the statement. Do not write `?` in `query`, 
not even in a quoted string: the Kamelet then fails to start. Log in with 
`password`, or with a key pair in `privateKey` or `privateKeyFile`: a Snowflake 
user of type SERVICE, mea [...]
     required:
       - instanceUrl
       - username
-      - password
       - query
     type: object
     properties:
@@ -60,7 +59,26 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of the Snowflake user `username`.
+        description: The password of the Snowflake user `username`. Leave it 
empty to log in with a key pair instead, set in `privateKey` or 
`privateKeyFile`; when a key is set, the password is not used. A Snowflake user 
of type SERVICE cannot log in with a password, and Snowflake is phasing out 
sign-in with a password alone for the other users too. With neither a password 
nor a key, every connection fails with `Missing password`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKey:
+        title: Private Key
+        description: 'The private key to log in with instead of a password: 
the key file in PEM format, encoded in base64 on a single line, such as the 
output of `base64 -w0 rsa_key.p8`. The PEM text itself, which starts with 
`-----BEGIN`, is not accepted. The matching public key must be set on the user 
with `ALTER USER ... SET RSA_PUBLIC_KEY`. Set this or `privateKeyFile`, not 
both: with both, every connection fails.'
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKeyFile:
+        title: Private Key File
+        description: 'The path of the private key file to log in with instead 
of a password, in PEM format, such as `rsa_key.p8` made as the Snowflake guide 
to key-pair authentication shows. In Kubernetes, mount the Secret that holds 
the key as a file. The matching public key must be set on the user with `ALTER 
USER ... SET RSA_PUBLIC_KEY`. A path that does not exist makes every connection 
fail with `Invalid parameter value null`.'
+        type: string
+        example: /etc/snowflake/rsa_key.p8
+      privateKeyPassphrase:
+        title: Private Key Passphrase
+        description: 'The passphrase of the key in `privateKey` or 
`privateKeyFile`, when the key is encrypted: its PEM text then starts with 
`-----BEGIN ENCRYPTED PRIVATE KEY-----`. Without it, or with a wrong one, every 
connection fails.'
         type: string
         format: password
         x-descriptors:
@@ -106,9 +124,12 @@ spec:
         factoryMethod: createDataSource
         properties:
           user: "{{username}}"
-          password: "{{password}}"
+          password: "{{password:}}"
           url: "jdbc:snowflake://{{instanceUrl}}"
           databaseName: "{{?databaseName}}"
+          properties[private_key_base64]: "{{?privateKey}}"
+          properties[private_key_file]: "{{?privateKeyFile}}"
+          properties[private_key_pwd]: "{{?privateKeyPassphrase}}"
     from:
       uri: kamelet:source
       steps:
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/snowflake-source.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/snowflake-source.kamelet.yaml
index 157d26ed9..c7621d8ec 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/snowflake-source.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/snowflake-source.kamelet.yaml
@@ -37,11 +37,10 @@ spec:
 
       Output: the body is one row as JSON text, an object with the column 
names as keys, such as `{"id":1,"username":"oscerd","city":"Rome"}`. The 
`Content-Type` header is `application/json`.
 
-      Good to know: the query runs again `delay` milliseconds after the 
previous run, so the same rows are sent again and again, unless `consumedQuery` 
marks or deletes each row once it is sent and `query` leaves such rows out: for 
example `SELECT * FROM accounts WHERE processed = false` with `UPDATE accounts 
SET processed = true WHERE id = :#id`. When the next step fails for a row, 
`consumedQuery` is not run for it, and the row is read again. A query that 
finds no rows sends nothing. `q [...]
+      Good to know: the query runs again `delay` milliseconds after the 
previous run, so the same rows are sent again and again, unless `consumedQuery` 
marks or deletes each row once it is sent and `query` leaves such rows out: for 
example `SELECT * FROM accounts WHERE processed = false` with `UPDATE accounts 
SET processed = true WHERE id = :#id`. When the next step fails for a row, 
`consumedQuery` is not run for it, and the row is read again. A query that 
finds no rows sends nothing. `q [...]
     required:
       - instanceUrl
       - username
-      - password
       - query
     type: object
     properties:
@@ -58,7 +57,26 @@ spec:
         - urn:camel:group:credentials
       password:
         title: Password
-        description: The password of the Snowflake user `username`.
+        description: The password of the Snowflake user `username`. Leave it 
empty to log in with a key pair instead, set in `privateKey` or 
`privateKeyFile`; when a key is set, the password is not used. A Snowflake user 
of type SERVICE cannot log in with a password, and Snowflake is phasing out 
sign-in with a password alone for the other users too. With neither a password 
nor a key, every connection fails with `Missing password`.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKey:
+        title: Private Key
+        description: 'The private key to log in with instead of a password: 
the key file in PEM format, encoded in base64 on a single line, such as the 
output of `base64 -w0 rsa_key.p8`. The PEM text itself, which starts with 
`-----BEGIN`, is not accepted. The matching public key must be set on the user 
with `ALTER USER ... SET RSA_PUBLIC_KEY`. Set this or `privateKeyFile`, not 
both: with both, every connection fails.'
+        type: string
+        format: password
+        x-descriptors:
+        - urn:camel:group:credentials
+      privateKeyFile:
+        title: Private Key File
+        description: 'The path of the private key file to log in with instead 
of a password, in PEM format, such as `rsa_key.p8` made as the Snowflake guide 
to key-pair authentication shows. In Kubernetes, mount the Secret that holds 
the key as a file. The matching public key must be set on the user with `ALTER 
USER ... SET RSA_PUBLIC_KEY`. A path that does not exist makes every connection 
fail with `Invalid parameter value null`.'
+        type: string
+        example: /etc/snowflake/rsa_key.p8
+      privateKeyPassphrase:
+        title: Private Key Passphrase
+        description: 'The passphrase of the key in `privateKey` or 
`privateKeyFile`, when the key is encrypted: its PEM text then starts with 
`-----BEGIN ENCRYPTED PRIVATE KEY-----`. Without it, or with a wrong one, every 
connection fails.'
         type: string
         format: password
         x-descriptors:
@@ -110,9 +128,12 @@ spec:
         factoryMethod: createDataSource
         properties:
           user: "{{username}}"
-          password: "{{password}}"
+          password: "{{password:}}"
           url: "jdbc:snowflake://{{instanceUrl}}"
           databaseName: "{{?databaseName}}"
+          properties[private_key_base64]: "{{?privateKey}}"
+          properties[private_key_file]: "{{?privateKeyFile}}"
+          properties[private_key_pwd]: "{{?privateKeyPassphrase}}"
     from:
       uri: 
"{{local-sql-snowflake-source}}:{{query}}?dataSource=#bean:{{dsBean}}&onConsume=RAW({{?consumedQuery}})&delay={{delay}}"
       steps:

Reply via email to