Skip to content

Commit 20f0f6b

Browse files
amoghrajeshAnkurdeewan
authored andcommitted
[Part 2] Migrate connection UI metadata to YAML for more providers (apache#62109)
1 parent 621b177 commit 20f0f6b

File tree

20 files changed

+376
-4
lines changed

20 files changed

+376
-4
lines changed

providers/cncf/kubernetes/provider.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,70 @@ triggers:
163163
connection-types:
164164
- hook-class-name: airflow.providers.cncf.kubernetes.hooks.kubernetes.KubernetesHook
165165
connection-type: kubernetes
166+
conn-fields:
167+
in_cluster:
168+
label: In cluster configuration
169+
schema:
170+
type:
171+
- boolean
172+
- 'null'
173+
kube_config_path:
174+
label: Kube config path
175+
schema:
176+
type:
177+
- string
178+
- 'null'
179+
kube_config:
180+
label: Kube config (JSON format)
181+
schema:
182+
type:
183+
- string
184+
- 'null'
185+
format: password
186+
namespace:
187+
label: Namespace
188+
schema:
189+
type:
190+
- string
191+
- 'null'
192+
cluster_context:
193+
label: Cluster context
194+
schema:
195+
type:
196+
- string
197+
- 'null'
198+
disable_verify_ssl:
199+
label: Disable SSL
200+
schema:
201+
type:
202+
- boolean
203+
- 'null'
204+
disable_tcp_keepalive:
205+
label: Disable TCP keepalive
206+
schema:
207+
type:
208+
- boolean
209+
- 'null'
210+
xcom_sidecar_container_image:
211+
label: XCom sidecar image
212+
schema:
213+
type:
214+
- string
215+
- 'null'
216+
xcom_sidecar_container_resources:
217+
label: XCom sidecar resources (JSON format)
218+
schema:
219+
type:
220+
- string
221+
- 'null'
222+
ui-field-behaviour:
223+
hidden-fields:
224+
- host
225+
- schema
226+
- login
227+
- password
228+
- port
229+
- extra
166230

167231
task-decorators:
168232
- class-name: airflow.providers.cncf.kubernetes.decorators.kubernetes.kubernetes_task

providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/get_provider_info.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,35 @@ def get_provider_info():
7979
{
8080
"hook-class-name": "airflow.providers.cncf.kubernetes.hooks.kubernetes.KubernetesHook",
8181
"connection-type": "kubernetes",
82+
"conn-fields": {
83+
"in_cluster": {
84+
"label": "In cluster configuration",
85+
"schema": {"type": ["boolean", "null"]},
86+
},
87+
"kube_config_path": {"label": "Kube config path", "schema": {"type": ["string", "null"]}},
88+
"kube_config": {
89+
"label": "Kube config (JSON format)",
90+
"schema": {"type": ["string", "null"], "format": "password"},
91+
},
92+
"namespace": {"label": "Namespace", "schema": {"type": ["string", "null"]}},
93+
"cluster_context": {"label": "Cluster context", "schema": {"type": ["string", "null"]}},
94+
"disable_verify_ssl": {"label": "Disable SSL", "schema": {"type": ["boolean", "null"]}},
95+
"disable_tcp_keepalive": {
96+
"label": "Disable TCP keepalive",
97+
"schema": {"type": ["boolean", "null"]},
98+
},
99+
"xcom_sidecar_container_image": {
100+
"label": "XCom sidecar image",
101+
"schema": {"type": ["string", "null"]},
102+
},
103+
"xcom_sidecar_container_resources": {
104+
"label": "XCom sidecar resources (JSON format)",
105+
"schema": {"type": ["string", "null"]},
106+
},
107+
},
108+
"ui-field-behaviour": {
109+
"hidden-fields": ["host", "schema", "login", "password", "port", "extra"]
110+
},
82111
}
83112
],
84113
"task-decorators": [

providers/datadog/provider.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,38 @@ hooks:
7878
connection-types:
7979
- hook-class-name: airflow.providers.datadog.hooks.datadog.DatadogHook
8080
connection-type: datadog
81+
conn-fields:
82+
api_host:
83+
label: API endpoint
84+
schema:
85+
type:
86+
- string
87+
- 'null'
88+
api_key:
89+
label: API key
90+
schema:
91+
type:
92+
- string
93+
- 'null'
94+
app_key:
95+
label: Application key
96+
schema:
97+
type:
98+
- string
99+
- 'null'
100+
source_type_name:
101+
label: Source type name
102+
schema:
103+
type:
104+
- string
105+
- 'null'
106+
ui-field-behaviour:
107+
hidden-fields:
108+
- schema
109+
- login
110+
- password
111+
- port
112+
- extra
113+
relabeling:
114+
host: Events host name
115+
placeholders: {}

providers/datadog/src/airflow/providers/datadog/get_provider_info.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ def get_provider_info():
4444
{
4545
"hook-class-name": "airflow.providers.datadog.hooks.datadog.DatadogHook",
4646
"connection-type": "datadog",
47+
"conn-fields": {
48+
"api_host": {"label": "API endpoint", "schema": {"type": ["string", "null"]}},
49+
"api_key": {"label": "API key", "schema": {"type": ["string", "null"]}},
50+
"app_key": {"label": "Application key", "schema": {"type": ["string", "null"]}},
51+
"source_type_name": {"label": "Source type name", "schema": {"type": ["string", "null"]}},
52+
},
53+
"ui-field-behaviour": {
54+
"hidden-fields": ["schema", "login", "password", "port", "extra"],
55+
"relabeling": {"host": "Events host name"},
56+
"placeholders": {},
57+
},
4758
}
4859
],
4960
}

