Skip to content

Commit f92afc6

Browse files
Merge pull request #3092 from confluentinc/ORC-8867
[ORC- 8867]feat: add confluent-jdbc connection
2 parents 685fc15 + a67d82d commit f92afc6

File tree

9 files changed

+49
-33
lines changed

9 files changed

+49
-33
lines changed

cmd/lint/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ var vocabWords = []string{
218218
"codec",
219219
"config",
220220
"configs",
221+
"confluent-jdbc",
221222
"consumer.config",
222223
"couchbase",
223224
"cpp",
@@ -249,6 +250,7 @@ var vocabWords = []string{
249250
"io",
250251
"ip",
251252
"ips",
253+
"jdbc",
252254
"json",
253255
"jit",
254256
"jsonschema",

pkg/flink/utils.go

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
package flink
22

33
var (
4-
ConnectionTypes = []string{"openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", "couchbase"}
4+
ConnectionTypes = []string{"openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", "couchbase", "confluent-jdbc"}
55
ConnectionTypeSecretMapping = map[string][]string{
6-
"openai": {"api-key"},
7-
"azureml": {"api-key"},
8-
"azureopenai": {"api-key"},
9-
"bedrock": {"aws-access-key", "aws-secret-key", "aws-session-token"},
10-
"sagemaker": {"aws-access-key", "aws-secret-key", "aws-session-token"},
11-
"googleai": {"api-key"},
12-
"vertexai": {"service-key"},
13-
"mongodb": {"username", "password"},
14-
"elastic": {"api-key"},
15-
"pinecone": {"api-key"},
16-
"couchbase": {"username", "password"},
6+
"openai": {"api-key"},
7+
"azureml": {"api-key"},
8+
"azureopenai": {"api-key"},
9+
"bedrock": {"aws-access-key", "aws-secret-key", "aws-session-token"},
10+
"sagemaker": {"aws-access-key", "aws-secret-key", "aws-session-token"},
11+
"googleai": {"api-key"},
12+
"vertexai": {"service-key"},
13+
"mongodb": {"username", "password"},
14+
"elastic": {"api-key"},
15+
"pinecone": {"api-key"},
16+
"couchbase": {"username", "password"},
17+
"confluent-jdbc": {"username", "password"},
1718
}
1819

1920
ConnectionSecretTypeMapping = map[string][]string{
@@ -22,22 +23,23 @@ var (
2223
"aws-secret-key": {"bedrock", "sagemaker"},
2324
"aws-session-token": {"bedrock", "sagemaker"},
2425
"service-key": {"vertexai"},
25-
"username": {"mongodb", "couchbase"},
26-
"password": {"mongodb", "couchbase"},
26+
"username": {"mongodb", "couchbase", "confluent-jdbc"},
27+
"password": {"mongodb", "couchbase", "confluent-jdbc"},
2728
}
2829

2930
ConnectionRequiredSecretMapping = map[string][]string{
30-
"openai": {"api-key"},
31-
"azureml": {"api-key"},
32-
"azureopenai": {"api-key"},
33-
"bedrock": {"aws-access-key", "aws-secret-key"},
34-
"sagemaker": {"aws-access-key", "aws-secret-key"},
35-
"googleai": {"api-key"},
36-
"vertexai": {"service-key"},
37-
"mongodb": {"username", "password"},
38-
"elastic": {"api-key"},
39-
"pinecone": {"api-key"},
40-
"couchbase": {"username", "password"},
31+
"openai": {"api-key"},
32+
"azureml": {"api-key"},
33+
"azureopenai": {"api-key"},
34+
"bedrock": {"aws-access-key", "aws-secret-key"},
35+
"sagemaker": {"aws-access-key", "aws-secret-key"},
36+
"googleai": {"api-key"},
37+
"vertexai": {"service-key"},
38+
"mongodb": {"username", "password"},
39+
"elastic": {"api-key"},
40+
"pinecone": {"api-key"},
41+
"couchbase": {"username", "password"},
42+
"confluent-jdbc": {"username", "password"},
4143
}
4244
ConnectionSecretBackendKeyMapping = map[string]string{
4345
"api-key": "API_KEY",

test/fixtures/output/flink/connection/create-help.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ Create Flink connection "my-connection" in AWS us-west-2 for OpenAPI with endpoi
1111
Flags:
1212
--cloud string REQUIRED: Specify the cloud provider as "aws", "azure", or "gcp".
1313
--region string REQUIRED: Cloud region for Flink (use "confluent flink region list" to see all).
14-
--type string REQUIRED: Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", or "couchbase".
14+
--type string REQUIRED: Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", "couchbase", or "confluent-jdbc".
1515
--endpoint string REQUIRED: Specify endpoint for the connection.
1616
--api-key string Specify API key for the type: "openai", "azureml", "azureopenai", "googleai", "elastic", or "pinecone".
1717
--aws-access-key string Specify access key for the type: "bedrock" or "sagemaker".
1818
--aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker".
1919
--aws-session-token string Specify session token for the type: "bedrock" or "sagemaker".
2020
--service-key string Specify service key for the type: "vertexai".
21-
--username string Specify username for the type: "mongodb" or "couchbase".
22-
--password string Specify password for the type: "mongodb" or "couchbase".
21+
--username string Specify username for the type: "mongodb", "couchbase", or "confluent-jdbc".
22+
--password string Specify password for the type: "mongodb", "couchbase", or "confluent-jdbc".
2323
--environment string Environment ID.
2424
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")
2525

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
+---------------+-----------------------------------------+
2+
| Creation Date | 2023-01-01 00:00:00 +0000 UTC |
3+
| Name | my-connection |
4+
| Environment | env-596 |
5+
| Cloud | aws |
6+
| Region | eu-west-1 |
7+
| Type | CONFLUENT-JDBC |
8+
| Endpoint | jdbc:mysql://custom.com:3306/customerdb |
9+
| Data | <REDACTED> |
10+
| Status | PENDING |
11+
+---------------+-----------------------------------------+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Error: invalid connection type OPENAI
22

33
Suggestions:
4-
Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", or "couchbase".
4+
Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", "couchbase", or "confluent-jdbc".

test/fixtures/output/flink/connection/list-help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Flags:
77
--cloud string REQUIRED: Specify the cloud provider as "aws", "azure", or "gcp".
88
--region string REQUIRED: Cloud region for Flink (use "confluent flink region list" to see all).
99
--environment string Environment ID.
10-
--type string Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", or "couchbase".
10+
--type string Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", "couchbase", or "confluent-jdbc".
1111
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")
1212

1313
Global Flags:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Error: invalid connection type invalid
22

33
Suggestions:
4-
Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", or "couchbase".
4+
Specify the connection type as "openai", "azureml", "azureopenai", "bedrock", "sagemaker", "googleai", "vertexai", "mongodb", "elastic", "pinecone", "couchbase", or "confluent-jdbc".

test/fixtures/output/flink/connection/update-help.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Flags:
1616
--aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker".
1717
--aws-session-token string Specify session token for the type: "bedrock" or "sagemaker".
1818
--service-key string Specify service key for the type: "vertexai".
19-
--username string Specify username for the type: "mongodb" or "couchbase".
20-
--password string Specify password for the type: "mongodb" or "couchbase".
19+
--username string Specify username for the type: "mongodb", "couchbase", or "confluent-jdbc".
20+
--password string Specify password for the type: "mongodb", "couchbase", or "confluent-jdbc".
2121
--environment string Environment ID.
2222
-o, --output string Specify the output format as "human", "json", or "yaml". (default "human")
2323

test/flink_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func (s *CLITestSuite) TestFlinkConnectionCreateSuccess() {
162162
{args: "flink connection create my-connection --cloud aws --region eu-west-1 --type elastic --endpoint https://api.openai.com/v1/chat/completions --api-key 0000000000000000", fixture: "flink/connection/create/create-elastic.golden"},
163163
{args: "flink connection create my-connection --cloud aws --region eu-west-1 --type pinecone --endpoint https://api.openai.com/v1/chat/completions --api-key 0000000000000000", fixture: "flink/connection/create/create-pinecone.golden"},
164164
{args: "flink connection create my-connection --cloud aws --region eu-west-1 --type couchbase --endpoint https://api.openai.com/v1/chat/completions --username name --password pass", fixture: "flink/connection/create/create-couchbase.golden"},
165+
{args: "flink connection create my-connection --cloud aws --region eu-west-1 --type confluent-jdbc --endpoint jdbc:mysql://custom.com:3306/customerdb --username name --password pass", fixture: "flink/connection/create/create-confluent_jdbc.golden"},
165166
}
166167

167168
for _, test := range tests {

0 commit comments

Comments
 (0)