Parse message names from xApp configMap
[ric-plt/appmgr.git] / api / appmgr_rest_api.yaml
1 swagger: '2.0'
2 info:
3   description: This is a draft API for RIC appmgr
4   version: 0.1.3
5   title: RIC appmgr
6   license:
7     name: Apache 2.0
8     url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
9 host: hostname
10 basePath: /ric/v1
11 schemes:
12   - https
13   - http
14 paths:
15   /health/alive :
16     get :
17       summary     : Health check of xApp Manager - Liveness probe
18       tags        : 
19         - health
20       operationId : getHealthAlive
21       responses   :
22         '200' :
23           description : Status of xApp Manager is ok
24   /health/ready :
25     get :
26       summary     : Readiness check of xApp Manager - Readiness probe
27       tags        : 
28         - health
29       operationId : getHealthReady
30       responses   :
31         '200':
32           description : xApp Manager is ready for service
33         '503':
34           description: xApp Manager is not ready for service
35   /xapps:
36     post:
37       summary: Deploy a xapp
38       tags:
39         - xapp
40       operationId: deployXapp
41       consumes:
42         - application/json
43       produces:
44         - application/json
45       parameters:
46         - name: xAppInfo
47           in: body
48           description: xApp information
49           schema:
50             type: object
51             required:
52               - name
53             properties:
54               name:
55                 type: string
56                 description: Name of the xApp.
57                 example: xapp-dummy
58               configName:
59                 type: string
60                 description: Name of the xApp configmap. Overrides the value given in Helm chart value file.
61                 example: xapp-dummy-configmap
62               namespace:
63                 type: string
64                 description: Name of the namespace to which xApp is deployed. Overrides the value given in Helm chart value file.
65                 example: ricxapps
66               serviceName:
67                 type: string
68                 description: Name of the service xApp is providing. Overrides the value given in Helm chart value file.
69                 example: xapp-dummy-service
70               imageRepo:
71                 type: string
72                 description: Name of the docker repository xApp is located. Overrides the value given in Helm chart value file.
73                 example: xapprepo
74               hostname:
75                 type: string
76                 description: Hostname for the pod. Used by messaging library. Overrides the value given in Helm chart value file.
77                 example: xapp-dummy
78       responses:
79         '201':
80           description: xApp successfully created
81           schema:
82             $ref: '#/definitions/Xapp'
83         '400':
84           description: Invalid input
85         '500':
86           description: Internal error
87     get:
88       summary: Returns the status of all xapps
89       tags:
90         - xapp
91       operationId: getAllXapps
92       produces:
93         - application/json
94       responses:
95         '200':
96           description: successful query of xApps
97           schema:
98             $ref: '#/definitions/AllXapps'
99         '500':
100           description: Internal error
101   '/xapps/{xAppName}':
102     get:
103       summary: Returns the status of a given xapp
104       tags:
105         - xapp
106       operationId: getXappByName
107       produces:
108         - application/json
109       parameters:
110         - name: xAppName
111           in: path
112           description: Name of xApp
113           required: true
114           type: string
115       responses:
116         '200':
117           description: successful operation
118           schema:
119             $ref: '#/definitions/Xapp'
120         '400':
121           description: Invalid ID supplied
122         '404':
123           description: Xapp not found
124         '500':
125           description: Internal error
126     delete:
127       summary: Undeploy an existing xapp
128       tags:
129         - xapp
130       operationId: undeployXapp
131       parameters:
132         - name: xAppName
133           in: path
134           description: Xapp to be undeployed
135           required: true
136           type: string
137       responses:
138         '204':
139           description: Successful deletion of xApp
140         '400':
141           description: Invalid xApp name supplied
142         '500':
143           description: Internal error
144   '/xapps/{xAppName}/instances/{xAppInstanceName}':
145     get:
146       summary: Returns the status of a given xapp
147       tags:
148         - xapp
149       operationId: getXappInstanceByName
150       produces:
151         - application/json
152       parameters:
153         - name: xAppName
154           in: path
155           description: Name of xApp
156           required: true
157           type: string
158         - name: xAppInstanceName
159           in: path
160           description: Name of xApp instance to get information
161           required: true
162           type: string
163       responses:
164         '200':
165           description: successful operation
166           schema:
167             $ref: '#/definitions/XappInstance'
168         '400':
169           description: Invalid name supplied
170         '404':
171           description: Xapp not found
172         '500':
173           description: Internal error
174   /config:
175     post:
176       summary: Create xApp config
177       tags:
178         - xapp
179       operationId: createXappConfig
180       consumes:
181         - application/json
182       produces:
183         - application/json
184       parameters:
185         - name: XAppConfig
186           in: body
187           description: xApp config
188           schema:
189             $ref: '#/definitions/XAppConfig'
190       responses:
191         '201':
192           description: xApp config successfully created
193           schema:
194             $ref: '#/definitions/XAppConfig'
195         '400':
196           description: Invalid input
197         '422':
198           description: Validation of configuration failed
199         '500':
200           description: Internal error
201     put:
202       summary: Modify xApp config
203       tags:
204         - xapp
205       operationId: ModifyXappConfig
206       consumes:
207         - application/json
208       produces:
209         - application/json
210       parameters:
211         - name: XAppConfig
212           in: body
213           description: xApp config
214           schema:
215             $ref: '#/definitions/XAppConfig'
216       responses:
217         '200':
218           description: xApp config successfully modified
219           schema:
220             $ref: '#/definitions/XAppConfig'
221         '400':
222           description: Invalid input
223         '422':
224           description: Validation of configuration failed
225         '500':
226           description: Internal error
227     get:
228       summary: Returns the configuration of all xapps
229       tags:
230         - xapp
231       operationId: getAllXappConfig
232       produces:
233         - application/json
234       responses:
235         '200':
236           description: successful query of xApp config
237           schema:
238             $ref: '#/definitions/AllXappConfig'
239         '500':
240           description: Internal error
241     delete:
242       summary: Delete xApp configuration
243       tags:
244         - xapp
245       operationId: deleteXappConfig
246       parameters:
247         - name: ConfigMetadata
248           in: body
249           description: xApp configuration information
250           schema:
251             $ref: '#/definitions/ConfigMetadata'
252       responses:
253         '204':
254           description: Successful deletion of xApp
255         '400':
256           description: Invalid parameters supplied
257         '500':
258           description: Internal error
259   /subscriptions:
260     post:
261       summary: Subscribe event
262       tags:
263         - xapp
264         - subscriptions
265       operationId: addSubscription
266       consumes:
267         - application/json
268       produces:
269         - application/json
270       parameters:
271         - name: subscriptionRequest
272           in: body
273           description: New subscription
274           required: true
275           schema:
276             $ref: '#/definitions/subscriptionRequest'
277       responses:
278         '200':
279           description: Subscription successful
280           schema:
281             $ref: '#/definitions/subscriptionResponse'
282         '400':
283           description: Invalid input
284     get:
285       summary: Returns all subscriptions
286       tags:
287         - xapp
288         - subscriptions
289       operationId: getSubscriptions
290       produces:
291         - application/json
292       responses:
293         '200':
294           description: successful query of subscriptions
295           schema:
296             $ref: '#/definitions/allSubscriptions'
297   '/subscriptions/{subscriptionId}':
298     get:
299       summary: Returns the information of subscription
300       tags:
301         - xapp
302         - subscriptions
303       operationId: getSubscriptionById
304       produces:
305         - application/json
306       parameters:
307         - name: subscriptionId
308           in: path
309           description: ID of subscription
310           required: true
311           type: string
312       responses:
313         '200':
314           description: successful operation
315           schema:
316             $ref: '#/definitions/subscription'
317         '400':
318           description: Invalid ID supplied
319         '404':
320           description: Subscription not found
321     put:
322       summary: Modify event subscription
323       tags:
324         - xapp
325         - subscriptions
326       operationId: modifySubscription
327       consumes:
328         - application/json
329       produces:
330         - application/json
331       parameters:
332         - name: subscriptionId
333           in: path
334           description: ID of subscription
335           required: true
336           type: string
337         - in: body
338           name: subscriptionRequest
339           description: Modified subscription
340           required: true
341           schema:
342             $ref: '#/definitions/subscriptionRequest'
343       responses:
344         '200':
345           description: Subscription modification successful
346           schema:
347             $ref: '#/definitions/subscriptionResponse'
348         '400':
349           description: Invalid input
350     delete:
351       summary: Unsubscribe event
352       tags:
353         - xapp
354         - subscriptions
355       description: ''
356       operationId: deleteSubscription
357       parameters:
358         - name: subscriptionId
359           in: path
360           description: ID of subscription
361           required: true
362           type: string
363       responses:
364         '204':
365           description: Successful deletion of subscription
366         '400':
367           description: Invalid subscription supplied
368 definitions:
369   AllXapps:
370     type: array
371     items:
372       $ref: '#/definitions/Xapp'
373   Xapp:
374     type: object
375     required:
376       - name
377     properties:
378       name:
379         type: string
380         example: xapp-dummy
381       status:
382         type: string
383         description: xapp status in the RIC
384         enum:
385           - unknown
386           - deployed
387           - deleted
388           - superseded
389           - failed
390           - deleting
391       version:
392         type: string
393         example: 1.2.3
394       instances:
395         type: array
396         items:
397           $ref: '#/definitions/XappInstance'
398   XappInstance:
399     type: object
400     required:
401       - name
402     properties:
403       name:
404         type: string
405         example: xapp-dummy-6cd577d9-4v255
406       status:
407         type: string
408         description: xapp instance status
409         enum:
410           - pending
411           - running
412           - succeeded
413           - failed
414           - unknown
415           - completed
416           - crashLoopBackOff
417       ip:
418         type: string
419         example: 192.168.0.1
420       port:
421         type: integer
422         example: 32300
423       txMessages:
424         type: array
425         items:
426           type: string
427           example: ControlIndication
428       rxMessages:
429         type: array
430         items:
431           type: string
432           example: LoadIndication
433   ConfigMetadata:
434     type: object
435     required:
436       - name
437       - configName
438       - namespace
439     properties:
440       name:
441         type: string
442         description: Name of the xApp
443         example: xapp-dummy
444       configName:
445         type: string
446         description: Name of the config map
447         example: xapp-dummy-config-map
448       namespace:
449         type: string
450         description: Name of the namespace
451         example: ricxapp
452   XAppConfig:
453     type: object
454     required:
455       - metadata
456       - descriptor
457       - config
458     properties:
459       metadata:
460         $ref: '#/definitions/ConfigMetadata'
461       descriptor:
462         type: object
463         description: Schema of configuration in JSON format
464       config:
465         type: object
466         description: Configuration in JSON format
467   AllXappConfig:
468     type: array
469     items:
470       $ref: '#/definitions/XAppConfig'
471   subscriptionRequest:
472     type: object
473     required:
474       - targetUrl
475       - eventType
476       - maxRetries
477       - retryTimer
478     properties:
479       targetUrl:
480         type: string
481         example: 'http://localhost:11111/apps/webhook/'
482       eventType:
483         type: string
484         description: Event which is subscribed
485         enum:
486           - created
487           - deleted
488           - all
489       maxRetries:
490         type: integer
491         description: Maximum number of retries
492         example: 11
493       retryTimer:
494         type: integer
495         description: Time in seconds to wait before next retry
496         example: 22
497   subscriptionResponse:
498     type: object
499     properties:
500       id:
501         type: string
502         example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
503       version:
504         type: integer
505         example: 2
506       eventType:
507         type: string
508         description: Event which is subscribed
509         enum:
510           - created
511           - deleted
512           - updated
513           - all
514   allSubscriptions:
515     type: array
516     items:
517       $ref: '#/definitions/subscription'
518   subscription:
519     type: object
520     properties:
521       id:
522         type: string
523         example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
524       targetUrl:
525         type: string
526         example: 'http://localhost:11111/apps/webhook/'
527       eventType:
528         type: string
529         description: Event which is subscribed
530         enum:
531           - created
532           - deleted
533           - updated
534           - all
535       maxRetries:
536         type: integer
537         description: Maximum number of retries
538         example: 11
539       retryTimer:
540         type: integer
541         description: Time in seconds to wait before next retry
542         example: 22
543   subscriptionNotification:
544     type: object
545     properties:
546       id:
547         type: string
548         example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
549       version:
550         type: integer
551         example: 2
552       eventType:
553         type: string
554         description: Event to be notified
555         enum:
556           - created
557           - deleted
558           - updated
559       xApps:
560         $ref: '#/definitions/AllXapps'