forked from cloudevents/spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
discovery.yaml
358 lines (358 loc) · 13.1 KB
/
discovery.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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
openapi: '3.0.2'
info:
title: CloudEvents discovery API
description: CloudEvents discovery API specification according to [Discovery - Version 0.1-wip](https://github.com/cloudevents/spec/blob/main/discovery/spec.md#service).
version: '0.1-WIP'
servers:
- url: https://api.cloudevents.io/test/v0.1
paths:
/services:
get:
operationId: getServices
description: Get an optionally filtered collection of the Services known by this discovery end point
parameters:
- in: query
name: name
description: The name of the service to be returned
required: false
schema:
$ref: '#/components/schemas/service/properties/name'
responses:
'200':
description: A list of services (optionally matching the query parameter)
content:
application/json:
schema:
$ref: '#/components/schemas/services'
post:
operationId: postServices
requestBody:
$ref: '#/components/requestBodies/servicespostrequest'
responses:
'200':
$ref: '#/components/responses/servicespostresponse'
'400':
description: Bad Request - constraint failure
'409':
description: Conflict - epoch not greater
delete:
operationId: deleteServices
requestBody:
$ref: '#/components/requestBodies/servicesdeleterequest'
responses:
'200':
$ref: '#/components/responses/servicesdeleteresponse'
'400':
description: Bad Request - constraint failure
'404':
description: Not Found
'409':
description: Conflict - epoch not greater
/services/{id}:
get:
operationId: getService
parameters:
- $ref: '#/components/parameters/id'
responses:
'200':
description: The corresponding service
content:
application/json:
schema:
$ref: '#/components/schemas/service'
'404':
description: Not Found
put:
operationId: putService
parameters:
- $ref: '#/components/parameters/id'
requestBody:
$ref: '#/components/requestBodies/serviceputrequest'
responses:
'200':
$ref: '#/components/responses/serviceputresponse'
'400':
description: Bad Request - constraint failure
'404':
description: Not Found
'409':
description: Conflict - epoch not greater
delete:
operationId: deleteService
parameters:
- $ref: '#/components/parameters/id'
requestBody:
$ref: '#/components/requestBodies/servicedeleterequest'
responses:
'200':
$ref: '#/components/responses/servicedeleteresponse'
'400':
description: Bad Request - constraint failure
'404':
description: Not Found
'409':
description: Conflict - epoch not greater
components:
parameters:
id:
in: path
name: id
description: The id of the service
required: true
schema:
$ref: '#/components/schemas/service/properties/id'
requestBodies:
servicespostrequest:
description: A request to create or update the discovery endpoint's collection of services with the given services
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/services'
servicesdeleterequest:
description: A request to remove the given services from the discovery endpoint's collection of services
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/serviceinstances'
serviceputrequest:
description: A request to create or update the discovery endpoint's collection of services with the given service
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/service'
servicedeleterequest:
description: A request to remove the given service from the discovery endpoint's collection of services
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/serviceinstance'
responses:
servicespostresponse:
description: A list of the resulting Service values resulting from processing the request, in the same order as in the request
content:
application/json:
schema:
$ref: '#/components/schemas/services'
servicesdeleteresponse:
description: A list of the Services that were deleted
content:
application/json:
schema:
$ref: '#/components/schemas/services'
serviceputresponse:
description: A Service Instance referencing the updated Service
content:
application/json:
schema:
$ref: '#/components/schemas/service'
servicedeleteresponse:
description: The Service that was deleted
content:
application/json:
schema:
$ref: '#/components/schemas/service'
schemas:
eventtype:
type: object
properties:
type:
type: string
description: CloudEvents type attribute
example: com.github.pull.create, com.example.object.delete.v2
description:
type: string
description: Human readable description
dataschema:
type: string
description: CloudEvents datacontenttype attribute. Indicating how the data attribute of subscribed events will be encoded
dataschematype:
type: string
description: If using dataschemacontent for inline schema storage, the dataschematype indicates the type of schema represented there
dataschemacontent:
type: string
description: An inline representation of the schema of the data attribute encoding mechanism. This is an alternative to using the dataschema attribute
sourcetemplate:
type: string
description: A URI Template according to RFC 6570 that defines how the source attribute will be generated
example: "http://blob.store/{bucket}"
extensions:
type: array
description: An array or CloudEvents Extension Context Attributes that are used for this event type
items:
type: object
properties:
name:
type: string
description: The CloudEvents context attribute name used by this extension
type:
type: string
description: The data type of the extension attribute
specurl:
type: string
description: An attribute pointing to the specification that defines the extension
example: '{ "name": "dataref", "type": "URI-reference", "specurl": "https://github.com/cloudevents/spec/blob/main/extensions/dataref.md" }'
eventtypes:
type: array
items:
$ref: '#/components/schemas/eventtype'
serviceinstance:
type: object
properties:
id:
type: string
description: A unique identifier for this Service. This value MUST be globally unique
format: uuid
example: bf5ff5cc-d059-4c79-a89a-2513e45a1340
epoch:
type: integer
description: The Discovery Endpoint's epoch value for this Service Entry
format: int64
example: 42
serviceinstances:
type: array
items:
$ref: '#/components/schemas/serviceinstance'
service:
type: object
properties:
id:
$ref: '#/components/schemas/serviceinstance/properties/id'
epoch:
$ref: '#/components/schemas/serviceinstance/properties/epoch'
name:
type: string
description: A unique identifier for this Service
example: my storage service
url:
type: string
description: A URL that references this Service. This value MUST be usable in subsequent requests, by authorized clients, to retrieve this Service entity
example: http://example.com/services/bf5ff5cc-d059-4c79-a89a-2513e45a1340
description:
type: string
description: Human readable description
docsurl:
type: string
description: Absolute URL that provides a link to additional documentation about the service. This is intended for a developer to use in order to learn more about this service's events produced
example: http://cloud.example.com/docs/blobstorage
specversions:
type: array
description: CloudEvents specversions that can be used for events published for this service
items:
type: string
description: version
example: '[ "1.0" ]'
subscriptionurl:
type: string
description: An absolute URL indicating where CloudSubscriptions subscribe API calls MUST be sent to
format: url
subscriptionconfig:
type: object
description: "A map indicating supported options for the config parameter for the CloudSubscriptions subscribe() API call. Keys are the name of keys in the allowed config map, the values indicate the type of that parameter, confirming to the CloudEvents type system. TODO: Needs resolution with CloudSubscriptions API"
additionalProperties:
type: string
subscriptiondialects:
type: array
description: Filter dialects that can be used in subscriptions for this service
items:
type: string
description: filter dialect
example: '[ "basic" ]'
authscope:
type: string
description: Authorization scope needed for creating subscriptions. The actual meaning of this field is determined on a per-service basis
example: storage.read
protocols:
type: array
description: This field describes the different values that might be passed in the protocol field of the CloudSubscriptions API. The protocols with existing CloudEvents bindings are identified as AMQP, MQTT3, MQTT5, HTTP, KAFKA, and NATS. An implementation MAY add support for further protocols. All services MUST support at least one delivery protocol, and MAY support additional protocols
items:
type: string
description: protocol
example: '[ "HTTP", "AMQP", "KAFKA" ]'
events:
$ref: '#/components/schemas/eventtypes'
services:
type: array
items:
$ref: '#/components/schemas/service'
# This schema is returned as the `dataschemacontent` when discovery endpoints offer themselves as Service entities
change:
type: object
oneOf:
- $ref: '#/components/schemas/changeservicespost'
- $ref: '#/components/schemas/changeserviceput'
- $ref: '#/components/schemas/changeservicesdelete'
- $ref: '#/components/schemas/changeservicedelete'
changes:
type: array
items:
$ref: '#/components/schemas/change'
changepost:
type: string
enum:
- POST
changeput:
type: string
enum:
- PUT
changedelete:
type: string
enum:
- DELETE
changeservicespath:
type: string
pattern: ^\/services(\/){0,1}$
changeservicepath:
type: string
pattern: ^\/services(\/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}){0,1}$
changeservicespost:
type: object
properties:
operation:
$ref: '#/components/schemas/changepost'
path:
$ref: '#/components/schemas/changeservicespath'
request:
$ref: '#/components/requestBodies/servicespostrequest'
response:
$ref: '#/components/responses/servicespostresponse'
required: [operation, path, request, response]
changeservicesdelete:
type: object
properties:
operation:
$ref: '#/components/schemas/changedelete'
path:
$ref: '#/components/schemas/changeservicespath'
request:
$ref: '#/components/requestBodies/servicesdeleterequest'
response:
$ref: '#/components/responses/servicesdeleteresponse'
required: [operation, path, request, response]
changeserviceput:
type: object
properties:
operation:
$ref: '#/components/schemas/changeput'
path:
$ref: '#/components/schemas/changeservicepath'
request:
$ref: '#/components/requestBodies/serviceputrequest'
response:
$ref: '#/components/responses/serviceputresponse'
required: [operation, path, request, response]
changeservicedelete:
type: object
properties:
operation:
$ref: '#/components/schemas/changedelete'
path:
$ref: '#/components/schemas/changeservicepath'
request:
$ref: '#/components/requestBodies/servicedeleterequest'
response:
$ref: '#/components/responses/servicedeleteresponse'
required: [operation, path, request, response]