You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/gateway-api.md
+35-34Lines changed: 35 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,16 @@
1
1
# Gateway API
2
2
3
-
Please note that if there are duplicate `proxyTo` URLs in the backend configuration,
4
-
the RoutedTo in the Query History page might not be shown correctly.
3
+
The REST API for Trino Gateway can be used to update routing configuration for
4
+
the Trino clusters. Note that the API calls do not perform actions on the
5
+
clusters themselves.
5
6
6
-
## Add or update a backend
7
+
The example commands are for a Trino Gateway server running at
8
+
`http://localhost:8080`.
9
+
10
+
If there are duplicate `proxyTo` URLs in the configuration, the `Name` in the
11
+
**Query History** page of the UI might not show correctly.
12
+
13
+
## Add or update a Trino cluster
7
14
8
15
```shell
9
16
curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
@@ -14,9 +21,9 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
14
21
}'
15
22
```
16
23
17
-
If the backend URL is different from the `proxyTo` URL (for example if they are
18
-
internal vs. external hostnames). You can use the optional`externalUrl` field
19
-
to override the link in the Active Backends page.
24
+
If the Trino cluster URL is different from the `proxyTo` URL, for example if
25
+
they are internal and external hostnames used, you can use the optional
26
+
`externalUrl` field to override the link in the **Active Backends** page.
20
27
21
28
```shell
22
29
curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
@@ -28,9 +35,14 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
28
35
}'
29
36
```
30
37
31
-
## Get all backends
38
+
## List all Trino clusters
39
+
40
+
```shell
41
+
curl -X GET http://localhost:8080/entity/GATEWAY_BACKEND
42
+
```
43
+
44
+
Returns a JSON array of Trino cluster:
32
45
33
-
`curl -X GET http://localhost:8080/entity/GATEWAY_BACKEND`
34
46
```json
35
47
[
36
48
{
@@ -57,25 +69,26 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
57
69
]
58
70
```
59
71
60
-
## Delete a backend
72
+
## Delete a Trino cluster
61
73
62
74
```shell
63
75
curl -X POST -d "trino3" http://localhost:8080/gateway/backend/modify/delete
64
76
```
65
77
66
-
## Deactivate a backend
78
+
## Deactivate a Trino cluster
67
79
68
80
```shell
69
81
curl -X POST http://localhost:8080/gateway/backend/deactivate/trino-2
70
82
```
71
83
72
-
## Get all active backends
84
+
## List all active Trino clusters
73
85
74
86
```shell
75
87
curl -X GET http://localhost:8080/gateway/backend/active
76
88
```
77
89
78
-
Will return a JSON array of active Trino cluster backends:
90
+
Returns a JSON array of active Trino clusters:
91
+
79
92
```json
80
93
[
81
94
{
@@ -88,18 +101,22 @@ Will return a JSON array of active Trino cluster backends:
88
101
]
89
102
```
90
103
91
-
## Activate a backend
104
+
## Activate a Trino cluster
92
105
93
106
```shell
94
107
curl -X POST http://localhost:8080/gateway/backend/activate/trino-2
95
108
```
96
109
97
-
## Update Routing Rules
110
+
## Update routing rules
98
111
99
-
This API can be used to programmatically update the Routing Rules.
100
-
Rule will be updated based on the rule name.
112
+
The API can be used to programmatically update the routing rules. Rule are
113
+
updated based on the rule name. Storage of the rules must use a writeable file
114
+
and the configuration 'rulesType: FILE'.
101
115
102
-
For this feature to work with multiple replicas of the Trino Gateway, you will need to provide a shared storage that supports file locking for the routing rules file. If multiple replicas are used with local storage, then rules will get out of sync when updated.
116
+
For this feature to work with multiple replicas of the Trino Gateway, you must
117
+
provide a shared storage that supports file locking for the routing rules file.
118
+
If multiple replicas are used with local storage, then rules get out of
119
+
sync when updated.
103
120
104
121
```shell
105
122
curl -X POST http://localhost:8080/webapp/updateRoutingRules \
@@ -111,20 +128,4 @@ curl -X POST http://localhost:8080/webapp/updateRoutingRules \
111
128
"condition": "updated condition"
112
129
}'
113
130
```
114
-
### Disable Routing Rules UI
115
-
116
-
You can set the `disablePages` config to disable pages on the UI.
0 commit comments