Moving RMR message reciver into go routine
[ric-plt/a1.git] / api / swagger.yaml
1 swagger: '2.0'
2 info:
3   version: 2.1.0
4   title: RIC A1
5 paths:
6   /a1-p/healthcheck:
7     get:
8       description: |
9         Perform a healthcheck on a1
10       tags:
11         - A1 Mediator
12       operationId: a1.controller.get_healthcheck
13       responses:
14         '200':
15           description: >
16             A1 is healthy. Anything other than a 200 should be considered a1 as
17             failing
18       parameters: []
19   /a1-p/policytypes:
20     get:
21       description: Get a list of all registered policy type ids
22       tags:
23         - A1 Mediator
24       operationId: a1.controller.get_all_policy_types
25       responses:
26         '200':
27           description: list of all registered policy type ids
28           examples:
29             application/json:
30               - 20000
31               - 20020
32           schema:
33             type: array
34             items:
35               $ref: '#/definitions/policy_type_id'
36         '503':
37           description: >-
38             Potentially transient backend database error. Client should attempt
39             to retry later.
40       parameters: []
41       produces:
42         - application/json
43   '/a1-p/policytypes/{policy_type_id}':
44     parameters:
45       - name: policy_type_id
46         in: path
47         required: true
48         minimum: 1
49         maximum: 2147483647
50         type: integer
51         description: >
52           represents a policy type identifier. Currently this is restricted to
53           an integer range.
54     get:
55       description: |
56         Get this policy type
57       tags:
58         - A1 Mediator
59       operationId: a1.controller.get_policy_type
60       responses:
61         '200':
62           description: policy type successfully found
63           schema:
64             $ref: '#/definitions/policy_type_schema'
65         '404':
66           description: |
67             policy type not found
68         '503':
69           description: >-
70             Potentially transient backend database error. Client should attempt
71             to retry later.
72       parameters: []
73       produces:
74         - application/json
75     delete:
76       description: >
77         Delete this policy type. Can only be performed if there are no instances
78         of this type
79       tags:
80         - A1 Mediator
81       operationId: a1.controller.delete_policy_type
82       responses:
83         '204':
84           description: |
85             policy type successfully deleted
86         '400':
87           description: >
88             Policy type cannot be deleted because there are instances All
89             instances must be removed before a policy type can be deleted
90         '404':
91           description: |
92             policy type not found
93         '503':
94           description: >-
95             Potentially transient backend database error. Client should attempt
96             to retry later.
97       parameters: []
98     put:
99       description: >
100         Create a new policy type . Replace is not currently allowed; to replace,
101         for now do a DELETE and then a PUT again.
102       tags:
103         - A1 Mediator
104       operationId: a1.controller.create_policy_type
105       responses:
106         '201':
107           description: policy type successfully created
108         '400':
109           description: 'illegal ID, or object already existed'
110         '503':
111           description: >-
112             Potentially transient backend database error. Client should attempt
113             to retry later.
114       parameters:
115         - name: body
116           in: body
117           schema:
118             $ref: '#/definitions/policy_type_schema'
119       consumes:
120         - application/json
121   '/a1-p/policytypes/{policy_type_id}/policies':
122     parameters:
123       - name: policy_type_id
124         in: path
125         required: true
126         minimum: 1
127         maximum: 2147483647
128         type: integer
129         description: >
130           represents a policy type identifier. Currently this is restricted to
131           an integer range.
132     get:
133       description: get a list of all policy instance ids for this policy type id
134       tags:
135         - A1 Mediator
136       operationId: a1.controller.get_all_instances_for_type
137       responses:
138         '200':
139           description: list of all policy instance ids for this policy type id
140           examples:
141             application/json:
142               - 3d2157af-6a8f-4a7c-810f-38c2f824bf12
143               - 06911bfc-c127-444a-8eb1-1bffad27cc3d
144           schema:
145             type: array
146             items:
147               $ref: '#/definitions/policy_instance_id'
148         '503':
149           description: >-
150             Potentially transient backend database error. Client should attempt
151             to retry later.
152       parameters: []
153       produces:
154         - application/json
155   '/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}':
156     parameters:
157       - name: policy_type_id
158         in: path
159         required: true
160         minimum: 1
161         maximum: 2147483647
162         type: integer
163         description: >
164           represents a policy type identifier. Currently this is restricted to
165           an integer range.
166       - name: policy_instance_id
167         in: path
168         required: true
169         type: string
170         description: >
171           represents a policy instance identifier. UUIDs are advisable but can
172           be any string
173     get:
174       description: |
175         Retrieve the policy instance
176       tags:
177         - A1 Mediator
178       operationId: a1.controller.get_policy_instance
179       responses:
180         '200':
181           description: >
182             The policy instance. the schema of this object is defined by the
183             create_schema field of the policy type
184           schema:
185             type: object
186         '404':
187           description: >
188             there is no policy instance with this policy_instance_id or there is
189             no policy type with this policy_type_id
190         '503':
191           description: >-
192             Potentially transient backend database error. Client should attempt
193             to retry later.
194       parameters: []
195       produces:
196         - application/json
197     delete:
198       description: |
199         Delete this policy instance
200       tags:
201         - A1 Mediator
202       operationId: a1.controller.delete_policy_instance
203       responses:
204         '202':
205           description: |
206             policy instance deletion initiated
207         '404':
208           description: >
209             there is no policy instance with this policy_instance_id or there is
210             no policy type with this policy_type_id
211         '503':
212           description: >-
213             Potentially transient backend database error. Client should attempt
214             to retry later.
215       parameters: []
216     put:
217       description: >
218         Create or replace a policy instance of type policy_type_id. The schema
219         of the PUT body is defined by the create_schema field of the policy
220         type.
221       tags:
222         - A1 Mediator
223       operationId: a1.controller.create_or_replace_policy_instance
224       responses:
225         '202':
226           description: |
227             Policy instance creation initiated
228         '400':
229           description: |
230             Bad PUT body for this policy instance
231         '404':
232           description: |
233             There is no policy type with this policy_type_id
234         '503':
235           description: >-
236             Potentially transient backend database error. Client should attempt
237             to retry later.
238       parameters:
239         - name: body
240           in: body
241           schema:
242             type: object
243             description: >
244               the schema of this object is defined by the create_schema field of
245               the policy type
246       consumes:
247         - application/json
248   '/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status':
249     parameters:
250       - name: policy_type_id
251         in: path
252         required: true
253         minimum: 1
254         maximum: 2147483647
255         type: integer
256         description: >
257           represents a policy type identifier. Currently this is restricted to
258           an integer range.
259       - name: policy_instance_id
260         in: path
261         required: true
262         type: string
263         description: >
264           represents a policy instance identifier. UUIDs are advisable but can
265           be any string
266     get:
267       description: >
268         Retrieve the policy instance status across all handlers of the policy If
269         this endpoint returns successfully (200), it is either IN EFFECT or NOT
270         IN EFFECT. IN EFFECT is returned if at least one policy handler in the
271         RIC is implementing the policy NOT IN EFFECT is returned otherwise If a
272         policy instance is successfully deleted, this endpoint will return a 404
273         (not a 200)
274       tags:
275         - A1 Mediator
276       operationId: a1.controller.get_policy_instance_status
277       responses:
278         '200':
279           description: |
280             successfully retrieved the status
281           schema:
282             type: object
283             properties:
284               instance_status:
285                 type: string
286                 enum:
287                   - IN EFFECT
288                   - NOT IN EFFECT
289               has_been_deleted:
290                 type: boolean
291               created_at:
292                 type: string
293                 format: date-time
294         '404':
295           description: >
296             there is no policy instance with this policy_instance_id or there is
297             no policy type with this policy_type_id
298         '503':
299           description: >-
300             Potentially transient backend database error. Client should attempt
301             to retry later.
302       parameters: []
303       produces:
304         - application/json
305   /data-delivery:
306     post:
307       description: |
308         Deliver data produced by data producer.
309       tags:
310         - A1 EI Data Delivery
311       operationId: a1.controller.data_delivery
312       responses:
313         '200':
314           description: |
315             successfully delivered data from data producer
316         '404':
317           description: |
318             no job id defined for this data delivery
319       parameters:
320         - name: body
321           in: body
322           schema:
323             type: object
324             description: |
325               object to represent data object
326       consumes:
327         - application/json
328 definitions:
329   policy_type_schema:
330     type: object
331     required:
332       - name
333       - description
334       - policy_type_id
335       - create_schema
336     additionalProperties: false
337     properties:
338       name:
339         type: string
340         description: name of the policy type
341       description:
342         type: string
343         description: description of the policy type
344       policy_type_id:
345         description: the integer of the policy type
346         type: integer
347       create_schema:
348         type: object
349         description: >
350           jsonschema (following http://json-schema.org/draft-07/schema) of the
351           CREATE payload to be sent to handlers of this policy
352   policy_type_id:
353     description: >
354       represents a policy type identifier. Currently this is restricted to an
355       integer range.
356     type: integer
357     minimum: 1
358     maximum: 2147483647
359   policy_instance_id:
360     description: >
361       represents a policy instance identifier. UUIDs are advisable but can be
362       any string
363     type: string
364     example: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
365 x-components: {}
366