RIC:1060: Change in PTL
[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/v2/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/v2/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/v2/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/v2/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/v2/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       - name: notificationDestination
174         in: query
175         type: string
176         description: >
177           URL send by non-RT RIC. This where non-RT RIC expects status updates on the policy creation
178     get:
179       description: |
180         Retrieve the policy instance
181       tags:
182         - A1 Mediator
183       operationId: a1.controller.get_policy_instance
184       responses:
185         '200':
186           description: >
187             The policy instance. the schema of this object is defined by the
188             create_schema field of the policy type
189           schema:
190             type: object
191         '404':
192           description: >
193             there is no policy instance with this policy_instance_id or there is
194             no policy type with this policy_type_id
195         '503':
196           description: >-
197             Potentially transient backend database error. Client should attempt
198             to retry later.
199       parameters: []
200       produces:
201         - application/json
202     delete:
203       description: |
204         Delete this policy instance
205       tags:
206         - A1 Mediator
207       operationId: a1.controller.delete_policy_instance
208       responses:
209         '202':
210           description: |
211             policy instance deletion initiated
212         '404':
213           description: >
214             there is no policy instance with this policy_instance_id or there is
215             no policy type with this policy_type_id
216         '503':
217           description: >-
218             Potentially transient backend database error. Client should attempt
219             to retry later.
220       parameters: []
221     put:
222       description: >
223         Create or replace a policy instance of type policy_type_id. The schema
224         of the PUT body is defined by the create_schema field of the policy
225         type.
226       tags:
227         - A1 Mediator
228       operationId: a1.controller.create_or_replace_policy_instance
229       responses:
230         '202':
231           description: |
232             Policy instance creation initiated
233         '400':
234           description: |
235             Bad PUT body for this policy instance
236         '404':
237           description: |
238             There is no policy type with this policy_type_id
239         '503':
240           description: >-
241             Potentially transient backend database error. Client should attempt
242             to retry later.
243       parameters:
244         - name: body
245           in: body
246           schema:
247             type: object
248             description: >
249               the schema of this object is defined by the create_schema field of
250               the policy type
251       consumes:
252         - application/json
253   '/A1-P/v2/policytypes/{policy_type_id}/policies/{policy_instance_id}/status':
254     parameters:
255       - name: policy_type_id
256         in: path
257         required: true
258         minimum: 1
259         maximum: 2147483647
260         type: integer
261         description: >
262           represents a policy type identifier. Currently this is restricted to
263           an integer range.
264       - name: policy_instance_id
265         in: path
266         required: true
267         type: string
268         description: >
269           represents a policy instance identifier. UUIDs are advisable but can
270           be any string
271     get:
272       description: >
273         Retrieve the policy instance status across all handlers of the policy If
274         this endpoint returns successfully (200), it is either IN EFFECT or NOT
275         IN EFFECT. IN EFFECT is returned if at least one policy handler in the
276         RIC is implementing the policy NOT IN EFFECT is returned otherwise If a
277         policy instance is successfully deleted, this endpoint will return a 404
278         (not a 200)
279       tags:
280         - A1 Mediator
281       operationId: a1.controller.get_policy_instance_status
282       responses:
283         '200':
284           description: |
285             successfully retrieved the status
286           schema:
287             type: object
288             properties:
289               enforceStatus:
290                 type: string
291                 enum:
292                   - ENFORCED
293                   - NOT_ENFORCED
294               enforceReason:
295                 type: string
296                 enum:
297                  - SCOPE_NOT_APPLICABLE
298                  - STATEMENT_NOT_APPLICABLE
299                  - OTHER_REASON
300         '404':
301           description: >
302             there is no policy instance with this policy_instance_id or there is
303             no policy type with this policy_type_id
304         '503':
305           description: >-
306             Potentially transient backend database error. Client should attempt
307             to retry later.
308       parameters: []
309       produces:
310         - application/json
311   /data-delivery:
312     post:
313       description: |
314         Deliver data produced by data producer.
315       tags:
316         - A1 EI Data Delivery
317       operationId: a1.controller.data_delivery
318       responses:
319         '200':
320           description: |
321             successfully delivered data from data producer
322         '404':
323           description: |
324             no job id defined for this data delivery
325       parameters:
326         - name: body
327           in: body
328           schema:
329             type: object
330             description: |
331               object to represent data object
332       consumes:
333         - application/json
334 definitions:
335   policy_type_schema:
336     type: object
337     required:
338       - name
339       - description
340       - policy_type_id
341       - create_schema
342     additionalProperties: false
343     properties:
344       name:
345         type: string
346         description: name of the policy type
347       description:
348         type: string
349         description: description of the policy type
350       policy_type_id:
351         description: the integer of the policy type
352         type: integer
353       create_schema:
354         type: object
355         description: >
356           jsonschema (following http://json-schema.org/draft-07/schema) of the
357           CREATE payload to be sent to handlers of this policy
358   policy_type_id:
359     description: >
360       represents a policy type identifier. Currently this is restricted to an
361       integer range.
362     type: integer
363     minimum: 1
364     maximum: 2147483647
365   policy_instance_id:
366     description: >
367       represents a policy instance identifier. UUIDs are advisable but can be
368       any string
369     type: string
370     example: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
371 x-components: {}
372