|
6 | 6 | type ClientCredentialAccountField, |
7 | 7 | } from '@/lib/credentials/client-credential-accounts/descriptors' |
8 | 8 | import { |
| 9 | + SNOWFLAKE_SERVICE_ACCOUNT_PROVIDER_ID, |
9 | 10 | TOKEN_SERVICE_ACCOUNT_DESCRIPTORS, |
10 | 11 | type TokenServiceAccountField, |
11 | 12 | } from '@/lib/credentials/token-service-accounts/descriptors' |
@@ -164,8 +165,8 @@ function keylessModeFor(providerId: string): KeylessCatalogMode | undefined { |
164 | 165 | /** |
165 | 166 | * Adds a provider's keyless mode to its key-based descriptor, the same way for |
166 | 167 | * every keyless provider: one description suffix, and a hint on the |
167 | | - * `serviceAccountJson` field — which a token provider such as Snowflake gains |
168 | | - * as an optional alternative to its token fields. |
| 168 | + * `serviceAccountJson` field, which is added as an optional alternative to the |
| 169 | + * other fields when the descriptor has none. |
169 | 170 | */ |
170 | 171 | function withKeylessMode( |
171 | 172 | descriptor: ServiceAccountDescriptor, |
@@ -441,6 +442,29 @@ function getServiceAccountDescriptor(providerId: string): ServiceAccountDescript |
441 | 442 | } |
442 | 443 | } |
443 | 444 |
|
| 445 | + if (providerId === SNOWFLAKE_SERVICE_ACCOUNT_PROVIDER_ID) { |
| 446 | + const tokenDescriptor = TOKEN_SERVICE_ACCOUNT_DESCRIPTORS[SNOWFLAKE_SERVICE_ACCOUNT_PROVIDER_ID] |
| 447 | + return { |
| 448 | + name: 'Snowflake connection', |
| 449 | + description: 'Connect Snowflake with a programmatic access token or an RSA key pair.', |
| 450 | + docsUrl: tokenDescriptor.docsUrl, |
| 451 | + helpText: tokenDescriptor.helpText, |
| 452 | + fields: [ |
| 453 | + ...tokenDescriptor.fields.map(providerField), |
| 454 | + { |
| 455 | + id: 'serviceAccountJson', |
| 456 | + label: 'Connection configuration', |
| 457 | + placeholder: |
| 458 | + '{"authType":"key_pair","host":"myorg-myaccount.snowflakecomputing.com","user":"SIM_SERVICE","privateKey":"-----BEGIN PRIVATE KEY-----..."}', |
| 459 | + required: false, |
| 460 | + secret: true, |
| 461 | + multiline: true, |
| 462 | + hint: 'Send instead of the other fields. Key pair: JSON object with authType: "key_pair", host, user, and privateKey (an unencrypted RSA private key as PEM, 2048 to 4096 bits, whose public key is set on the user).', |
| 463 | + }, |
| 464 | + ], |
| 465 | + } |
| 466 | + } |
| 467 | + |
444 | 468 | const tokenDescriptor = Object.hasOwn(TOKEN_SERVICE_ACCOUNT_DESCRIPTORS, providerId) |
445 | 469 | ? TOKEN_SERVICE_ACCOUNT_DESCRIPTORS[ |
446 | 470 | providerId as keyof typeof TOKEN_SERVICE_ACCOUNT_DESCRIPTORS |
|
0 commit comments