Add swagger for server action api
[multicloud/framework.git] / multivimbroker / multivimbroker / swagger / multivim.server.swagger.json
1 {
2     "swagger": "2.0",
3     "info": {
4         "version": "1.0.0",
5         "title": "MultiVIM Service rest API"
6     },
7     "basePath": "/api/multicloud/v0/",
8     "tags": [
9         {
10             "name": "MultiVIM services"
11         }
12     ],
13     "paths": {
14         "/{vimid}/{tenantid}/servers": {
15             "post": {
16                 "tags": [
17                     "vim servers"
18                 ],
19                 "summary": "create a server",
20                 "description": "create a server",
21                 "operationId": "create_vim_server",
22                 "consumes": [
23                     "application/json"
24                 ],
25                 "produces": [
26                     "application/json"
27                 ],
28                 "parameters": [
29                     {
30                         "name": "vimid",
31                         "in": "path",
32                         "description": "vim instance id",
33                         "required": true,
34                         "type": "string"
35                     },
36                     {
37                         "name": "tenantid",
38                         "in": "path",
39                         "description": "tenant UUID",
40                         "required": true,
41                         "type": "string"
42                     },
43                     {
44                         "in": "body",
45                         "name": "body",
46                         "description": "create vim server request param",
47                         "required": true,
48                         "schema": {
49                             "$ref": "#/definitions/CreateVimServer"
50                         }
51                     }
52                 ],
53                 "responses": {
54                     "200": {
55                         "description": "successful operation",
56                         "schema": {
57                             "$ref": "#/definitions/VimServerInfo"
58                         }
59                     },
60                     "404": {
61                         "description": "the vim id or tenant UUID is wrong"
62                     },
63                     "500": {
64                         "description": "the vim server is not accessable"
65                     }
66                 }
67             },
68             "get": {
69                 "tags": [
70                     "vim servers"
71                 ],
72                 "summary": "query vim servers list",
73                 "description": "query vim servers list",
74                 "operationId": "query_vim_servers",
75                 "consumes": [
76                     "application/json"
77                 ],
78                 "produces": [
79                     "application/json"
80                 ],
81                 "parameters": [
82                     {
83                         "name": "vimid",
84                         "in": "path",
85                         "description": "vim instance id",
86                         "required": true,
87                         "type": "string"
88                     },
89                     {
90                         "name": "tenantid",
91                         "in": "path",
92                         "description": "tenant UUID",
93                         "required": true,
94                         "type": "string"
95                     },
96                     {
97                         "name": "name",
98                         "in":  "query",
99                         "description": "server name to filter list",
100                         "required": false,
101                         "type": "string"
102                     },
103                     {
104                         "name": "limit",
105                         "in":  "query",
106                         "description": "Requests a page size of items",
107                         "required": false,
108                         "type": "string"
109                     },
110                     {
111                         "name": "marker",
112                         "in":  "query",
113                         "description": "image ID of the last-seen item",
114                         "required": false,
115                         "type": "string"
116                     }
117                 ],
118                 "responses": {
119                     "200": {
120                         "description": "successful operation",
121                         "schema": {
122                             "$ref": "#/definitions/VimServersInfo"
123                         }
124                     },
125                     "404": {
126                         "description": "the vim id or tenant UUID is wrong"
127                     },
128                     "500": {
129                         "description": "the vim server is not accessable"
130                     }
131                 }
132             }
133         },
134         "/{vimid}/{tenantid}/servers/{serverid}": {
135             "delete": {
136                 "tags": [
137                     "vim servers"
138                  ],
139                  "summary": "delete specific vim server",
140                 "description": "delete specific vim server",
141                 "operationId": "delete_vim_server",
142                 "consumes": [
143                     "application/json"
144                 ],
145                 "produces": [
146                     "application/json"
147                 ],
148                 "parameters": [
149                     {
150                         "name": "vimid",
151                         "in": "path",
152                         "description": "vim instance id",
153                         "required": true,
154                         "type": "string"
155                     },
156                     {
157                         "name": "tenantid",
158                         "in": "path",
159                         "description": "tenant UUID",
160                         "required": true,
161                         "type": "string"
162                     },
163                     {
164                         "name": "serverid",
165                         "in": "path",
166                         "description": "vim server id",
167                         "required": true,
168                         "type": "string"
169                     }
170                 ],
171                 "responses": {
172                     "204": {
173                         "description": "successful operation"
174                     },
175                     "404": {
176                         "description": "the vim id or tenant UUID is wrong"
177                     },
178                     "500": {
179                         "description": "the vim server is not accessable"
180                     }
181                 }
182             },
183             "get": {
184                 "tags": [
185                     "vim servers"
186                 ],
187                 "summary": "query specific vim server",
188                 "description": "query specific vim server",
189                 "operationId": "query_vim_server",
190                 "consumes": [
191                     "application/json"
192                 ],
193                 "produces": [
194                     "application/json"
195                 ],
196                 "parameters": [
197                     {
198                         "name": "vimid",
199                         "in": "path",
200                         "description": "vim instance id",
201                         "required": true,
202                         "type": "string"
203                     },
204                     {
205                         "name": "tenantid",
206                         "in": "path",
207                         "description": "tenant UUID",
208                         "required": true,
209                         "type": "string"
210                     },
211                     {
212                         "name": "serverid",
213                         "in": "path",
214                         "description": "vim server id",
215                         "required": true,
216                         "type": "string"
217                     }
218                 ],
219                 "responses": {
220                     "200": {
221                         "description": "successful operation",
222                         "schema": {
223                             "$ref": "#/definitions/VimServerInfo"
224                         }
225                     },
226                     "404": {
227                         "description": "the vim id or tenant UUID is wrong"
228                     },
229                     "500": {
230                         "description": "the vim server is not accessable"
231                     }
232                 }
233             }
234         },
235         "/{vimid}/{tenantid}/servers/{serverid}/action": {
236             "post": {
237                 "tags": [
238                     "vim servers action"
239                 ],
240                 "summary": "operate a server",
241                 "description": "operate a server",
242                 "operationId": "operate_vim_server",
243                 "consumes": [
244                     "application/json"
245                 ],
246                 "produces": [
247                     "application/json"
248                 ],
249                 "parameters": [
250                     {
251                         "name": "vimid",
252                         "in": "path",
253                         "description": "vim instance id",
254                         "required": true,
255                         "type": "string"
256                     },
257                     {
258                         "name": "tenantid",
259                         "in": "path",
260                         "description": "tenant UUID",
261                         "required": true,
262                         "type": "string"
263                     },
264                     {
265                         "name": "serverid",
266                         "in": "path",
267                         "description": "vim server id",
268                         "required": true,
269                         "type": "string"
270                     },
271                     {
272                         "in": "body",
273                         "name": "body",
274                         "description": "operate vim server request param",
275                         "required": true,
276                         "schema": {
277                             "$ref": "#/definitions/OperateVimServer"
278                         }
279                     }
280                 ],
281                 "responses": {
282                     "202": {
283                         "description": "successful operation"
284                     },
285                     "404": {
286                         "description": "the vim id, tenant UUID or server id is wrong"
287                     },
288                     "500": {
289                         "description": "the vim server is not accessable"
290                     }
291                 }
292             }
293         }
294     },
295     "definitions": {
296         "CreateVimServer": {
297             "type": "object",
298             "required": [
299                 "name",
300                 "boot",
301                 "flavorId"
302             ],
303             "properties": {
304                 "name": {
305                     "type": "string",
306                     "description": "server name"
307                 },
308                 "boot": {
309                     "type": "object",
310                     "description": "Parameters to start a server",
311                     "properties": {
312                         "type": {
313                             "type": "integer",
314                             "description": "boot type: 1: boot from volume, 2: boot from image"
315                         },
316                         "volumeId": {
317                             "type": "string",
318                             "description": "volume UUID to boot server"
319                         },
320                         "imageId": {
321                             "type": "string",
322                             "description": "image UUID to boot server"
323                         }
324                     }
325                 },
326                 "flavorId": {
327                     "type": "string",
328                     "description": "flavor uuid to start server"
329                 },
330                 "contextArray": {
331                     "type": "array",
332                     "description": "list of injected files",
333                     "items": {
334                        "$ref": "#/definitions/VimServerContextInfo"
335                     }
336                 },
337                 "volumeArray": {
338                     "type": "array",
339                     "description": "list of volumes attached to a server",
340                     "items": {
341                        "$ref": "#/definitions/VimServerVolumeInfo"
342                     }
343                 },
344                 "nicArray": {
345                     "type": "array",
346                     "description": "list of volumes attached to a server",
347                     "items": {
348                        "$ref": "#/definitions/VimServerNicInfo"
349                     }
350                 },
351                 "availabilityZone": {
352                     "type": "string",
353                     "description": "The availability zone from which to launch the server."
354                 },
355                 "metadata": {
356                     "type": "array",
357                     "description": "list of key-value pairs for metadata to start a server",
358                     "items": {
359                        "$ref": "#/definitions/VimServerKeyValuePair"
360                     }                    
361                 },
362                 "userdata": {
363                     "type": "string",
364                     "description": "user data to start a aserver"
365                 },
366                 "securityGroups": {
367                     "type": "array",
368                     "description": "list of security groups for a server",
369                     "items": {
370                         "type": "string",
371                         "description": "name of security group"
372                     }
373                 },
374                 "serverGroup": {
375                     "type": "string",
376                     "description": "server group"
377                 }
378             }
379         },
380         "VimServerKeyValuePair": {
381             "type": "object",
382             "properties": {
383                 "keyName": {
384                     "type": "string",
385                     "description": "key name"
386                 },
387                 "value": {
388                     "type": "string",
389                     "description": "value "
390                 }
391             }
392         },
393         "VimServerContextInfo": {
394             "type": "object",
395             "properties": {
396                 "fileName": {
397                     "type": "string",
398                     "description": "Injected file name"
399                 },
400                 "fileData": {
401                     "type": "string",
402                     "description": "Injected file content "
403                 }
404             }
405         },
406         "VimServerVolumeInfo": {
407             "type": "object",
408             "properties": {
409                 "volumeId": {
410                     "type": "string",
411                     "description": "volume UUID"
412                 }
413             }
414         },
415         "VimServerNicInfo": {
416             "type": "object",
417             "properties": {
418                 "portId": {
419                     "type": "string",
420                     "description": "virtual port UUID to boot a server"
421                 }
422             }
423         },
424         "VimServersInfo": {
425             "type": "object",
426             "required": [
427                 "vimId",
428                 "tenantId",
429                 "servers"
430             ],
431             "properties": {
432                 "vimId": {
433                     "type": "string"
434                 },
435                 "vimName": {
436                     "type": "string"
437                 },
438                 "tenantId": {
439                     "type": "string",
440                     "description": "tenant UUID"
441                 },
442                 "servers": {
443                     "type": "array",
444                     "description": "server list information",
445                     "items": {
446                        "$ref": "#/definitions/VimServerInfo"
447                     }
448                 }
449             }
450         },
451         "VimServerInfo": {
452             "type": "object",
453             "required": [
454                 "name",
455                 "status",
456                 "id"
457             ],
458             "properties": {
459                 "name": {
460                     "type": "string",
461                     "description": "server name"
462                 },
463                 "id": {
464                     "type": "string",
465                     "description": "server UUID"
466                 },
467                 "status": {
468                     "type": "string",
469                     "description": "server status,0:INACTIVE,1:ACTIVE,2:ERROR"
470                 },
471                 "boot": {
472                     "type": "object",
473                     "description": "Parameters to start a server",
474                     "properties": {
475                         "type": {
476                             "type": "integer",
477                             "description": "boot type: 1: boot from volume, 2: boot from image"
478                         },
479                         "volumeId": {
480                             "type": "string",
481                             "description": "volume UUID to boot server"
482                         },
483                         "ImageId": {
484                             "type": "string",
485                             "description": "image UUID to boot server"
486                         }
487                     }
488                 },
489                 "flavorId": {
490                     "type": "string",
491                     "description": "flavor uuid to start server"
492                 },
493                 "volumeArray": {
494                     "type": "array",
495                     "description": "list of volumes attached to a server",
496                     "items": {
497                        "$ref": "#/definitions/VimServerVolumeInfo"
498                     }
499                 },
500                 "nicArray": {
501                     "type": "array",
502                     "description": "list of volumes attached to a server",
503                     "items": {
504                        "$ref": "#/definitions/VimServerNicInfo"
505                     }
506                 },
507                 "availabilityZone": {
508                     "type": "string",
509                     "description": "available zone for a server"
510                 },
511                 "metadata": {
512                     "type": "array",
513                     "description": "list of key-value pairs for metadata to start a server",
514                     "items": {
515                        "$ref": "#/definitions/VimServerKeyValuePair"
516                     }                    
517                 },
518                 "securityGroups": {
519                     "type": "array",
520                     "description": "list of security groups for a server",
521                     "items": {
522                         "type": "string",
523                         "description": "name of security group"
524                     }
525                 },
526                 "serverGroup": {
527                     "type": "string",
528                     "description": "server group"
529                 },
530                 "vimId": {
531                     "type": "string"
532                 },
533                 "vimName": {
534                     "type": "string"
535                 },
536                 "tenantId": {
537                     "type": "string",
538                     "description": "tenant UUID"
539                 },
540                 "returnCode": {
541                     "type": "integer",
542                     "description": "0: Already exist 1: Newly created"
543                 }
544             }
545         },
546         "OperateVimServer": {
547             "type": "object",
548             "properties": {
549                 "os-start": {
550                     "type": "null",
551                     "description": "the action to start a stopped server"
552                 },
553                 "os-stop": {
554                     "type": "null",
555                     "description": "the action to stop a running server"
556                 },
557                 "reboot": {
558                     "type": "object",
559                     "description": "The action to reboot a server",
560                     "properties": {
561                         "type": {
562                             "type": "string",
563                             "description": "the type of the reboot action: the valid values are HARD and SOFT"
564                         }
565                     }
566                 }
567             }
568         }
569     }
570 }