-
Notifications
You must be signed in to change notification settings - Fork 2
/
apiary.apib
198 lines (146 loc) · 4.98 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# GoSLB API
GoSLB server has two REST API groups: Services API and Cat API. Services API is used
to configure the services (DNS records). Cat API is a read-only API used for querying
the current state in a CLI friendly format.
# Service object fields
* **Domain** [string]: Fully qualified domain name of the service
* **Endpoints:** [Endpoint]: List of Endpoint objects
* **Monitor** [Monitor]: Health monitor configuration for the service endpoints
# Endpoint object fields
* **IP** [string]: Endpoint IP address
* **Enabled** [boolean]: If false, endpoint is disabled: not monitored and not returned in any DNS
replies
* **Priority** [number]: Endpoint's priority. From the enabled, healthy endpoints, only those with
highest priority are returned
* **Site** [string]: Site the endpoint belongs to. Clients are assigned a site based on IP ranges on
every request. Endpoints in client's local site are preferred over other sites.
# Monitor object fields
* **Type** [string]: Either TCP or HTTP
* **Interval** [number]: Monitor execution interval in seconds
* **Timeout** [number]: Monitor execution timeout in seconds
* **Port** [number]: TCP port to probe
**HTTP monitor extra fields:**
* **URI** [string]: HTTP URI to fetch
* **SuccessCodes** [number]: List of HTTP status codes that are considered success
# Group Services API
Manage services, endpoints and health monitors.
## Service collection [/services/]
### List all services [GET]
+ Response 200 (application/json)
[
"foo.goslb.",
"bar.goslb."
]
### Create a New Service [POST]
+ Request (application/json)
{
"Domain": "foo.goslb.",
"Endpoints": [
{
"IP": "127.0.0.1",
"Enabled": true,
"Priority": 0,
"Site": "london"
},
{
"IP": "172.31.1.31",
"Enabled": true,
"Priority": 0,
"Site": "prague"
}
],
"Monitor": {
"Type": "TCP",
"Interval": 10,
"Timeout": 2,
"Port": 80
}
}
+ Response 201 (application/json)
+ Headers
Location: /services/foo.goslb.
+ Body
{
"Success":true
}
## Service [/services/{service}]
+ Parameters
+ service (required, string, `foo.goslb.`) ... Service fully-qualified domain name
### Retreive a Service configuration [GET]
+ Response 200 (application/json)
{
"Domain": "foo.goslb.",
"Endpoints": [
{
"IP": "127.0.0.1",
"Enabled": true,
"Priority": 0,
"Site": "london",
"Healthy": true
},
{
"IP": "172.31.1.31",
"Enabled": true,
"Priority": 0,
"Site": "prague",
"Healthy": true
}
],
"Monitor": {
"Type": "TCP",
"Interval": 10,
"Timeout": 2,
"Port": 80,
"Uri": "",
"SuccessCodes": null
}
}
### Update a Service [PUT]
+ Request (application/json)
{
"Domain": "foo.goslb.",
"Endpoints": [
{
"IP": "127.0.0.1",
"Enabled": false,
"Site": "london",
},
{
"IP": "172.31.1.31",
"Enabled": true,
"Site": "prague",
}
],
"Monitor": {
"Type": "TCP",
"Interval": 10,
"Timeout": 2,
"Port": 8080,
}
}
+ Response 200 (application/json)
{
"Success": true
}
### Delete a Service [DELETE]
+ Response 200 (application/json)
{
"Success": true
}
# Group _cat API
The cat API (thanks Elasticsearch for the idea) is a simple read-only API for
human interaction. It shows the information in text tabular format, parseable
by standard cli tools.
## Endpoints [/_cat/endpoints/{service}]
+ Parameters
+ service (required, string, `foo.goslb.`) ... Service fully-qualified domain name
### Retrieve Endpoints' status [GET]
+ Response 200 (text/plain)
IP Enabled Healthy Priority Site
127.0.0.1 true false 0 london
172.31.1.31 true false 0 prague
## Client Site [/_cat/clientsite]
### Retrieve Client Site [GET]
Returns what site the API cient belongs to (based on the client IP)
+ Response 200 (text/plain)
127.0.0.1: london