-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathopenapi.yaml
272 lines (254 loc) · 8.16 KB
/
openapi.yaml
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# Copyright 2020, locate Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# [START swagger]
swagger: "2.0"
info:
description: |-
The locate API provides consistent, expected measurement quality for M-Lab
clients.
title: "M-Lab Locate API ({{DEPLOYMENT}})"
version: "2.0.0"
host: "locate-dot-{{PROJECT}}.appspot.com"
# [END swagger]
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
- "wss"
paths:
# Shared "nearest" requests without an API key.
"/v2/nearest/{name}/{type}":
get:
description: |-
Find the nearest healthy service.
All requests are scheduled as part of a "shared" resource pool. This
is a good choice for small client integrations. When the platform is
overloaded and the locate API must choose which requests to allow and
which to block, priority is given to requests using explicit API keys
to the /v2/priority/* resource.
This resource does not require an API key. All requests to this resource
are managed collectively as if they all used a single API key.
operationId: "v2-shared-nearest"
produces:
- "application/json"
parameters:
- name: name
in: path
description: The service name, e.g. "ndt", "neubot", "wehe", etc.
type: string
required: true
- name: type
in: path
description: The service type, e.g. "ndt7", "dash", "replay", etc.
type: string
required: true
responses:
# NOTE: non-number values are a schema error for the config, despite
# openapi documentation.
'200':
description: The result of the nearest request. Clients should use the
next request fields to schedule the next request in the event of
error or batch scheduling.
schema:
$ref: "#/definitions/NearestResult"
'500':
description: An error occurred while looking for the service.
Clients should use the next request fields to schedule the next
request in the event of error.
schema:
$ref: "#/definitions/ErrorResult"
tags:
- public
# Priority "nearest" requests WITH an API key.
"/v2/priority/nearest/{name}/{type}":
get:
description: |-
Find the nearest healthy service.
This resource requires an API key. When the system is under sufficient
load that the locate API must choose which requests to allow and which
to reject, these requests are prioritized over "shared" requests.
operationId: "v2-priority-nearest"
produces:
- "application/json"
parameters:
- name: name
in: path
description: service
type: string
required: true
- name: type
in: path
description: datatype
type: string
required: true
responses:
'200':
description: The result of the nearest request. Clients should use the
next request fields to schedule the next request for batch
scheduling.
schema:
$ref: "#/definitions/NearestResult"
'500':
description: An error occurred while looking for the service.
Clients should use the next request fields to schedule the next
request in the event of error.
schema:
$ref: "#/definitions/ErrorResult"
security:
- api_key: []
tags:
- public
"/v2/platform/heartbeat":
get:
description: |-
Platform-specific path.
operationId: "v2-platform-heartbeat"
responses:
'200':
description: OK.
security:
- api_key: []
tags:
- platform
"/v2/platform/prometheus":
get:
description: |-
Platform-specific path.
operationId: "v2-platform-prometheus"
responses:
'200':
description: OK.
security:
- api_key: []
tags:
- platform
"/v2/platform/monitoring/{name}/{type}":
get:
description: |-
Platform-specific path.
operationId: "v2-platform-monitoring"
parameters:
- name: name
in: path
description: service
type: string
required: true
- name: type
in: path
description: datatype
type: string
required: true
responses:
'200':
description: OK.
tags:
- platform
"/v2/siteinfo/registrations":
get:
description: |-
Returns heartbeat registration information in various formats.
operationId: "v2-siteinfo-registrations"
produces:
- "application/json"
responses:
'200':
description: OK.
'500':
description: Error.
tags:
- siteinfo
definitions:
# Define the query reply without being specific about the structure.
ErrorResult:
type: object
properties:
error:
type: object
properties:
type:
type: string
description: The error type.
title:
type: string
description: A descriptive title for this error.
status:
type: integer
description: The HTTP status code of this error, e.g. 4xx or 5xx.
detail:
type: string
instance:
type: string
next_request:
$ref: "#/definitions/NextRequest"
NearestResult:
type: object
properties:
next_request:
$ref: "#/definitions/NextRequest"
description: The next request defines the earliest time that a client
should make a new request using the included URL.
results:
type: array
items:
type: object
properties:
machine:
type: string
description: The machine name that all URLs reference.
location:
type: object
additionalProperties: {}
description: The machine location metadata.
urls:
type: object
additionalProperties: {}
description: Specific service URLs with access tokens.
NextRequest:
type: object
properties:
nbf:
type: string
description: |-
"not before" defines the time after which the URL will
become valid. This value is the same time used in "nbf" field of
the underlying JSON Web Token (JWT) claim. To show this equivalence,
we use the same name.
exp:
type: string
description: |-
Expires defines the time after which the URL will be invalid.
Expires will always be greater than NotBefore. This value is the
same time used in the "exp" field of the underlying JWT claim.
url:
type: string
description: |-
URL should be used to make the next request to the location service.
securityDefinitions:
# This section configures basic authentication with an API key.
# Paths configured with api_key security require an API key for all requests.
api_key:
type: "apiKey"
description: |-
An API key for your client integration restricted to the Locate API and
allocated using a self-service [signup](https://docs.google.com/forms/d/e/1FAIpQLSeWMiPSRWHIcg5GVRG-oc5kkefLpR4Nqk4aNYBFK6Wr8jAAdw/viewform)
or allocated by M-Lab for your client integration.
name: "key"
in: "query"
tags:
- name: public
description: Public API.
- name: platform
description: Platform API.