Merge branch 'EDGE-242' of github.sec.samsung.net:RS7-EdgeComputing/edge-home-orchest...
[platform/core/system/edge-orchestration.git] / doc / edge-orchestration-api.json
1 {
2         "swagger": "2.0",
3         "info": {
4                 "title": "Edge Orchestration",
5                 "description": "Edge Orchestration support to deliver distributed service process environment.",
6                 "version": "v1-20190318"
7         },
8         "schemes": [
9                 "http"
10         ],
11         "tags": [
12                 {
13                         "name": "Discovery Manager",
14                         "description": "Edge Discovery"
15                 },
16                 {
17                         "name": "Device Resource",
18                         "description": "Device resource"                
19                 },
20                 {
21                         "name": "Service Manager",
22                         "description": "Managing services"
23                 }
24         ],
25         "paths": {
26                 "/api/v1/discoverymgr/devices": {
27                         "get": {
28                                 "tags": [
29                                         "Discovery Manager"
30                                 ],
31                                 "description": "Get result of Edge discovery",
32                                 "consumes": [
33                                         "application/json"
34                                 ],
35                                 "produces": [
36                                         "application/json"
37                                 ],
38                                 "responses": {
39                                         "200": {
40                                                 "description": "Successful operation",
41                                                 "schema": {
42                                                         "$ref": "#/definitions/DiscoveryEdgeList"
43                                                 }
44                                         }
45                                 }
46                         }
47                 },
48                 "/api/v1/discoverymgr/devices/{deviceid}": {
49                         "get": {
50                                 "tags": [
51                                         "Discovery Manager"
52                                 ],
53                                 "description": "Get result of Edge discovery",
54                                 "consumes": [
55                                         "application/json"
56                                 ],
57                                 "produces": [
58                                         "application/json"
59                                 ],
60                                 "parameters": [
61                                         {
62                                                 "name": "deviceid",
63                                                 "in": "path",
64                                                 "description": "ID of Edge device",
65                                                 "required": true,
66                                                 "type": "string"
67                                         }
68                                 ],
69                                 "responses": {
70                                         "200": {
71                                                 "description": "Successful operation",
72                                                 "schema": {
73                                                         "$ref": "#/definitions/DiscoveryEdge"
74                                                 }
75                                         }
76                                 }
77                         }
78                 },
79                 "/api/v1/device/resource/usage/cpu": {
80                         "get": {
81                                 "tags": [
82                                         "Device Resource"
83                                 ],
84                                 "description": "Get device cpu usage",
85                                 "consumes": [
86                                         "application/json"
87                                 ],
88                                 "produces": [
89                                         "application/json"
90                                 ],
91                                 "responses": {
92                                         "200": {
93                                                 "description": "Successful operation",
94                                                 "schema": {
95                                                         "$ref": "#/definitions/CPU"
96                                                 }
97                                         }
98                                 }
99                         }
100                 },
101                 "/api/v1/device/resource/usage/memory": {
102                         "get": {
103                                 "tags": [
104                                         "Device Resource"
105                                 ],
106                                 "description": "Get device memory usage",
107                                 "consumes": [
108                                         "application/json"
109                                 ],
110                                 "produces": [
111                                         "application/json"
112                                 ],
113                                 "responses": {
114                                         "200": {
115                                                 "description": "Successful operation",
116                                                 "schema": {
117                                                         "$ref": "#/definitions/Memory"
118                                                 }
119                                         }
120                                 }
121                         }
122                 },
123                 "/api/v1/device/resource/usage/network": {
124                         "get": {
125                                 "tags": [
126                                         "Device Resource"
127                                 ],
128                                 "description": "Get device network usage",
129                                 "consumes": [
130                                         "application/json"
131                                 ],
132                                 "produces": [
133                                         "application/json"
134                                 ],
135                                 "responses": {
136                                         "200": {
137                                                 "description": "Successful operation",
138                                                 "schema": {
139                                                         "$ref": "#/definitions/Network"
140                                                 }
141                                         }
142                                 }
143                         }
144                 },
145                 "/api/v1/device/resource/usage/disk": {
146                         "get": {
147                                 "tags": [
148                                         "Device Resource"
149                                 ],
150                                 "description": "Get device disk usage",
151                                 "consumes": [
152                                         "application/json"
153                                 ],
154                                 "produces": [
155                                         "application/json"
156                                 ],
157                                 "responses": {
158                                         "200": {
159                                                 "description": "Successful operation",
160                                                 "schema": {
161                                                         "$ref": "#/definitions/Disk"
162                                                 }
163                                         }
164                                 }
165                         }
166                 },
167                 "/api/v1/servicemgr/services": {
168                         "post": {
169                                 "tags": [
170                                         "Service Manager"
171                                 ],
172                                 "description": "Create user app object",
173                                 "consumes": [
174                                         "application/json"
175                                 ],
176                                 "produces": [
177                                         "application/json"
178                                 ],
179                                 "parameters": [
180                                         {
181                                                 "in": "body",
182                                                 "name": "body",
183                                                 "description": "Parameters for request user service creation",
184                                                 "schema": {
185                                                         "$ref": "#/definitions/ServiceRequest"
186                                                 }
187                                         }
188                                 ],
189                                 "responses": {
190                                         "200": {
191                                                 "description": "Successful operation",
192                                                 "schema": {
193                                                         "$ref": "#/definitions/ServiceObjectList"
194                                                 }
195                                         }
196                                 }
197                         },
198                         "delete": {
199                                 "tags": [
200                                         "Service Manager"
201                                 ],
202                                 "description": "Destroy user app object",
203                                 "consumes": [
204                                         "application/json"
205                                 ],
206                                 "produces": [
207                                         "application/json"
208                                 ],
209                                 "parameters": [
210                                         {
211                                                 "name": "appname",
212                                                 "in": "path",
213                                                 "description": "Name of user app to be destroied",
214                                                 "required": true,
215                                                 "type": "string"
216                                         }
217                                 ],
218                                 "responses": {
219                                         "200": {
220                                                 "description": "Successful operation",
221                                                 "schema": {
222                                                         "$ref": "#/definitions/APIResponse"
223                                                 }
224                                         }
225                                 }
226                         },
227                         "get": {
228                                 "tags": [
229                                         "Service Manager"
230                                 ],
231                                 "description": "Get information of user service",
232                                 "consumes": [
233                                         "application/json"
234                                 ],
235                                 "produces": [
236                                         "application/json"
237                                 ],
238                                 "responses": {
239                                         "200": {
240                                                 "description": "Successful operation",
241                                                 "schema": {
242                                                         "$ref": "#/definitions/ServiceList"
243                                                 }
244                                         }
245                                 }
246                         }
247                 },
248                 "/api/v1/servicemgr/services/{serviceid}": {
249                         "post": {
250                                 "tags": [
251                                         "Service Manager"
252                                 ],
253                                 "description": "Execute requested service",
254                                 "consumes": [
255                                         "application/json"
256                                 ],
257                                 "produces": [
258                                         "application/json"
259                                 ],
260                                 "parameters": [
261                                         {
262                                                 "name": "serviceid",
263                                                 "in": "path",
264                                                 "description": "ID of micro-service",
265                                                 "required": true,
266                                                 "type": "string"
267                                         },
268                                         {
269                                                 "in": "body",
270                                                 "name": "serviceParam",
271                                                 "description": "Parameters for request micro-service creation",
272                                                 "schema": {
273                                                         "$ref": "#/definitions/MicroServiceRequest"
274                                                 }
275                                         }
276                                 ],
277                                 "responses": {
278                                         "200": {
279                                                 "description": "Successful operation",
280                                                 "schema": {
281                                                         "$ref": "#/definitions/APIResponse"
282                                                 }
283                                         }
284                                 }
285                         },
286                         "delete": {
287                                 "tags": [
288                                         "Service Manager"
289                                 ],
290                                 "description": "Destroy requested micro-service",
291                                 "consumes": [
292                                         "application/json"
293                                 ],
294                                 "produces": [
295                                         "application/json"
296                                 ],
297                                 "parameters": [
298                                         {
299                                                 "name": "serviceid",
300                                                 "in": "path",
301                                                 "description": "ID of micro-service",
302                                                 "required": true,
303                                                 "type": "string"
304                                         }
305                                 ],
306                                 "responses": {
307                                         "200": {
308                                                 "description": "Successful operation",
309                                                 "schema": {
310                                                         "$ref": "#/definitions/APIResponse"
311                                                 }
312                                         }
313                                 }
314                         },
315                         "get": {
316                                 "tags": [
317                                         "Service Manager"
318                                 ],
319                                 "description": "Get information of micro-service",
320                                 "consumes": [
321                                         "application/json"
322                                 ],
323                                 "produces": [
324                                         "application/json"
325                                 ],
326                                 "parameters": [
327                                         {
328                                                 "name": "serviceid",
329                                                 "in": "path",
330                                                 "description": "ID of micro-service",
331                                                 "required": true,
332                                                 "type": "string"
333                                         }
334                                 ],
335                                 "responses": {
336                                         "200": {
337                                                 "description": "Successful operation",
338                                                 "schema": {
339                                                         "$ref": "#/definitions/MicroServiceInfo"
340                                                 }
341                                         }
342                                 }
343                         }
344                 },
345                 "/api/v1/servicemgr/services/{appname}": {
346                         "get": {
347                                 "tags": [
348                                         "Service Manager"
349                                 ],
350                                 "description": "Get information of app",
351                                 "consumes": [
352                                         "application/json"
353                                 ],
354                                 "produces": [
355                                         "application/json"
356                                 ],
357                                 "parameters": [
358                                         {
359                                                 "name": "appname",
360                                                 "in": "path",
361                                                 "description": "Name of executed app",
362                                                 "required": true,
363                                                 "type": "string"
364                                         }
365                                 ],
366                                 "responses": {
367                                         "200": {
368                                                 "description": "Successful operation",
369                                                 "schema": {
370                                                         "$ref": "#/definitions/ServiceInfo"
371                                                 }
372                                         }
373                                 }
374                         }
375                 }
376         },
377         "definitions": {
378                 "EdgeResource": {
379                         "type": "string",
380                         "description": "H/W resource of Edge device can support"
381                 },
382                 "DiscoveryEdge": {
383                         "type": "object",
384                         "properties": {
385                                 "deviceID": {
386                                         "type": "string",
387                                         "description": "Unique ID of Edge device",
388                                         "example": "edge-0001"
389                                 },
390                                 "deviceIPAddr": {
391                                         "type": "string",
392                                         "description": "IP address of Edge device",
393                                         "example": "10.113.175.249"
394                                 },
395                                 "deviceProperties": {
396                                         "type": "array",
397                                         "description": "Edge resources",
398                                         "items": {
399                                                 "$ref": "#/definitions/EdgeResource"
400                                         },
401                                         "example": [
402                                                 "display",
403                                                 "speaker"
404                                         ]
405                                 },
406                                 "status": {
407                                         "type": "string",
408                                         "description": "Status of Edge device",
409                                         "example": "Up"
410                                 }
411                         }
412                 },
413                 "DiscoveryEdgeList": {
414                         "type": "array",
415                         "items": {
416                                 "$ref": "#/definitions/DiscoveryEdge"
417                         }
418                 },
419                 "CPU": {
420                         "type": "object",
421                         "properties": {
422                                 "cpu": {
423                                         "type": "string",
424                                         "description": "Usage of CPU",
425                                         "example": "0.187383"
426                                 }
427                         }
428                 },
429                 "Memory": {
430                         "type": "object",
431                         "properties": {
432                                 "memory": {
433                                         "type": "string",
434                                         "description": "Usage of Memory",
435                                         "example": "11.871336"
436                                 }
437                         }
438                 },
439                 "Network": {
440                         "type": "object",
441                         "properties": {
442                                 "network": {
443                                         "type": "string",
444                                         "description": "Usage of Network",
445                                         "example": "0.003023"
446                                 }
447                         }
448                 },
449                 "Disk": {
450                         "type": "object",
451                         "properties": {
452                                 "network": {
453                                         "type": "string",
454                                         "description": "Usage of Disk",
455                                         "example": ""
456                                 }
457                         }
458                 },
459                 "SystemParam": {
460                         "type": "object",
461                         "properties": {
462                                 "ipAddr": {
463                                         "type": "string",
464                                         "description": "IP Addr of device requesting service",
465                                         "example": "127.0.0.1"
466                                 },
467                                 "port": {
468                                         "type": "string",
469                                         "description": "Port number of device requesting service",
470                                         "example": "5432"
471                                 }
472                         }
473                 },
474                 "UserParam": {
475                         "type": "object",
476                         "properties": {
477                                 "arguments": {
478                                         "type": "string",
479                                         "description": "User parameter of requesting service",
480                                         "example": "5"
481                                 }
482                         }
483                 },
484                 "MicroServiceRequest": {
485                         "type": "object",
486                         "properties": {
487                                 "systemParam": {
488                                         "$ref": "#/definitions/SystemParam"
489                                 },
490                                 "userParam": {
491                                         "$ref": "#/definitions/UserParam"
492                                 }
493                         }
494                 },
495                 "ServiceObject" : {
496                         "type": "object",
497                         "properties": {
498                                 "id": {
499                                         "type": "integer",
500                                         "description": "Created ID of micro-service"
501                                 },
502                                 "time": {
503                                         "type": "string",
504                                         "description": "The time when micro-service created"
505                                 }
506                         }
507                 },
508                 "ServiceObjectList": {
509                         "type": "object",
510                         "properties": {
511                                 "serviceList": {
512                                         "type": "array",
513                                         "items": {
514                                                 "$ref": "#/definitions/ServiceObject"
515                                         },
516                                         "example": [
517                                                 {
518                                                         "id": 2,
519                                                         "time": "2019-03-14T13:43:38+09:00"
520                                                 },
521                                                 {
522                                                         "id": 3,
523                                                         "time": "2019-03-14T13:43:38+09:00"
524                                                 }
525                                         ]
526                                 }
527                         }
528                 },
529                 "ServiceRequest": {
530                         "type": "object",
531                         "properties": {
532                                 "appName": {
533                                         "type": "string",
534                                         "description": "Name of requested user service",
535                                         "example": "GreetWorldApp"
536                                 },
537                                 "serviceName": {
538                                         "type": "string",
539                                         "description": "Name of micro-services",
540                                         "example": "HelloWorldService"
541                                 },
542                                 "count": {
543                                         "type": "integer",
544                                         "description": "Count of micro-services",
545                                         "example": 2
546                                 }
547                         }
548                 },
549                 "ServiceInfo": {
550                         "type": "object",
551                         "properties": {
552                                 "appName": {
553                                         "type": "string",
554                                         "description": "Name of requested user service",
555                                         "example": "GreetWorldApp"
556                                 },
557                                 "serviceList": {
558                                         "$ref": "#/definitions/MicroServiceList"
559                                 }
560                         }
561                 },
562                 "ServiceList": {
563                         "type": "array",
564                         "items": {
565                                 "$ref": "#/definitions/ServiceInfo"
566                         }
567                 },
568                 "MicroServiceInfo": {
569                         "type": "object",
570                         "properties": {
571                                 "serviceName": {
572                                         "type": "string",
573                                         "description": "Service name",
574                                         "example": "HelloWorldService#1"
575                                 },
576                                 "serviceID": {
577                                         "type": "integer",
578                                         "description": "Unique ID of service",
579                                         "example": 2
580                                 },
581                                 "status": {
582                                         "type": "string",
583                                         "description": "Status of service",
584                                         "example": "started"
585                                 },
586                                 "deviceID": {
587                                         "type": "string",
588                                         "description": "DeviceID on which the service is operating",
589                                         "example": "Edge_deviceID"
590                                 }
591                         }
592                 },
593                 "MicroServiceList": {
594                         "type": "array",
595                         "items": {
596                                 "$ref": "#/definitions/MicroServiceInfo"
597                         },
598                         "example": [
599                                 {
600                                         "serviceName": "HelloWorldService#1",
601                                         "serviceID": 2,
602                                         "status": "started",
603                                         "deviceID": "10.113.175.249"
604                                 },
605                                 {
606                                         "serviceName": "HelloWorldService#2",
607                                         "serviceID": 3,
608                                         "status": "progressing",
609                                         "deviceID": "10.113.175.239"
610                                 }
611                         ]
612                 },
613                 "APIResponse": {
614                         "type": "object",
615                         "properties": {
616                                 "message": {
617                                         "type": "string",
618                                         "description": "Return the status of the request"
619                                 }
620                         }
621                 }
622         }
623 }