Add policy design api documentation
[policy/parent.git] / docs / api / policytype-api.json
1 {
2   "swagger" : "2.0",
3   "basePath" : "/",
4   "tags" : [ {
5     "name" : "PolicyType"
6   } ],
7   "schemes" : [ "http", "https" ],
8   "paths" : {
9     "/policy/api/v1/policytypes" : {
10       "get" : {
11         "tags" : [ "PolicyType" ],
12         "summary" : "Retrieve existing policy types",
13         "description" : "Returns a list of existing policy types stored in Policy Framework",
14         "operationId" : "getAllPolicyTypes",
15         "produces" : [ "application/json" ],
16         "parameters" : [ {
17           "name" : "X-ONAP-RequestID",
18           "in" : "header",
19           "description" : "RequestID for http transaction",
20           "required" : false,
21           "type" : "string",
22           "format" : "uuid"
23         } ],
24         "responses" : {
25           "200" : {
26             "description" : "successful operation; All policy types will be returned.",
27             "headers" : {
28               "X-MinorVersion" : {
29                 "type" : "string",
30                 "description" : "Used to request or communicate a MINOR version back from the client to the server, and from the server back to the client"
31               },
32               "X-PatchVersion" : {
33                 "type" : "string",
34                 "description" : "Used only to communicate a PATCH version in a response for troubleshooting purposes only, and will not be provided by the client on request"
35               },
36               "X-LatestVersion" : {
37                 "type" : "string",
38                 "description" : "Used only to communicate an API's latest version"
39               },
40               "X-ONAP-RequestID" : {
41                 "type" : "string",
42                 "format" : "uuid",
43                 "description" : "Used to track REST transactions for logging purpose"
44               }
45             },
46             "schema" : {
47               "$ref" : "#/definitions/ToscaServiceTemplate"
48             }
49           },
50           "401" : {
51             "description" : "Authentication Error"
52           },
53           "403" : {
54             "description" : "Authorization Error"
55           },
56           "500" : {
57             "description" : "Internal Server Error"
58           }
59         },
60         "security" : [ {
61           "basicAuth" : [ ]
62         } ],
63         "x-interface info" : {
64           "api-version" : "1.0.0",
65           "last-mod-release" : "Dublin"
66         }
67       },
68       "post" : {
69         "tags" : [ "PolicyType" ],
70         "summary" : "Create a new policy type",
71         "description" : "Create a new policy type. Client should provide TOSCA body of the new policy type",
72         "operationId" : "createPolicyType",
73         "consumes" : [ "application/json" ],
74         "produces" : [ "application/json" ],
75         "parameters" : [ {
76           "in" : "body",
77           "name" : "body",
78           "description" : "Entity body of policy type",
79           "required" : true,
80           "type" : "ToscaServiceTemplate",
81           "schema" : {
82             "$ref" : "#/definitions/ToscaServiceTemplate"
83           }
84         }, {
85           "name" : "X-ONAP-RequestID",
86           "in" : "header",
87           "description" : "RequestID for http transaction",
88           "required" : false,
89           "type" : "string",
90           "format" : "uuid"
91         } ],
92         "responses" : {
93           "200" : {
94             "description" : "successful operation; The newly created policy type will be returned.",
95             "headers" : {
96               "X-MinorVersion" : {
97                 "type" : "string",
98                 "description" : "Used to request or communicate a MINOR version back from the client to the server, and from the server back to the client"
99               },
100               "X-PatchVersion" : {
101                 "type" : "string",
102                 "description" : "Used only to communicate a PATCH version in a response for troubleshooting purposes only, and will not be provided by the client on request"
103               },
104               "X-LatestVersion" : {
105                 "type" : "string",
106                 "description" : "Used only to communicate an API's latest version"
107               },
108               "X-ONAP-RequestID" : {
109                 "type" : "string",
110                 "format" : "uuid",
111                 "description" : "Used to track REST transactions for logging purpose"
112               }
113             },
114             "schema" : {
115               "$ref" : "#/definitions/ToscaServiceTemplate"
116             }
117           },
118           "400" : {
119             "description" : "Invalid Body"
120           },
121           "401" : {
122             "description" : "Authentication Error"
123           },
124           "403" : {
125             "description" : "Authorization Error"
126           },
127           "500" : {
128             "description" : "Internal Server Error"
129           }
130         },
131         "security" : [ {
132           "basicAuth" : [ ]
133         } ],
134         "x-interface info" : {
135           "api-version" : "1.0.0",
136           "last-mod-release" : "Dublin"
137         }
138       }
139     },
140     "/policy/api/v1/policytypes/{policyTypeId}" : {
141       "get" : {
142         "tags" : [ "PolicyType" ],
143         "summary" : "Retrieve all available versions of a policy type",
144         "description" : "Returns a list of all available versions for the specified policy type",
145         "operationId" : "getAllVersionsOfPolicyType",
146         "produces" : [ "application/json" ],
147         "parameters" : [ {
148           "name" : "policyTypeId",
149           "in" : "path",
150           "description" : "ID of policy type",
151           "required" : true,
152           "type" : "string"
153         }, {
154           "name" : "X-ONAP-RequestID",
155           "in" : "header",
156           "description" : "RequestID for http transaction",
157           "required" : false,
158           "type" : "string",
159           "format" : "uuid"
160         } ],
161         "responses" : {
162           "200" : {
163             "description" : "successful operation; All versions of specified policy type will be returned.",
164             "headers" : {
165               "X-MinorVersion" : {
166                 "type" : "string",
167                 "description" : "Used to request or communicate a MINOR version back from the client to the server, and from the server back to the client"
168               },
169               "X-PatchVersion" : {
170                 "type" : "string",
171                 "description" : "Used only to communicate a PATCH version in a response for troubleshooting purposes only, and will not be provided by the client on request"
172               },
173               "X-LatestVersion" : {
174                 "type" : "string",
175                 "description" : "Used only to communicate an API's latest version"
176               },
177               "X-ONAP-RequestID" : {
178                 "type" : "string",
179                 "format" : "uuid",
180                 "description" : "Used to track REST transactions for logging purpose"
181               }
182             },
183             "schema" : {
184               "$ref" : "#/definitions/ToscaServiceTemplate"
185             }
186           },
187           "401" : {
188             "description" : "Authentication Error"
189           },
190           "403" : {
191             "description" : "Authorization Error"
192           },
193           "404" : {
194             "description" : "Resource Not Found"
195           },
196           "500" : {
197             "description" : "Internal Server Error"
198           }
199         },
200         "security" : [ {
201           "basicAuth" : [ ]
202         } ],
203         "x-interface info" : {
204           "api-version" : "1.0.0",
205           "last-mod-release" : "Dublin"
206         }
207       }
208     },
209     "/policy/api/v1/policytypes/{policyTypeId}/versions/{versionId}" : {
210       "get" : {
211         "tags" : [ "PolicyType" ],
212         "summary" : "Retrieve one particular version of a policy type",
213         "description" : "Returns a particular version for the specified policy type",
214         "operationId" : "getSpecificVersionOfPolicyType",
215         "produces" : [ "application/json" ],
216         "parameters" : [ {
217           "name" : "policyTypeId",
218           "in" : "path",
219           "description" : "ID of policy type",
220           "required" : true,
221           "type" : "string"
222         }, {
223           "name" : "versionId",
224           "in" : "path",
225           "description" : "Version of policy type",
226           "required" : true,
227           "type" : "string"
228         }, {
229           "name" : "X-ONAP-RequestID",
230           "in" : "header",
231           "description" : "RequestID for http transaction",
232           "required" : false,
233           "type" : "string",
234           "format" : "uuid"
235         } ],
236         "responses" : {
237           "200" : {
238             "description" : "successful operation; One specified version of specified policy type will be returned.",
239             "headers" : {
240               "X-MinorVersion" : {
241                 "type" : "string",
242                 "description" : "Used to request or communicate a MINOR version back from the client to the server, and from the server back to the client"
243               },
244               "X-PatchVersion" : {
245                 "type" : "string",
246                 "description" : "Used only to communicate a PATCH version in a response for troubleshooting purposes only, and will not be provided by the client on request"
247               },
248               "X-LatestVersion" : {
249                 "type" : "string",
250                 "description" : "Used only to communicate an API's latest version"
251               },
252               "X-ONAP-RequestID" : {
253                 "type" : "string",
254                 "format" : "uuid",
255                 "description" : "Used to track REST transactions for logging purpose"
256               }
257             },
258             "schema" : {
259               "$ref" : "#/definitions/ToscaServiceTemplate"
260             }
261           },
262           "401" : {
263             "description" : "Authentication Error"
264           },
265           "403" : {
266             "description" : "Authorization Error"
267           },
268           "404" : {
269             "description" : "Resource Not Found"
270           },
271           "500" : {
272             "description" : "Internal Server Error"
273           }
274         },
275         "security" : [ {
276           "basicAuth" : [ ]
277         } ],
278         "x-interface info" : {
279           "api-version" : "1.0.0",
280           "last-mod-release" : "Dublin"
281         }
282       },
283       "delete" : {
284         "tags" : [ "PolicyType" ],
285         "summary" : "Delete one version of a policy type",
286         "description" : "Delete one version of a policy type. It must follow two rules. Rule 1: pre-defined policy types cannot be deleted; Rule 2: policy types that are in use (parameterized by a TOSCA policy) cannot be deleted. The parameterizing TOSCA policies must be deleted first.",
287         "operationId" : "deleteSpecificVersionOfPolicyType",
288         "produces" : [ "application/json" ],
289         "parameters" : [ {
290           "name" : "policyTypeId",
291           "in" : "path",
292           "description" : "ID of policy type",
293           "required" : true,
294           "type" : "string"
295         }, {
296           "name" : "versionId",
297           "in" : "path",
298           "description" : "Version of policy type",
299           "required" : true,
300           "type" : "string"
301         }, {
302           "name" : "X-ONAP-RequestID",
303           "in" : "header",
304           "description" : "RequestID for http transaction",
305           "required" : false,
306           "type" : "string",
307           "format" : "uuid"
308         } ],
309         "responses" : {
310           "200" : {
311             "description" : "successful operation; Newly deleted policy type will be returned.",
312             "headers" : {
313               "X-MinorVersion" : {
314                 "type" : "string",
315                 "description" : "Used to request or communicate a MINOR version back from the client to the server, and from the server back to the client"
316               },
317               "X-PatchVersion" : {
318                 "type" : "string",
319                 "description" : "Used only to communicate a PATCH version in a response for troubleshooting purposes only, and will not be provided by the client on request"
320               },
321               "X-LatestVersion" : {
322                 "type" : "string",
323                 "description" : "Used only to communicate an API's latest version"
324               },
325               "X-ONAP-RequestID" : {
326                 "type" : "string",
327                 "format" : "uuid",
328                 "description" : "Used to track REST transactions for logging purpose"
329               }
330             },
331             "schema" : {
332               "$ref" : "#/definitions/ToscaServiceTemplate"
333             }
334           },
335           "401" : {
336             "description" : "Authentication Error"
337           },
338           "403" : {
339             "description" : "Authorization Error"
340           },
341           "404" : {
342             "description" : "Resource Not Found"
343           },
344           "409" : {
345             "description" : "Delete Conflict, Rule Violation"
346           },
347           "500" : {
348             "description" : "Internal Server Error"
349           }
350         },
351         "security" : [ {
352           "basicAuth" : [ ]
353         } ],
354         "x-interface info" : {
355           "api-version" : "1.0.0",
356           "last-mod-release" : "Dublin"
357         }
358       }
359     },
360     "/policy/api/v1/policytypes/{policyTypeId}/versions/latest" : {
361       "get" : {
362         "tags" : [ "PolicyType" ],
363         "summary" : "Retrieve latest version of a policy type",
364         "description" : "Returns latest version for the specified policy type",
365         "operationId" : "getLatestVersionOfPolicyType",
366         "produces" : [ "application/json" ],
367         "parameters" : [ {
368           "name" : "policyTypeId",
369           "in" : "path",
370           "description" : "ID of policy type",
371           "required" : true,
372           "type" : "string"
373         }, {
374           "name" : "X-ONAP-RequestID",
375           "in" : "header",
376           "description" : "RequestID for http transaction",
377           "required" : false,
378           "type" : "string",
379           "format" : "uuid"
380         } ],
381         "responses" : {
382           "200" : {
383             "description" : "successful operation; Latest version of specified policy type will be returned.",
384             "headers" : {
385               "X-MinorVersion" : {
386                 "type" : "string",
387                 "description" : "Used to request or communicate a MINOR version back from the client to the server, and from the server back to the client"
388               },
389               "X-PatchVersion" : {
390                 "type" : "string",
391                 "description" : "Used only to communicate a PATCH version in a response for troubleshooting purposes only, and will not be provided by the client on request"
392               },
393               "X-LatestVersion" : {
394                 "type" : "string",
395                 "description" : "Used only to communicate an API's latest version"
396               },
397               "X-ONAP-RequestID" : {
398                 "type" : "string",
399                 "format" : "uuid",
400                 "description" : "Used to track REST transactions for logging purpose"
401               }
402             },
403             "schema" : {
404               "$ref" : "#/definitions/ToscaServiceTemplate"
405             }
406           },
407           "401" : {
408             "description" : "Authentication Error"
409           },
410           "403" : {
411             "description" : "Authorization Error"
412           },
413           "404" : {
414             "description" : "Resource Not Found"
415           },
416           "500" : {
417             "description" : "Internal Server Error"
418           }
419         },
420         "security" : [ {
421           "basicAuth" : [ ]
422         } ],
423         "x-interface info" : {
424           "api-version" : "1.0.0",
425           "last-mod-release" : "Dublin"
426         }
427       }
428     }
429   }, 
430   "securityDefinitions" : {
431     "basicAuth" : {
432       "description" : "",
433       "type" : "basic"
434     }
435   },
436   "definitions" : {
437     "ToscaConstraint" : {
438       "type" : "object",
439       "properties" : {
440         "valid_values" : {
441           "type" : "array",
442           "items" : {
443             "type" : "string"
444           }
445         },
446         "equal" : {
447           "type" : "string"
448         },
449         "greater_than" : {
450           "type" : "string"
451         },
452         "greater_or_equal" : {
453           "type" : "string"
454         },
455         "less_than" : {
456           "type" : "string"
457         },
458         "less_or_equal" : {
459           "type" : "string"
460         }
461       }
462     },
463     "ToscaDataType" : {
464       "type" : "object",
465       "properties" : {
466         "name" : {
467           "type" : "string"
468         },
469         "version" : {
470           "type" : "string"
471         },
472         "derived_from" : {
473           "type" : "string"
474         },
475         "metadata" : {
476           "type" : "object",
477           "additionalProperties" : {
478             "type" : "string"
479           }
480         },
481         "description" : {
482           "type" : "string"
483         },
484         "constraints" : {
485           "type" : "array",
486           "items" : {
487             "$ref" : "#/definitions/ToscaConstraint"
488           }
489         },
490         "properties" : {
491           "type" : "object",
492           "additionalProperties" : {
493             "$ref" : "#/definitions/ToscaProperty"
494           }
495         }
496       }
497     },
498     "ToscaEntrySchema" : {
499       "type" : "object",
500       "properties" : {
501         "name" : {
502           "type" : "string"
503         },
504         "type" : {
505           "type" : "string"
506         },
507         "typeVersion" : {
508           "type" : "string"
509         },
510         "description" : {
511           "type" : "string"
512         },
513         "constraints" : {
514           "type" : "array",
515           "items" : {
516             "$ref" : "#/definitions/ToscaConstraint"
517           }
518         }
519       }
520     },
521     "ToscaPolicyType" : {
522       "type" : "object",
523       "properties" : {
524         "name" : {
525           "type" : "string"
526         },
527         "version" : {
528           "type" : "string"
529         },
530         "derived_from" : {
531           "type" : "string"
532         },
533         "metadata" : {
534           "type" : "object",
535           "additionalProperties" : {
536             "type" : "string"
537           }
538         },
539         "description" : {
540           "type" : "string"
541         },
542         "properties" : {
543           "type" : "object",
544           "additionalProperties" : {
545             "$ref" : "#/definitions/ToscaProperty"
546           }
547         }
548       }
549     },
550     "ToscaPolicyTypeIdentifier" : {
551       "type" : "object",
552       "properties" : {
553         "name" : {
554           "type" : "string"
555         },
556         "version" : {
557           "type" : "string"
558         }
559       }
560     },
561     "ToscaProperty" : {
562       "type" : "object",
563       "properties" : {
564         "name" : {
565           "type" : "string"
566         },
567         "type" : {
568           "type" : "string"
569         },
570         "typeVersion" : {
571           "type" : "string"
572         },
573         "description" : {
574           "type" : "string"
575         },
576         "default" : {
577           "type" : "string"
578         },
579         "required" : {
580           "type" : "boolean"
581         },
582         "status" : {
583           "type" : "string",
584           "enum" : [ "SUPPORTED", "UNSUPPORTED", "EXPERIMENTAL", "DEPRECATED" ]
585         },
586         "constraints" : {
587           "type" : "array",
588           "items" : {
589             "$ref" : "#/definitions/ToscaConstraint"
590           }
591         },
592         "entry_schema" : {
593           "$ref" : "#/definitions/ToscaEntrySchema"
594         }
595       }
596     },
597     "ToscaServiceTemplate" : {
598       "type" : "object",
599       "properties" : {
600         "name" : {
601           "type" : "string"
602         },
603         "version" : {
604           "type" : "string"
605         },
606         "derived_from" : {
607           "type" : "string"
608         },
609         "metadata" : {
610           "type" : "object",
611           "additionalProperties" : {
612             "type" : "string"
613           }
614         },
615         "description" : {
616           "type" : "string"
617         },
618         "tosca_definitions_version" : {
619           "type" : "string"
620         },
621         "topology_template" : {
622           "$ref" : "#/definitions/ToscaTopologyTemplate"
623         },
624         "policy_types" : {
625           "type" : "array",
626           "items" : {
627             "type" : "object",
628             "additionalProperties" : {
629               "$ref" : "#/definitions/ToscaPolicyType"
630             }
631           }
632         },
633         "data_types" : {
634           "type" : "array",
635           "items" : {
636             "type" : "object",
637             "additionalProperties" : {
638               "$ref" : "#/definitions/ToscaDataType"
639             }
640           }
641         }
642       }
643     },
644     "ToscaTopologyTemplate" : {
645       "type" : "object",
646       "properties" : {
647         "description" : {
648           "type" : "string"
649         },
650         "policies" : {
651           "type" : "array",
652           "items" : {
653             "type" : "object",
654             "additionalProperties" : {
655               "$ref" : "#/definitions/ToscaPolicy"
656             }
657           }
658         }
659       }
660     }
661   }
662 }