Merge branch 'master' into EDGE-142
[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         },
346         "definitions": {
347                 "EdgeResource": {
348                         "type": "string",
349                         "description": "H/W resource of Edge device can support"
350                 },
351                 "DiscoveryEdge": {
352                         "type": "object",
353                         "properties": {
354                                 "deviceID": {
355                                         "type": "string",
356                                         "description": "Unique ID of Edge device",
357                                         "example": "edge-0001"
358                                 },
359                                 "deviceIPAddr": {
360                                         "type": "string",
361                                         "description": "IP address of Edge device",
362                                         "example": "10.113.175.249"
363                                 },
364                                 "deviceProperties": {
365                                         "type": "array",
366                                         "description": "Edge resources",
367                                         "items": {
368                                                 "$ref": "#/definitions/EdgeResource"
369                                         },
370                                         "example": [
371                                                 "display",
372                                                 "speaker"
373                                         ]
374                                 },
375                                 "status": {
376                                         "type": "string",
377                                         "description": "Status of Edge device",
378                                         "example": "Up"
379                                 }
380                         }
381                 },
382                 "DiscoveryEdgeList": {
383                         "type": "array",
384                         "items": {
385                                 "$ref": "#/definitions/DiscoveryEdge"
386                         }
387                 },
388                 "CPU": {
389                         "type": "object",
390                         "properties": {
391                                 "cpu": {
392                                         "type": "string",
393                                         "description": "Usage of CPU",
394                                         "example": "0.187383"
395                                 }
396                         }
397                 },
398                 "Memory": {
399                         "type": "object",
400                         "properties": {
401                                 "memory": {
402                                         "type": "string",
403                                         "description": "Usage of Memory",
404                                         "example": "11.871336"
405                                 }
406                         }
407                 },
408                 "Network": {
409                         "type": "object",
410                         "properties": {
411                                 "network": {
412                                         "type": "string",
413                                         "description": "Usage of Network",
414                                         "example": "0.003023"
415                                 }
416                         }
417                 },
418                 "Disk": {
419                         "type": "object",
420                         "properties": {
421                                 "network": {
422                                         "type": "string",
423                                         "description": "Usage of Disk",
424                                         "example": ""
425                                 }
426                         }
427                 },
428                 "SystemParam": {
429                         "type": "object",
430                         "properties": {
431                                 "ipAddr": {
432                                         "type": "string",
433                                         "description": "IP Addr of device requesting service",
434                                         "example": "127.0.0.1"
435                                 },
436                                 "port": {
437                                         "type": "string",
438                                         "description": "Port number of device requesting service",
439                                         "example": "5432"
440                                 }
441                         }
442                 },
443                 "UserParam": {
444                         "type": "object",
445                         "properties": {
446                                 "arguments": {
447                                         "type": "string",
448                                         "description": "User parameter of requesting service",
449                                         "example": "5"
450                                 }
451                         }
452                 },
453                 "MicroServiceRequest": {
454                         "type": "object",
455                         "properties": {
456                                 "systemParam": {
457                                         "$ref": "#/definitions/SystemParam"
458                                 },
459                                 "userParam": {
460                                         "$ref": "#/definitions/UserParam"
461                                 }
462                         }
463                 },
464                 "ServiceObject" : {
465                         "type": "object",
466                         "properties": {
467                                 "id": {
468                                         "type": "integer",
469                                         "description": "Created ID of micro-service"
470                                 },
471                                 "time": {
472                                         "type": "string",
473                                         "description": "The time when micro-service created"
474                                 }
475                         }
476                 },
477                 "ServiceObjectList": {
478                         "type": "object",
479                         "properties": {
480                                 "serviceList": {
481                                         "type": "array",
482                                         "items": {
483                                                 "$ref": "#/definitions/ServiceObject"
484                                         },
485                                         "example": [
486                                                 {
487                                                         "id": 2,
488                                                         "time": "2019-03-14T13:43:38+09:00"
489                                                 },
490                                                 {
491                                                         "id": 3,
492                                                         "time": "2019-03-14T13:43:38+09:00"
493                                                 }
494                                         ]
495                                 }
496                         }
497                 },
498                 "ServiceRequest": {
499                         "type": "object",
500                         "properties": {
501                                 "appName": {
502                                         "type": "string",
503                                         "description": "Name of requested user service",
504                                         "example": "GreetWorldApp"
505                                 },
506                                 "serviceName": {
507                                         "type": "string",
508                                         "description": "Name of micro-services",
509                                         "example": "HelloWorldService"
510                                 },
511                                 "count": {
512                                         "type": "integer",
513                                         "description": "Count of micro-services",
514                                         "example": 2
515                                 }
516                         }
517                 },
518                 "ServiceInfo": {
519                         "type": "object",
520                         "properties": {
521                                 "appName": {
522                                         "type": "string",
523                                         "description": "Name of requested user service",
524                                         "example": "GreetWorldApp"
525                                 },
526                                 "serviceList": {
527                                         "$ref": "#/definitions/MicroServiceList"
528                                 }
529                         }
530                 },
531                 "ServiceList": {
532                         "type": "array",
533                         "items": {
534                                 "$ref": "#/definitions/ServiceInfo"
535                         }
536                 },
537                 "MicroServiceInfo": {
538                         "type": "object",
539                         "properties": {
540                                 "serviceName": {
541                                         "type": "string",
542                                         "description": "Service name",
543                                         "example": "HelloWorldService#1"
544                                 },
545                                 "serviceID": {
546                                         "type": "integer",
547                                         "description": "Unique ID of service",
548                                         "example": 2
549                                 },
550                                 "status": {
551                                         "type": "string",
552                                         "description": "Status of service",
553                                         "example": "started"
554                                 },
555                                 "deviceID": {
556                                         "type": "string",
557                                         "description": "DeviceID on which the service is operating",
558                                         "example": "Edge_deviceID"
559                                 }
560                         }
561                 },
562                 "MicroServiceList": {
563                         "type": "array",
564                         "items": {
565                                 "$ref": "#/definitions/MicroServiceInfo"
566                         },
567                         "example": [
568                                 {
569                                         "serviceName": "HelloWorldService#1",
570                                         "serviceID": 2,
571                                         "status": "started",
572                                         "deviceID": "10.113.175.249"
573                                 },
574                                 {
575                                         "serviceName": "HelloWorldService#2",
576                                         "serviceID": 3,
577                                         "status": "progressing",
578                                         "deviceID": "10.113.175.239"
579                                 }
580                         ]
581                 },
582                 "APIResponse": {
583                         "type": "object",
584                         "properties": {
585                                 "message": {
586                                         "type": "string",
587                                         "description": "Return the status of the request"
588                                 }
589                         }
590                 }
591         }
592 }