Skip to content

Commit c976d8d

Browse files
committed
Improve API documentation
Include moving unrelated config for UI into Installation page for now.
1 parent 4cf7e45 commit c976d8d

File tree

2 files changed

+54
-34
lines changed

2 files changed

+54
-34
lines changed

docs/gateway-api.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# Gateway API
22

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.
56

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
714

815
```shell
916
curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
@@ -14,9 +21,9 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
1421
}'
1522
```
1623

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.
2027

2128
```shell
2229
curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
@@ -28,9 +35,14 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
2835
}'
2936
```
3037

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:
3245

33-
`curl -X GET http://localhost:8080/entity/GATEWAY_BACKEND`
3446
```json
3547
[
3648
{
@@ -57,25 +69,26 @@ curl -X POST http://localhost:8080/entity?entityType=GATEWAY_BACKEND \
5769
]
5870
```
5971

60-
## Delete a backend
72+
## Delete a Trino cluster
6173

6274
```shell
6375
curl -X POST -d "trino3" http://localhost:8080/gateway/backend/modify/delete
6476
```
6577

66-
## Deactivate a backend
78+
## Deactivate a Trino cluster
6779

6880
```shell
6981
curl -X POST http://localhost:8080/gateway/backend/deactivate/trino-2
7082
```
7183

72-
## Get all active backends
84+
## List all active Trino clusters
7385

7486
```shell
7587
curl -X GET http://localhost:8080/gateway/backend/active
7688
```
7789

78-
Will return a JSON array of active Trino cluster backends:
90+
Returns a JSON array of active Trino clusters:
91+
7992
```json
8093
[
8194
{
@@ -88,18 +101,22 @@ Will return a JSON array of active Trino cluster backends:
88101
]
89102
```
90103

91-
## Activate a backend
104+
## Activate a Trino cluster
92105

93106
```shell
94107
curl -X POST http://localhost:8080/gateway/backend/activate/trino-2
95108
```
96109

97-
## Update Routing Rules
110+
## Update routing rules
98111

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'.
101115

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.
103120

104121
```shell
105122
curl -X POST http://localhost:8080/webapp/updateRoutingRules \
@@ -111,20 +128,4 @@ curl -X POST http://localhost:8080/webapp/updateRoutingRules \
111128
"condition": "updated condition"
112129
}'
113130
```
114-
### Disable Routing Rules UI
115-
116-
You can set the `disablePages` config to disable pages on the UI.
117-
118-
The following pages are available:
119-
- `dashboard`
120-
- `cluster`
121-
- `resource-group`
122-
- `selector`
123-
- `history`
124-
- `routing-rules`
125-
126-
```yaml
127-
uiConfiguration:
128-
disablePages:
129-
- 'routing-rules'
130-
```
131+

docs/installation.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,25 @@ additionalStatementPaths:
200200
- '/v2/statement'
201201
```
202202

203+
### Deactivate UI pages
204+
205+
You can set the `disablePages` configuration to deactivate UI pages.
206+
207+
```yaml
208+
uiConfiguration:
209+
disablePages:
210+
- 'routing-rules'
211+
```
212+
213+
The following pages are available:
214+
215+
- `dashboard`
216+
- `cluster`
217+
- `resource-group`
218+
- `selector`
219+
- `history`
220+
- `routing-rules`
221+
203222
## Configure behind a load balancer
204223

205224
A possible deployment of Trino Gateway is to run multiple instances of Trino

0 commit comments

Comments
 (0)