Merge "Merge DOC changes to master"
[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.2.0
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   - http
13 paths:
14   /health/alive :
15     get :
16       summary     : Health check of xApp Manager - Liveness probe
17       tags        : 
18         - health
19       operationId : getHealthAlive
20       responses   :
21         '200' :
22           description : Status of xApp Manager is ok
23   /health/ready :
24     get :
25       summary     : Readiness check of xApp Manager - Readiness probe
26       tags        : 
27         - health
28       operationId : getHealthReady
29       responses   :
30         '200':
31           description : xApp Manager is ready for service
32         '503':
33           description: xApp Manager is not ready for service
34   /xapps:
35     post:
36       summary: Deploy a xapp
37       tags:
38         - xapp
39       operationId: deployXapp
40       consumes:
41         - application/json
42       produces:
43         - application/json
44       parameters:
45         - name: XappDescriptor
46           in: body
47           description: xApp deployment info
48           schema:
49             $ref: '#/definitions/XappDescriptor'
50       responses:
51         '201':
52           description: xApp successfully created
53           schema:
54             $ref: '#/definitions/Xapp'
55         '400':
56           description: Invalid input
57         '500':
58           description: Internal error
59     get:
60       summary: Returns the status of all xapps
61       tags:
62         - xapp
63       operationId: getAllXapps
64       produces:
65         - application/json
66       responses:
67         '200':
68           description: successful query of xApps
69           schema:
70             $ref: '#/definitions/AllDeployedXapps'
71         '500':
72           description: Internal error
73   /xapps/list:
74     get:
75       summary: Returns the list of all deployable xapps
76       tags:
77         - xapp
78       operationId: listAllXapps
79       produces:
80         - application/json
81       responses:
82         '200':
83           description: successful list of deployable xApps
84           schema:
85             $ref: '#/definitions/AllDeployableXapps'
86         '500':
87           description: Internal error
88   /xapps/{xAppName}:
89     get:
90       summary: Returns the status of a given xapp
91       tags:
92         - xapp
93       operationId: getXappByName
94       produces:
95         - application/json
96       parameters:
97         - name: xAppName
98           in: path
99           description: Name of xApp
100           required: true
101           type: string
102       responses:
103         '200':
104           description: successful operation
105           schema:
106             $ref: '#/definitions/Xapp'
107         '400':
108           description: Invalid ID supplied
109         '404':
110           description: Xapp not found
111         '500':
112           description: Internal error
113     delete:
114       summary: Undeploy an existing xapp
115       tags:
116         - xapp
117       operationId: undeployXapp
118       parameters:
119         - name: xAppName
120           in: path
121           description: Xapp to be undeployed
122           required: true
123           type: string
124       responses:
125         '204':
126           description: Successful deletion of xApp
127         '400':
128           description: Invalid xApp name supplied
129         '500':
130           description: Internal error
131   /xapps/{xAppName}/instances/{xAppInstanceName}:
132     get:
133       summary: Returns the status of a given xapp
134       tags:
135         - xapp
136       operationId: getXappInstanceByName
137       produces:
138         - application/json
139       parameters:
140         - name: xAppName
141           in: path
142           description: Name of xApp
143           required: true
144           type: string
145         - name: xAppInstanceName
146           in: path
147           description: Name of xApp instance to get information
148           required: true
149           type: string
150       responses:
151         '200':
152           description: successful operation
153           schema:
154             $ref: '#/definitions/XappInstance'
155         '400':
156           description: Invalid name supplied
157         '404':
158           description: Xapp not found
159         '500':
160           description: Internal error
161   /xapps/{xAppName}/instances/{xAppInstanceName}/start:
162     put:
163       summary: Start given xapp instance
164       tags:
165         - xapp
166       operationId: startXappInstanceByName
167       produces:
168         - application/json
169       parameters:
170         - name: xAppName
171           in: path
172           description: Name of xApp
173           required: true
174           type: string
175         - name: xAppInstanceName
176           in: path
177           description: Name of xApp instance to get information
178           required: true
179           type: string
180       responses:
181         '200':
182           description: successful operation
183         '400':
184           description: Invalid name supplied
185         '404':
186           description: Xapp not found
187         '500':
188           description: Internal error
189   /xapps/{xAppName}/instances/{xAppInstanceName}/stop:
190     put:
191       summary: Stop given xapp instance
192       tags:
193         - xapp
194       operationId: stopXappInstanceByName
195       produces:
196         - application/json
197       parameters:
198         - name: xAppName
199           in: path
200           description: Name of xApp
201           required: true
202           type: string
203         - name: xAppInstanceName
204           in: path
205           description: Name of xApp instance to get information
206           required: true
207           type: string
208       responses:
209         '200':
210           description: successful operation
211         '400':
212           description: Invalid name supplied
213         '404':
214           description: Xapp not found
215         '500':
216           description: Internal error
217   /config:
218     post:
219       summary: Create xApp config
220       tags:
221         - xapp
222       operationId: createXappConfig
223       consumes:
224         - application/json
225       produces:
226         - application/json
227       parameters:
228         - name: XAppConfig
229           in: body
230           description: xApp config
231           schema:
232             $ref: '#/definitions/XAppConfig'
233       responses:
234         '201':
235           description: xApp config successfully created
236           schema:
237             $ref: '#/definitions/ConfigValidationErrors'
238         '400':
239           description: Invalid input
240         '422':
241           description: Validation of configuration failed
242         '500':
243           description: Internal error
244     put:
245       summary: Modify xApp config
246       tags:
247         - xapp
248       operationId: ModifyXappConfig
249       consumes:
250         - application/json
251       produces:
252         - application/json
253       parameters:
254         - name: XAppConfig
255           in: body
256           description: xApp config
257           schema:
258             $ref: '#/definitions/XAppConfig'
259       responses:
260         '200':
261           description: xApp config successfully modified
262           schema:
263             $ref: '#/definitions/ConfigValidationErrors'
264         '400':
265           description: Invalid input
266         '422':
267           description: Validation of configuration failed
268         '500':
269           description: Internal error
270     get:
271       summary: Returns the configuration of all xapps
272       tags:
273         - xapp
274       operationId: getAllXappConfig
275       produces:
276         - application/json
277       responses:
278         '200':
279           description: successful query of xApp config
280           schema:
281             $ref: '#/definitions/AllXappConfig'
282         '500':
283           description: Internal error
284     delete:
285       summary: Delete xApp configuration
286       tags:
287         - xapp
288       operationId: deleteXappConfig
289       parameters:
290         - name: ConfigMetadata
291           in: body
292           description: xApp configuration information
293           schema:
294             $ref: '#/definitions/ConfigMetadata'
295       responses:
296         '204':
297           description: Successful deletion of xApp config
298         '400':
299           description: Invalid parameters supplied
300         '500':
301           description: Internal error
302   /config/{configName}:
303     get:
304       summary: Returns the configuration of a single xapp
305       tags:
306         - xapp
307       operationId: getXappConfig
308       produces:
309         - application/json
310       parameters:
311         - name: configName
312           in: path
313           description: Name of xApp
314           required: true
315           type: string
316       responses:
317         '200':
318           description: successful query of xApp config
319           schema:
320             $ref: '#/definitions/XAppConfig'
321         '500':
322           description: Internal error
323   /subscriptions:
324     post:
325       summary: Subscribe event
326       tags:
327         - xapp
328         - subscriptions
329       operationId: addSubscription
330       consumes:
331         - application/json
332       produces:
333         - application/json
334       parameters:
335         - name: subscriptionRequest
336           in: body
337           description: New subscription
338           required: true
339           schema:
340             $ref: '#/definitions/subscriptionRequest'
341       responses:
342         '201':
343           description: Subscription successfully created
344           schema:
345             $ref: '#/definitions/subscriptionResponse'
346         '400':
347           description: Invalid input
348     get:
349       summary: Returns all subscriptions
350       tags:
351         - xapp
352         - subscriptions
353       operationId: getSubscriptions
354       produces:
355         - application/json
356       responses:
357         '200':
358           description: successful query of subscriptions
359           schema:
360             $ref: '#/definitions/allSubscriptions'
361   /subscriptions/{subscriptionId}:
362     get:
363       summary: Returns the information of subscription
364       tags:
365         - xapp
366         - subscriptions
367       operationId: getSubscriptionById
368       produces:
369         - application/json
370       parameters:
371         - name: subscriptionId
372           in: path
373           description: ID of subscription
374           required: true
375           type: string
376       responses:
377         '200':
378           description: successful operation
379           schema:
380             $ref: '#/definitions/subscription'
381         '400':
382           description: Invalid ID supplied
383         '404':
384           description: Subscription not found
385     put:
386       summary: Modify event subscription
387       tags:
388         - xapp
389         - subscriptions
390       operationId: modifySubscription
391       consumes:
392         - application/json
393       produces:
394         - application/json
395       parameters:
396         - name: subscriptionId
397           in: path
398           description: ID of subscription
399           required: true
400           type: string
401         - in: body
402           name: subscriptionRequest
403           description: Modified subscription
404           required: true
405           schema:
406             $ref: '#/definitions/subscriptionRequest'
407       responses:
408         '200':
409           description: Subscription modification successful
410           schema:
411             $ref: '#/definitions/subscriptionResponse'
412         '400':
413           description: Invalid input
414     delete:
415       summary: Unsubscribe event
416       tags:
417         - xapp
418         - subscriptions
419       description: ''
420       operationId: deleteSubscription
421       parameters:
422         - name: subscriptionId
423           in: path
424           description: ID of subscription
425           required: true
426           type: string
427       responses:
428         '204':
429           description: Successful deletion of subscription
430         '400':
431           description: Invalid subscription supplied
432 definitions:
433   AllDeployableXapps:
434     type: array
435     items:
436       type: string
437   AllDeployedXapps:
438     type: array
439     items:
440       $ref: '#/definitions/Xapp'
441   Xapp:
442     type: object
443     required:
444       - name
445     properties:
446       name:
447         type: string
448       status:
449         type: string
450         description: xapp status in the RIC
451         enum:
452           - unknown
453           - deployed
454           - deleted
455           - superseded
456           - failed
457           - deleting
458       version:
459         type: string
460       instances:
461         type: array
462         items:
463           $ref: '#/definitions/XappInstance'
464   XappInstance:
465     type: object
466     required:
467       - name
468     properties:
469       name:
470         type: string
471       status:
472         type: string
473         description: xapp instance status
474         enum:
475           - pending
476           - running
477           - succeeded
478           - failed
479           - unknown
480           - completed
481           - crashLoopBackOff
482       ip:
483         type: string
484       port:
485         type: integer
486       txMessages:
487         type: array
488         items:
489           type: string
490       rxMessages:
491         type: array
492         items:
493           type: string
494   XappDescriptor:
495     type: object
496     required:
497       - xappName
498     properties:
499       xappName:
500         type: string
501         description: Name of the xApp in helm chart
502       helmVersion:
503         type: string
504         description: The exact xapp helm chart version to install
505       releaseName:
506         type: string
507         description: Name of the xapp to be visible in Kubernetes
508       namespace:
509         type: string
510         description: Name of the namespace to which xApp is deployed. Overrides the value given in Helm chart value file.
511       overrideFile:
512         type: object
513         description: JSON string of override file for 'helm install' command
514   XappDescriptorList:
515     type: array
516     items:
517       $ref: '#/definitions/XappDescriptor'
518   ConfigMetadata:
519     type: object
520     required:
521       - name
522     properties:
523       name:
524         type: string
525         description: Name of the xApp
526       configName:
527         type: string
528         description: Name of the config map
529       namespace:
530         type: string
531         description: Name of the namespace
532   ConfigValidationError:
533     type: object
534     required:
535       - field
536       - error
537     properties:
538       field:
539         type: string
540         description: Name of the parameter
541       error:
542         type: string
543         description: Description of validation error
544   ConfigValidationErrors:
545     type: array
546     items:
547       $ref: '#/definitions/ConfigValidationError'
548   XAppConfig:
549     type: object
550     required:
551       - metadata
552       - descriptor
553       - config
554     properties:
555       metadata:
556         $ref: '#/definitions/ConfigMetadata'
557       descriptor:
558         type: object
559         description: Schema of configuration in JSON format
560       config:
561         type: object
562         description: Configuration in JSON format
563   AllXappConfig:
564     type: array
565     items:
566       $ref: '#/definitions/XAppConfig'
567   EventType:
568     type: string
569     description: Event which is subscribed
570     enum:
571       - deployed
572       - undeployed
573       - created
574       - modified
575       - deleted
576       - restarted
577       - all
578   SubscriptionData:
579     type: object
580     required:
581       - targetUrl
582       - eventType
583       - maxRetries
584       - retryTimer
585     properties:
586       targetUrl:
587         type: string
588         example: 'http://localhost:11111/apps/webhook/'
589       eventType:
590         $ref: '#/definitions/EventType'
591       maxRetries:
592         type: integer
593         description: Maximum number of retries
594       retryTimer:
595         type: integer
596         description: Time in seconds to wait before next retry
597   subscriptionRequest:
598     type: object
599     required:
600       - data
601     properties:
602       data:
603         $ref: '#/definitions/SubscriptionData'
604   subscriptionResponse:
605     type: object
606     properties:
607       id:
608         type: string
609       version:
610         type: integer
611       eventType:
612         $ref: '#/definitions/EventType'
613   allSubscriptions:
614     type: array
615     items:
616       $ref: '#/definitions/subscription'
617   subscription:
618     type: object
619     properties:
620       id:
621         type: string
622       data:
623         $ref: '#/definitions/SubscriptionData'
624   subscriptionNotification:
625     type: object
626     properties:
627       id:
628         type: string
629       version:
630         type: integer
631       eventType:
632         $ref: '#/definitions/EventType'
633       xApps:
634         $ref: '#/definitions/AllDeployedXapps'