-
Notifications
You must be signed in to change notification settings - Fork 12
/
openapi-v2.yaml
462 lines (462 loc) · 13.9 KB
/
openapi-v2.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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
openapi: 3.0.3
info:
version: 0.0.1
title: Permissions API V2
contact:
name: Infratographer Authors
url: https://github.com/infratographer
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: http://localhost:7603/api/v2
paths:
/resources/{id}/roles:
get:
tags:
- roles
summary: list-roles
description: |
list all available roles for a resource, including roles that are
inherited from parent resources
operationId: listRoles
responses:
"200":
description: ""
post:
tags:
- roles
summary: create-role
description: |
create a role for a resource. The role will be available for use in
role-bindings for the resource
operationId: createRole
requestBody:
content:
application/json:
schema:
type: object
properties:
actions:
type: array
items:
type: string
example: loadbalancer_list
example:
- loadbalancer_list
- loadbalancer_get
- loadbalancer_update
- loadbalancer_create
name:
type: string
example: lb_editor
examples:
create-role:
value:
actions:
- loadbalancer_list
- loadbalancer_get
- loadbalancer_update
- loadbalancer_create
name: lb_editor
responses:
"201":
description: "role object"
content:
application/json:
schema:
type: object
properties:
actions:
type: array
items:
type: string
example: role_list
example:
- role_list
- rolebinding_create
- loadbalancer_list
- loadbalancer_update
- loadbalancer_delete
- role_create
- role_delete
- loadbalancer_create
- loadbalancer_get
- rolebinding_list
- rolebinding_delete
- role_get
- role_update
created_at:
type: string
example: "2024-02-28T17:22:04Z"
created_by:
type: string
example: idntusr-bailin
id:
type: string
example: permrv2-ecBlNMsPrvVFgUUAUfmeY
name:
type: string
example: super_admin
resource_id:
type: string
example: tnntten-root
updated_at:
type: string
example: "2024-02-28T17:22:04Z"
updated_by:
type: string
example: idntusr-bailin
examples:
create-role:
value:
actions:
- loadbalancer_list
- loadbalancer_get
- loadbalancer_update
- loadbalancer_create
created_at: "2024-02-29T18:18:18Z"
created_by: idntusr-bailin
id: permrv2-IG7RfsYhyga0EwEbY4BKs
name: lb_editor
resource_id: tnntten-a
updated_at: "2024-02-29T18:18:18Z"
updated_by: idntusr-bailin
lb-viwer:
value:
actions:
- role_list
- rolebinding_create
- loadbalancer_list
- loadbalancer_update
- loadbalancer_delete
- role_create
- role_delete
- loadbalancer_create
- loadbalancer_get
- rolebinding_list
- rolebinding_delete
- role_get
- role_update
created_at: "2024-02-28T17:22:04Z"
created_by: idntusr-bailin
id: permrv2-ecBlNMsPrvVFgUUAUfmeY
name: super_admin
resource_id: tnntten-root
updated_at: "2024-02-28T17:22:04Z"
updated_by: idntusr-bailin
super-admin:
value:
actions:
- role_list
- rolebinding_create
- loadbalancer_list
- loadbalancer_update
- loadbalancer_delete
- role_create
- role_delete
- loadbalancer_create
- loadbalancer_get
- rolebinding_list
- rolebinding_delete
- role_get
- role_update
created_at: "2024-02-28T17:22:04Z"
created_by: idntusr-bailin
id: permrv2-ecBlNMsPrvVFgUUAUfmeY
name: super_admin
resource_id: tnntten-root
updated_at: "2024-02-28T17:22:04Z"
updated_by: idntusr-bailin
parameters:
- name: id
in: path
required: true
schema:
type: string
example: tnntten-root
/roles/{role_id}:
get:
tags:
- roles
summary: get-role
description: get role by ID
operationId: getRole
responses:
"200":
description: ""
delete:
tags:
- roles
summary: delete-role
description: |
delete role by ID, this will also remove any role-bindings that use
this role
operationId: deleteRole
responses:
"200":
description: ""
patch:
tags:
- roles
summary: update-role
description: |
update role by ID, both name and actions can be modified
operationId: updateRole
requestBody:
content:
application/json:
schema:
type: object
properties:
actions:
type: array
items:
type: string
example: rolebinding_get
example:
- rolebinding_get
- loadbalancer_create
- loadbalancer_get
- loadbalancer_delete
- rolebinding_list
- role_get
- rolebinding_update
- rolebinding_delete
- avail_role
- role_delete
- role_list
- role_update
- loadbalancer_list
- loadbalancer_update
- rolebinding_create
- role_create
name:
type: string
example: super_user
examples:
update-role:
value:
actions:
- rolebinding_get
- loadbalancer_create
- loadbalancer_get
- loadbalancer_delete
- rolebinding_list
- role_get
- rolebinding_update
- rolebinding_delete
- avail_role
- role_delete
- role_list
- role_update
- loadbalancer_list
- loadbalancer_update
- rolebinding_create
- role_create
name: super_user
responses:
"200":
description: ""
parameters:
- name: role_id
in: path
required: true
schema:
type: string
example: permrv2-zNYOpdL1RGyiSp0hgaIYB
/resources/{id}/role-bindings:
get:
tags:
- role-bindings
summary: list-role-bindings
description: |
list role-bindings for a resource.
an optional query parameter `role_id` can be used to filter the results.
operationId: listRoleBindings
parameters:
- name: role_id
in: query
schema:
type: string
example: permrv2-FQbFZMF74D0-WLNO-8MMb
responses:
"200":
description: ""
post:
tags:
- role-bindings
summary: create-role-binding
description: |
create a role-binding for a resource. The role-binding will grant the
specified role to the specified subjects.
operationId: createRoleBinding
parameters:
- name: id
in: query
schema:
type: string
example: loadbal-test-1
requestBody:
content:
application/json:
schema:
type: object
properties:
role_id:
type: string
example: permrv2-FQbFZMF74D0-WLNO-8MMb
subjects:
type: array
items:
type: object
properties:
conditions:
type: object
properties: {}
id:
type: string
example: idntusr-bailin
example:
- conditions: {}
id: idntusr-bailin
- conditions: {}
id: idntusr-bailin-1
- conditions: {}
id: idntusr-bailin-2
- conditions: {}
id: idntusr-bailin-3
- conditions: {}
id: idntusr-bailin-4
- conditions: {}
id: idntusr-bailin-5
examples:
create-role-binding:
value:
role_id: permrv2-FQbFZMF74D0-WLNO-8MMb
subjects:
- conditions: {}
id: idntusr-bailin
- conditions: {}
id: idntusr-bailin-1
- conditions: {}
id: idntusr-bailin-2
- conditions: {}
id: idntusr-bailin-3
- conditions: {}
id: idntusr-bailin-4
- conditions: {}
id: idntusr-bailin-5
responses:
"200":
description: ""
parameters:
- name: id
in: path
required: true
schema:
type: string
example: tnntten-root
/resources/{id}/role-bindings/{rb-id}:
get:
tags:
- role-bindings
summary: get-role-binding
description: get-role-binding
operationId: getRoleBinding
responses:
"200":
description: ""
delete:
tags:
- role-bindings
summary: delete-role-binding
description: delete-role-binding
operationId: deleteRoleBinding
responses:
"200":
description: ""
patch:
tags:
- role-bindings
summary: update-role-binding
description: |
update a role-binding, this will replace the subjects with the new
subjects. note that role_id is immutable
operationId: updateRoleBinding
parameters:
- name: id
in: query
schema:
type: string
example: loadbal-test-1
requestBody:
content:
application/json:
schema:
type: object
properties:
subjects:
type: array
items:
type: object
properties:
conditions:
type: object
properties: {}
id:
type: string
example: idntusr-bailin
example:
- conditions: {}
id: idntusr-bailin
- conditions: {}
id: idntusr-bailin-1
examples:
update-role-binding:
value:
subjects:
- conditions: {}
id: idntusr-bailin
- conditions: {}
id: idntusr-bailin-1
responses:
"200":
description: ""
parameters:
- name: id
in: path
required: true
schema:
type: string
example: loadbal-lb1
- name: rb-id
in: path
required: true
schema:
type: string
example: permrbn-uRNlQEo6yh9DinKhSxL2z
/actions:
get:
summary: list-actions
description: list all available actions in the permission system
operationId: listActions
responses:
"200":
description: ""
components:
securitySchemes:
oauth2:
type: oauth2
flows:
clientCredentials:
tokenUrl: http://localhost:8081/default/token
scopes:
openid: openid
permissions-api: permissions-api
security:
- oauth2:
- 'openid permissions-api'
tags:
- name: roles
- name: role-bindings