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