providers/docker/provider.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,28 @@ hooks:
115115
connection-types:
116116
- hook-class-name: airflow.providers.docker.hooks.docker.DockerHook
117117
connection-type: docker
118+
conn-fields:
119+
reauth:
120+
label: Reauthenticate
121+
schema:
122+
type:
123+
- boolean
124+
- 'null'
125+
description: Whether or not to refresh existing authentication on the Docker server.
126+
email:
127+
label: Email
128+
schema:
129+
type:
130+
- string
131+
- 'null'
132+
ui-field-behaviour:
133+
hidden-fields:
134+
- schema
135+
relabeling:
136+
host: Registry URL
137+
login: Username
138+
placeholders:
139+
extra: '{"reauth": false, "email": "Jane.Doe@example.org"}'
118140

119141
task-decorators:
120142
- class-name: airflow.providers.docker.decorators.docker.docker_task

providers/docker/src/airflow/providers/docker/get_provider_info.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ def get_provider_info():
5454
{
5555
"hook-class-name": "airflow.providers.docker.hooks.docker.DockerHook",
5656
"connection-type": "docker",
57+
"conn-fields": {
58+
"reauth": {
59+
"label": "Reauthenticate",
60+
"schema": {"type": ["boolean", "null"]},
61+
"description": "Whether or not to refresh existing authentication on the Docker server.",
62+
},
63+
"email": {"label": "Email", "schema": {"type": ["string", "null"]}},
64+
},
65+
"ui-field-behaviour": {
66+
"hidden-fields": ["schema"],
67+
"relabeling": {"host": "Registry URL", "login": "Username"},
68+
"placeholders": {"extra": '{"reauth": false, "email": "Jane.Doe@example.org"}'},
69+
},
5770
}
5871
],
5972
"task-decorators": [

providers/git/provider.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,12 @@ bundles:
6262
connection-types:
6363
- hook-class-name: airflow.providers.git.hooks.git.GitHook
6464
connection-type: git
65+
ui-field-behaviour:
66+
hidden-fields:
67+
- schema
68+
relabeling:
69+
login: Username or Access Token name
70+
host: Repository URL
71+
password: Access Token (optional)
72+
placeholders:
73+
extra: '{"key_file": "optional/path/to/keyfile", "private_key": "optional inline private key"}'

providers/git/src/airflow/providers/git/get_provider_info.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ def get_provider_info():
3838
{"integration-name": "GIT (Git)", "python-modules": ["airflow.providers.git.bundles.git"]}
3939
],
4040
"connection-types": [
41-
{"hook-class-name": "airflow.providers.git.hooks.git.GitHook", "connection-type": "git"}
41+
{
42+
"hook-class-name": "airflow.providers.git.hooks.git.GitHook",
43+
"connection-type": "git",
44+
"ui-field-behaviour": {
45+
"hidden-fields": ["schema"],
46+
"relabeling": {
47+
"login": "Username or Access Token name",
48+
"host": "Repository URL",
49+
"password": "Access Token (optional)",
50+
},
51+
"placeholders": {
52+
"extra": '{"key_file": "optional/path/to/keyfile", "private_key": "optional inline private key"}'
53+
},
54+
},
55+
}
4256
],
4357
}

providers/grpc/provider.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,30 @@ hooks:
7676
connection-types:
7777
- hook-class-name: airflow.providers.grpc.hooks.grpc.GrpcHook
7878
connection-type: grpc
79+
ui-field-behaviour:
80+
hidden-fields:
81+
- login
82+
- password
83+
- schema
84+
- extra
85+
relabeling: {}
86+
placeholders: {}
87+
conn-fields:
88+
auth_type:
89+
label: "Grpc Auth Type"
90+
schema:
91+
type:
92+
- string
93+
- 'null'
94+
credential_pem_file:
95+
label: "Credential Keyfile Path"
96+
schema:
97+
type:
98+
- string
99+
- 'null'
100+
scopes:
101+
label: "Scopes (comma separated)"
102+
schema:
103+
type:
104+
- string
105+
- 'null'

providers/grpc/src/airflow/providers/grpc/get_provider_info.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ def get_provider_info():
3434
],
3535
"hooks": [{"integration-name": "gRPC", "python-modules": ["airflow.providers.grpc.hooks.grpc"]}],
3636
"connection-types": [
37-
{"hook-class-name": "airflow.providers.grpc.hooks.grpc.GrpcHook", "connection-type": "grpc"}
37+
{
38+
"hook-class-name": "airflow.providers.grpc.hooks.grpc.GrpcHook",
39+
"connection-type": "grpc",
40+
"ui-field-behaviour": {
41+
"hidden-fields": ["login", "password", "schema", "extra"],
42+
"relabeling": {},
43+
"placeholders": {},
44+
},
45+
"conn-fields": {
46+
"auth_type": {"label": "Grpc Auth Type", "schema": {"type": ["string", "null"]}},
47+
"credential_pem_file": {
48+
"label": "Credential Keyfile Path",
49+
"schema": {"type": ["string", "null"]},
50+
},
51+
"scopes": {"label": "Scopes (comma separated)", "schema": {"type": ["string", "null"]}},
52+
},
53+
}
3854
],
3955
}

0 commit comments

Comments
 (0)