Create Preliminary Documentation for CPS-Core & NCMP
[cps.git] / docs / api / swagger / cps / openapi.yaml
1 openapi: 3.0.1
2 info:
3   title: ONAP Open API v3 Configuration Persistence Service
4   description: Configuration Persistence Service is a Model Driven Generic Database
5   contact:
6     name: ONAP
7     url: https://onap.readthedocs.io
8     email: onap-discuss@lists.onap.org
9   license:
10     name: Apache 2.0
11     url: http://www.apache.org/licenses/LICENSE-2.0
12   version: 1.0.0
13   x-planned-retirement-date: "202212"
14   x-component: Modeling
15   x-logo:
16     url: cps_logo.png
17 servers:
18 - url: /cps/api
19 tags:
20 - name: cps-admin
21   description: cps Admin
22 - name: cps-data
23   description: cps Data
24 paths:
25   /v1/dataspaces:
26     post:
27       tags:
28       - cps-admin
29       summary: Create a dataspace
30       description: Create a new dataspace
31       operationId: createDataspace
32       parameters:
33       - name: dataspace-name
34         in: query
35         description: dataspace-name
36         required: true
37         schema:
38           type: string
39       responses:
40         "201":
41           description: Created
42           content:
43             text/plain:
44               schema:
45                 type: string
46         "400":
47           description: Bad Request
48           content:
49             application/json:
50               schema:
51                 $ref: '#/components/schemas/ErrorMessage'
52         "401":
53           description: Unauthorized
54           content:
55             application/json:
56               schema:
57                 $ref: '#/components/schemas/ErrorMessage'
58         "403":
59           description: Forbidden
60           content:
61             application/json:
62               schema:
63                 $ref: '#/components/schemas/ErrorMessage'
64   /v1/dataspaces/{dataspace-name}/anchors:
65     get:
66       tags:
67       - cps-admin
68       summary: Get anchors
69       description: "Read all anchors, given a dataspace"
70       operationId: getAnchors
71       parameters:
72       - name: dataspace-name
73         in: path
74         description: dataspace-name
75         required: true
76         schema:
77           type: string
78       responses:
79         "200":
80           description: OK
81           content:
82             application/json:
83               schema:
84                 type: array
85                 items:
86                   $ref: '#/components/schemas/AnchorDetails'
87         "400":
88           description: Bad Request
89           content:
90             application/json:
91               schema:
92                 $ref: '#/components/schemas/ErrorMessage'
93         "401":
94           description: Unauthorized
95           content:
96             application/json:
97               schema:
98                 $ref: '#/components/schemas/ErrorMessage'
99         "403":
100           description: Forbidden
101           content:
102             application/json:
103               schema:
104                 $ref: '#/components/schemas/ErrorMessage'
105         "404":
106           description: The specified resource was not found
107           content:
108             application/json:
109               schema:
110                 $ref: '#/components/schemas/ErrorMessage'
111     post:
112       tags:
113       - cps-admin
114       summary: Create an anchor
115       description: Create a new anchor in the given dataspace
116       operationId: createAnchor
117       parameters:
118       - name: dataspace-name
119         in: path
120         description: dataspace-name
121         required: true
122         schema:
123           type: string
124       - name: schema-set-name
125         in: query
126         description: schema-set-name
127         required: true
128         schema:
129           type: string
130       - name: anchor-name
131         in: query
132         description: anchor-name
133         required: true
134         schema:
135           type: string
136       responses:
137         "201":
138           description: Created
139           content:
140             text/plain:
141               schema:
142                 type: string
143         "400":
144           description: Bad Request
145           content:
146             application/json:
147               schema:
148                 $ref: '#/components/schemas/ErrorMessage'
149         "401":
150           description: Unauthorized
151           content:
152             application/json:
153               schema:
154                 $ref: '#/components/schemas/ErrorMessage'
155         "403":
156           description: Forbidden
157           content:
158             application/json:
159               schema:
160                 $ref: '#/components/schemas/ErrorMessage'
161   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}:
162     get:
163       tags:
164       - cps-admin
165       summary: Get an anchor
166       description: Read an anchor given an anchor name and a dataspace
167       operationId: getAnchor
168       parameters:
169       - name: dataspace-name
170         in: path
171         description: dataspace-name
172         required: true
173         schema:
174           type: string
175       - name: anchor-name
176         in: path
177         description: anchor-name
178         required: true
179         schema:
180           type: string
181       responses:
182         "200":
183           description: OK
184           content:
185             application/json:
186               schema:
187                 $ref: '#/components/schemas/AnchorDetails'
188         "400":
189           description: Bad Request
190           content:
191             application/json:
192               schema:
193                 $ref: '#/components/schemas/ErrorMessage'
194         "401":
195           description: Unauthorized
196           content:
197             application/json:
198               schema:
199                 $ref: '#/components/schemas/ErrorMessage'
200         "403":
201           description: Forbidden
202           content:
203             application/json:
204               schema:
205                 $ref: '#/components/schemas/ErrorMessage'
206         "404":
207           description: The specified resource was not found
208           content:
209             application/json:
210               schema:
211                 $ref: '#/components/schemas/ErrorMessage'
212     delete:
213       tags:
214       - cps-admin
215       summary: Delete an anchor
216       description: Delete an anchor given an anchor name and a dataspace
217       operationId: deleteAnchor
218       parameters:
219       - name: dataspace-name
220         in: path
221         description: dataspace-name
222         required: true
223         schema:
224           type: string
225       - name: anchor-name
226         in: path
227         description: anchor-name
228         required: true
229         schema:
230           type: string
231       responses:
232         "204":
233           description: No Content
234           content: {}
235         "400":
236           description: Bad Request
237           content:
238             application/json:
239               schema:
240                 $ref: '#/components/schemas/ErrorMessage'
241         "401":
242           description: Unauthorized
243           content:
244             application/json:
245               schema:
246                 $ref: '#/components/schemas/ErrorMessage'
247         "403":
248           description: Forbidden
249           content:
250             application/json:
251               schema:
252                 $ref: '#/components/schemas/ErrorMessage'
253   /v1/dataspaces/{dataspace-name}/schema-sets:
254     post:
255       tags:
256       - cps-admin
257       summary: Create a schema set
258       description: Create a new schema set in the given dataspace
259       operationId: createSchemaSet
260       parameters:
261       - name: dataspace-name
262         in: path
263         description: dataspace-name
264         required: true
265         schema:
266           type: string
267       - name: schema-set-name
268         in: query
269         description: schema-set-name
270         required: true
271         schema:
272           type: string
273       requestBody:
274         content:
275           multipart/form-data:
276             schema:
277               $ref: '#/components/schemas/MultipartFile'
278         required: true
279       responses:
280         "201":
281           description: Created
282           content:
283             text/plain:
284               schema:
285                 type: string
286         "400":
287           description: Bad Request
288           content:
289             application/json:
290               schema:
291                 $ref: '#/components/schemas/ErrorMessage'
292         "401":
293           description: Unauthorized
294           content:
295             application/json:
296               schema:
297                 $ref: '#/components/schemas/ErrorMessage'
298         "403":
299           description: Forbidden
300           content:
301             application/json:
302               schema:
303                 $ref: '#/components/schemas/ErrorMessage'
304   /v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}:
305     get:
306       tags:
307       - cps-admin
308       summary: Get a schema set
309       description: Read a schema set given a schema set name and a dataspace
310       operationId: getSchemaSet
311       parameters:
312       - name: dataspace-name
313         in: path
314         description: dataspace-name
315         required: true
316         schema:
317           type: string
318       - name: schema-set-name
319         in: path
320         description: schema-set-name
321         required: true
322         schema:
323           type: string
324       responses:
325         "200":
326           description: OK
327           content:
328             application/json:
329               schema:
330                 $ref: '#/components/schemas/SchemaSetDetails'
331         "400":
332           description: Bad Request
333           content:
334             application/json:
335               schema:
336                 $ref: '#/components/schemas/ErrorMessage'
337         "401":
338           description: Unauthorized
339           content:
340             application/json:
341               schema:
342                 $ref: '#/components/schemas/ErrorMessage'
343         "403":
344           description: Forbidden
345           content:
346             application/json:
347               schema:
348                 $ref: '#/components/schemas/ErrorMessage'
349         "404":
350           description: The specified resource was not found
351           content:
352             application/json:
353               schema:
354                 $ref: '#/components/schemas/ErrorMessage'
355     delete:
356       tags:
357       - cps-admin
358       summary: Delete a schema set
359       description: Delete a schema set given a schema set name and a dataspace
360       operationId: deleteSchemaSet
361       parameters:
362       - name: dataspace-name
363         in: path
364         description: dataspace-name
365         required: true
366         schema:
367           type: string
368       - name: schema-set-name
369         in: path
370         description: schema-set-name
371         required: true
372         schema:
373           type: string
374       responses:
375         "204":
376           description: No Content
377           content: {}
378         "400":
379           description: Bad Request
380           content:
381             application/json:
382               schema:
383                 $ref: '#/components/schemas/ErrorMessage'
384         "401":
385           description: Unauthorized
386           content:
387             application/json:
388               schema:
389                 $ref: '#/components/schemas/ErrorMessage'
390         "403":
391           description: Forbidden
392           content:
393             application/json:
394               schema:
395                 $ref: '#/components/schemas/ErrorMessage'
396         "409":
397           description: Conflict
398           content:
399             application/json:
400               schema:
401                 $ref: '#/components/schemas/ErrorMessage'
402   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node:
403     get:
404       tags:
405       - cps-data
406       summary: Get a node
407       description: Get a node with an option to retrieve all the children for a given
408         anchor and dataspace
409       operationId: getNodeByDataspaceAndAnchor
410       parameters:
411       - name: dataspace-name
412         in: path
413         description: dataspace-name
414         required: true
415         schema:
416           type: string
417       - name: anchor-name
418         in: path
419         description: anchor-name
420         required: true
421         schema:
422           type: string
423       - name: xpath
424         in: query
425         description: xpath
426         required: false
427         schema:
428           type: string
429           default: /
430       - name: include-descendants
431         in: query
432         description: include-descendants
433         required: false
434         schema:
435           type: boolean
436           default: false
437       responses:
438         "200":
439           description: OK
440           content:
441             application/json:
442               schema:
443                 type: object
444               example:
445                 child: my_child
446                 leafList: "leafListElement1, leafListElement2"
447                 leaf: my_leaf
448         "400":
449           description: Bad Request
450           content:
451             application/json:
452               schema:
453                 $ref: '#/components/schemas/ErrorMessage'
454         "401":
455           description: Unauthorized
456           content:
457             application/json:
458               schema:
459                 $ref: '#/components/schemas/ErrorMessage'
460         "403":
461           description: Forbidden
462           content:
463             application/json:
464               schema:
465                 $ref: '#/components/schemas/ErrorMessage'
466         "404":
467           description: The specified resource was not found
468           content:
469             application/json:
470               schema:
471                 $ref: '#/components/schemas/ErrorMessage'
472       x-codegen-request-body-name: xpath
473   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes:
474     put:
475       tags:
476       - cps-data
477       summary: Replace a node with descendants
478       description: "Replace a node with descendants for a given dataspace, anchor\
479         \ and a parent node xpath"
480       operationId: replaceNode
481       parameters:
482       - name: dataspace-name
483         in: path
484         description: dataspace-name
485         required: true
486         schema:
487           type: string
488       - name: anchor-name
489         in: path
490         description: anchor-name
491         required: true
492         schema:
493           type: string
494       - name: xpath
495         in: query
496         description: xpath
497         required: false
498         schema:
499           type: string
500           default: /
501       - name: observed-timestamp
502         in: query
503         description: observed-timestamp
504         required: false
505         schema:
506           type: string
507           example: 2021-03-21T00:10:34.030-0100
508       requestBody:
509         content:
510           application/json:
511             schema:
512               type: string
513         required: true
514       responses:
515         "200":
516           description: OK
517           content:
518             application/json:
519               schema:
520                 type: object
521               example:
522                 key: value
523         "400":
524           description: Bad Request
525           content:
526             application/json:
527               schema:
528                 $ref: '#/components/schemas/ErrorMessage'
529         "401":
530           description: Unauthorized
531           content:
532             application/json:
533               schema:
534                 $ref: '#/components/schemas/ErrorMessage'
535         "403":
536           description: Forbidden
537           content:
538             application/json:
539               schema:
540                 $ref: '#/components/schemas/ErrorMessage'
541     post:
542       tags:
543       - cps-data
544       summary: Create a node
545       description: Create a node for a given anchor and dataspace
546       operationId: createNode
547       parameters:
548       - name: dataspace-name
549         in: path
550         description: dataspace-name
551         required: true
552         schema:
553           type: string
554       - name: anchor-name
555         in: path
556         description: anchor-name
557         required: true
558         schema:
559           type: string
560       - name: xpath
561         in: query
562         description: xpath
563         required: false
564         schema:
565           type: string
566           default: /
567       - name: observed-timestamp
568         in: query
569         description: observed-timestamp
570         required: false
571         schema:
572           type: string
573           example: 2021-03-21T00:10:34.030-0100
574       requestBody:
575         content:
576           application/json:
577             schema:
578               type: string
579         required: true
580       responses:
581         "201":
582           description: Created
583           content:
584             text/plain:
585               schema:
586                 type: string
587         "400":
588           description: Bad Request
589           content:
590             application/json:
591               schema:
592                 $ref: '#/components/schemas/ErrorMessage'
593         "401":
594           description: Unauthorized
595           content:
596             application/json:
597               schema:
598                 $ref: '#/components/schemas/ErrorMessage'
599         "403":
600           description: Forbidden
601           content:
602             application/json:
603               schema:
604                 $ref: '#/components/schemas/ErrorMessage'
605     patch:
606       tags:
607       - cps-data
608       summary: Update node leaves
609       description: Update a data node leaves for a given dataspace and anchor and
610         a parent node xpath
611       operationId: updateNodeLeaves
612       parameters:
613       - name: dataspace-name
614         in: path
615         description: dataspace-name
616         required: true
617         schema:
618           type: string
619       - name: anchor-name
620         in: path
621         description: anchor-name
622         required: true
623         schema:
624           type: string
625       - name: xpath
626         in: query
627         description: xpath
628         required: false
629         schema:
630           type: string
631           default: /
632       - name: observed-timestamp
633         in: query
634         description: observed-timestamp
635         required: false
636         schema:
637           type: string
638           example: 2021-03-21T00:10:34.030-0100
639       requestBody:
640         content:
641           application/json:
642             schema:
643               type: string
644         required: true
645       responses:
646         "200":
647           description: OK
648           content:
649             application/json:
650               schema:
651                 type: object
652               example:
653                 key: value
654         "400":
655           description: Bad Request
656           content:
657             application/json:
658               schema:
659                 $ref: '#/components/schemas/ErrorMessage'
660         "401":
661           description: Unauthorized
662           content:
663             application/json:
664               schema:
665                 $ref: '#/components/schemas/ErrorMessage'
666         "403":
667           description: Forbidden
668           content:
669             application/json:
670               schema:
671                 $ref: '#/components/schemas/ErrorMessage'
672   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes:
673     put:
674       tags:
675       - cps-data
676       summary: Replace list-node child element(s) under existing parent node
677       description: Replace list-node child elements under existing node for a given
678         anchor and dataspace
679       operationId: replaceListNodeElements
680       parameters:
681       - name: dataspace-name
682         in: path
683         description: dataspace-name
684         required: true
685         schema:
686           type: string
687       - name: anchor-name
688         in: path
689         description: anchor-name
690         required: true
691         schema:
692           type: string
693       - name: xpath
694         in: query
695         description: xpath
696         required: true
697         schema:
698           type: string
699       - name: observed-timestamp
700         in: query
701         description: observed-timestamp
702         required: false
703         schema:
704           type: string
705           example: 2021-03-21T00:10:34.030-0100
706       requestBody:
707         content:
708           application/json:
709             schema:
710               type: string
711         required: true
712       responses:
713         "200":
714           description: Created
715           content:
716             text/plain:
717               schema:
718                 type: string
719         "400":
720           description: Bad Request
721           content:
722             application/json:
723               schema:
724                 $ref: '#/components/schemas/ErrorMessage'
725         "401":
726           description: Unauthorized
727           content:
728             application/json:
729               schema:
730                 $ref: '#/components/schemas/ErrorMessage'
731         "403":
732           description: Forbidden
733           content:
734             application/json:
735               schema:
736                 $ref: '#/components/schemas/ErrorMessage'
737     post:
738       tags:
739       - cps-data
740       summary: Add list-node child element(s) under existing parent node
741       description: Add list-node child elements to existing node for a given anchor
742         and dataspace
743       operationId: addListNodeElements
744       parameters:
745       - name: dataspace-name
746         in: path
747         description: dataspace-name
748         required: true
749         schema:
750           type: string
751       - name: anchor-name
752         in: path
753         description: anchor-name
754         required: true
755         schema:
756           type: string
757       - name: xpath
758         in: query
759         description: xpath
760         required: true
761         schema:
762           type: string
763       - name: observed-timestamp
764         in: query
765         description: observed-timestamp
766         required: false
767         schema:
768           type: string
769           example: 2021-03-21T00:10:34.030-0100
770       requestBody:
771         content:
772           application/json:
773             schema:
774               type: string
775         required: true
776       responses:
777         "201":
778           description: Created
779           content:
780             text/plain:
781               schema:
782                 type: string
783         "400":
784           description: Bad Request
785           content:
786             application/json:
787               schema:
788                 $ref: '#/components/schemas/ErrorMessage'
789         "401":
790           description: Unauthorized
791           content:
792             application/json:
793               schema:
794                 $ref: '#/components/schemas/ErrorMessage'
795         "403":
796           description: Forbidden
797           content:
798             application/json:
799               schema:
800                 $ref: '#/components/schemas/ErrorMessage'
801     delete:
802       tags:
803       - cps-data
804       summary: Delete list-node child element(s) under existing parent node
805       description: Delete list-node child elements under existing node for a given
806         anchor and dataspace
807       operationId: deleteListNodeElements
808       parameters:
809       - name: dataspace-name
810         in: path
811         description: dataspace-name
812         required: true
813         schema:
814           type: string
815       - name: anchor-name
816         in: path
817         description: anchor-name
818         required: true
819         schema:
820           type: string
821       - name: xpath
822         in: query
823         description: xpath
824         required: true
825         schema:
826           type: string
827       - name: observed-timestamp
828         in: query
829         description: observed-timestamp
830         required: false
831         schema:
832           type: string
833           example: 2021-03-21T00:10:34.030-0100
834       responses:
835         "204":
836           description: No Content
837           content: {}
838         "400":
839           description: Bad Request
840           content:
841             application/json:
842               schema:
843                 $ref: '#/components/schemas/ErrorMessage'
844         "401":
845           description: Unauthorized
846           content:
847             application/json:
848               schema:
849                 $ref: '#/components/schemas/ErrorMessage'
850         "403":
851           description: Forbidden
852           content:
853             application/json:
854               schema:
855                 $ref: '#/components/schemas/ErrorMessage'
856   /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query:
857     get:
858       tags:
859       - cps-query
860       summary: Query data nodes
861       description: Query data nodes for the given dataspace and anchor using CPS path
862       operationId: getNodesByDataspaceAndAnchorAndCpsPath
863       parameters:
864       - name: dataspace-name
865         in: path
866         description: dataspace-name
867         required: true
868         schema:
869           type: string
870       - name: anchor-name
871         in: path
872         description: anchor-name
873         required: true
874         schema:
875           type: string
876       - name: cps-path
877         in: query
878         description: cps-path
879         required: false
880         schema:
881           type: string
882           default: /
883       - name: include-descendants
884         in: query
885         description: include-descendants
886         required: false
887         schema:
888           type: boolean
889           default: false
890       responses:
891         "200":
892           description: OK
893           content:
894             application/json:
895               schema:
896                 type: object
897               example:
898                 key: value
899         "400":
900           description: Bad Request
901           content:
902             application/json:
903               schema:
904                 $ref: '#/components/schemas/ErrorMessage'
905         "401":
906           description: Unauthorized
907           content:
908             application/json:
909               schema:
910                 $ref: '#/components/schemas/ErrorMessage'
911         "403":
912           description: Forbidden
913           content:
914             application/json:
915               schema:
916                 $ref: '#/components/schemas/ErrorMessage'
917         "404":
918           description: The specified resource was not found
919           content:
920             application/json:
921               schema:
922                 $ref: '#/components/schemas/ErrorMessage'
923       x-codegen-request-body-name: xpath
924 components:
925   schemas:
926     ErrorMessage:
927       title: Error
928       type: object
929       properties:
930         status:
931           type: string
932           example: "400"
933         message:
934           type: string
935           example: Dataspace not found
936         details:
937           type: string
938           example: Dataspace with name D1 does not exist.
939     AnchorDetails:
940       title: Anchor details by anchor Name
941       type: object
942       properties:
943         name:
944           type: string
945           example: my_anchor
946         dataspaceName:
947           type: string
948           example: my_dataspace
949         schemaSetName:
950           type: string
951           example: my_schema_set
952     MultipartFile:
953       required:
954       - file
955       type: object
956       properties:
957         file:
958           type: string
959           description: multipartFile
960           format: binary
961     SchemaSetDetails:
962       title: Schema set details by dataspace and schemasetName
963       type: object
964       properties:
965         dataspaceName:
966           type: string
967           example: my_dataspace
968         moduleReferences:
969           type: array
970           items:
971             $ref: '#/components/schemas/ModuleReferences'
972         name:
973           type: string
974           example: my_schema_set
975     ModuleReferences:
976       title: Module reference object
977       type: object
978       properties:
979         name:
980           type: string
981           example: module_reference_name
982         namespace:
983           type: string
984           example: module_reference_namespace
985         revision:
986           type: string
987           example: module_reference_revision