c00d6ff6cb11f756a4dbc13167a2c2d594ea8ab4
[cps.git] / docs / api / swagger / openapi.yml
1 #  ============LICENSE_START=======================================================
2 #  Copyright (C) 2021 Nordix Foundation
3 #  ================================================================================
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #        http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15 #
16 #  SPDX-License-Identifier: Apache-2.0
17 #  ============LICENSE_END=========================================================
18
19 openapi: 3.0.1
20 info:
21   title: ONAP Open API v3 Configuration Persistence Service
22   description: Configuration Persistence Service is a Model Driven Generic Database
23   version: 1.0.0
24   contact:
25     name: ONAP
26     url: 'https://onap.readthedocs.io'
27     email: onap-discuss@lists.onap.org
28   license:
29     name: Apache 2.0
30     url: 'http://www.apache.org/licenses/LICENSE-2.0'
31   x-planned-retirement-date: '202212'
32   x-component: Modeling
33   x-logo:
34     url: cps_logo.png
35 servers:
36   - url: '//localhost:8088'
37 tags:
38   - name: cps-admin
39     description: cps Admin
40   - name: cps-data
41     description: cps Data
42 paths:
43   /v1/dataspaces:
44     post:
45       description: Create a new dataspace
46       tags:
47         - cps-admin
48       summary: Create a dataspace
49       operationId: createDataspace
50       parameters:
51         - name: dataspace-name
52           in: query
53           description: dataspace-name
54           required: true
55           schema:
56             type: string
57       responses:
58         '201':
59           description: Created
60           content:
61             text/plain:
62               schema:
63                 type: string
64         '400':
65           description: Bad Request
66           content:
67             application/json:
68               schema:
69                 $ref: '#/components/schemas/ErrorMessage'
70         '401':
71           description: Unauthorized
72           content:
73             application/json:
74               schema:
75                 $ref: '#/components/schemas/ErrorMessage'
76         '403':
77           description: Forbidden
78           content:
79             application/json:
80               schema:
81                 $ref: '#/components/schemas/ErrorMessage'
82   '/v1/dataspaces/{dataspace-name}':
83     delete:
84       description: Delete the given dataspace - DRAFT
85       tags:
86         - cps-admin
87       summary: Delete a dataspace
88       operationId: deleteDataspace
89       parameters:
90         - name: dataspace-name
91           in: path
92           description: dataspace-name
93           required: true
94           schema:
95             type: string
96       responses:
97         '200':
98           description: OK
99           content:
100             application/json:
101               schema:
102                 type: object
103         '204':
104           description: No Content
105           content: {}
106         '400':
107           description: Bad Request
108           content:
109             application/json:
110               schema:
111                 $ref: '#/components/schemas/ErrorMessage'
112         '401':
113           description: Unauthorized
114           content:
115             application/json:
116               schema:
117                 $ref: '#/components/schemas/ErrorMessage'
118         '403':
119           description: Forbidden
120           content:
121             application/json:
122               schema:
123                 $ref: '#/components/schemas/ErrorMessage'
124   '/v1/dataspaces/{dataspace-name}/anchors':
125     get:
126       description: 'Read all anchors, given a dataspace'
127       tags:
128         - cps-admin
129       summary: Get anchors
130       operationId: getAnchors
131       parameters:
132         - name: dataspace-name
133           in: path
134           description: dataspace-name
135           required: true
136           schema:
137             type: string
138       responses:
139         '200':
140           description: OK
141           content:
142             application/json:
143               schema:
144                 type: object
145         '400':
146           description: Bad Request
147           content:
148             application/json:
149               schema:
150                 $ref: '#/components/schemas/ErrorMessage'
151         '401':
152           description: Unauthorized
153           content:
154             application/json:
155               schema:
156                 $ref: '#/components/schemas/ErrorMessage'
157         '403':
158           description: Forbidden
159           content:
160             application/json:
161               schema:
162                 $ref: '#/components/schemas/ErrorMessage'
163         '404':
164           description: The specified resource was not found
165           content:
166             application/json:
167               schema:
168                 $ref: '#/components/schemas/ErrorMessage'
169     post:
170       description: Create a new anchor in the given dataspace
171       tags:
172         - cps-admin
173       summary: Create an anchor
174       operationId: createAnchor
175       parameters:
176         - name: dataspace-name
177           in: path
178           description: dataspace-name
179           required: true
180           schema:
181             type: string
182         - name: schema-set-name
183           in: query
184           description: schema-set-name
185           required: true
186           schema:
187             type: string
188         - name: anchor-name
189           in: query
190           description: anchor-name
191           required: true
192           schema:
193             type: string
194       responses:
195         '201':
196           description: Created
197           content:
198             text/plain:
199               schema:
200                 type: string
201         '400':
202           description: Bad Request
203           content:
204             application/json:
205               schema:
206                 $ref: '#/components/schemas/ErrorMessage'
207         '401':
208           description: Unauthorized
209           content:
210             application/json:
211               schema:
212                 $ref: '#/components/schemas/ErrorMessage'
213         '403':
214           description: Forbidden
215           content:
216             application/json:
217               schema:
218                 $ref: '#/components/schemas/ErrorMessage'
219   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}':
220     get:
221       description: Read an anchor given an anchor name and a dataspace
222       tags:
223         - cps-admin
224       summary: Get an anchor
225       operationId: getAnchor
226       parameters:
227         - name: dataspace-name
228           in: path
229           description: dataspace-name
230           required: true
231           schema:
232             type: string
233         - name: anchor-name
234           in: path
235           description: anchor-name
236           required: true
237           schema:
238             type: string
239       responses:
240         '200':
241           description: OK
242           content:
243             application/json:
244               schema:
245                 type: object
246         '400':
247           description: Bad Request
248           content:
249             application/json:
250               schema:
251                 $ref: '#/components/schemas/ErrorMessage'
252         '401':
253           description: Unauthorized
254           content:
255             application/json:
256               schema:
257                 $ref: '#/components/schemas/ErrorMessage'
258         '403':
259           description: Forbidden
260           content:
261             application/json:
262               schema:
263                 $ref: '#/components/schemas/ErrorMessage'
264         '404':
265           description: The specified resource was not found
266           content:
267             application/json:
268               schema:
269                 $ref: '#/components/schemas/ErrorMessage'
270     delete:
271       description: Delete an anchor given an anchor name and a dataspace - DRAFT
272       tags:
273         - cps-admin
274       summary: Delete an anchor
275       operationId: deleteAnchor
276       parameters:
277         - name: dataspace-name
278           in: path
279           description: dataspace-name
280           required: true
281           schema:
282             type: string
283         - name: anchor-name
284           in: path
285           description: anchor-name
286           required: true
287           schema:
288             type: string
289       responses:
290         '200':
291           description: OK
292           content:
293             application/json:
294               schema:
295                 type: object
296         '204':
297           description: No Content
298           content: {}
299         '400':
300           description: Bad Request
301           content:
302             application/json:
303               schema:
304                 $ref: '#/components/schemas/ErrorMessage'
305         '401':
306           description: Unauthorized
307           content:
308             application/json:
309               schema:
310                 $ref: '#/components/schemas/ErrorMessage'
311         '403':
312           description: Forbidden
313           content:
314             application/json:
315               schema:
316                 $ref: '#/components/schemas/ErrorMessage'
317   '/v1/dataspaces/{dataspace-name}/schema-sets':
318     post:
319       description: Create a new schema set in the given dataspace
320       tags:
321         - cps-admin
322       summary: Create a schema set
323       operationId: createSchemaSet
324       parameters:
325         - name: dataspace-name
326           in: path
327           description: dataspace-name
328           required: true
329           schema:
330             type: string
331         - name: schema-set-name
332           in: query
333           description: schema-set-name
334           required: true
335           schema:
336             type: string
337       requestBody:
338         required: true
339         content:
340           multipart/form-data:
341             schema:
342               required:
343                 - file
344               properties:
345                 multipartFile:
346                   type: string
347                   description: multipartFile
348                   format: binary
349                   example: 'http://example.com/examples/example.yang'
350       responses:
351         '201':
352           description: Created
353           content:
354             text/plain:
355               schema:
356                 type: string
357         '400':
358           description: Bad Request
359           content:
360             application/json:
361               schema:
362                 $ref: '#/components/schemas/ErrorMessage'
363         '401':
364           description: Unauthorized
365           content:
366             application/json:
367               schema:
368                 $ref: '#/components/schemas/ErrorMessage'
369         '403':
370           description: Forbidden
371           content:
372             application/json:
373               schema:
374                 $ref: '#/components/schemas/ErrorMessage'
375   '/v1/dataspaces/{dataspace-name}/schema-sets/{schema-set-name}':
376     get:
377       description: Read a schema set given a schema set name and a dataspace
378       tags:
379         - cps-admin
380       summary: Get a schema set
381       operationId: getSchemaSet
382       parameters:
383         - name: dataspace-name
384           in: path
385           description: dataspace-name
386           required: true
387           schema:
388             type: string
389         - name: schema-set-name
390           in: path
391           description: schema-set-name
392           required: true
393           schema:
394             type: string
395       responses:
396         '200':
397           description: OK
398           content:
399             application/json:
400               schema:
401                 type: object
402         '400':
403           description: Bad Request
404           content:
405             application/json:
406               schema:
407                 $ref: '#/components/schemas/ErrorMessage'
408         '401':
409           description: Unauthorized
410           content:
411             application/json:
412               schema:
413                 $ref: '#/components/schemas/ErrorMessage'
414         '403':
415           description: Forbidden
416           content:
417             application/json:
418               schema:
419                 $ref: '#/components/schemas/ErrorMessage'
420         '404':
421           description: The specified resource was not found
422           content:
423             application/json:
424               schema:
425                 $ref: '#/components/schemas/ErrorMessage'
426     delete:
427       description: Delete a schema set given a schema set name and a dataspace
428       tags:
429         - cps-admin
430       summary: Delete a schema set
431       operationId: deleteSchemaSet
432       parameters:
433         - name: dataspace-name
434           in: path
435           description: dataspace-name
436           required: true
437           schema:
438             type: string
439         - name: schema-set-name
440           in: path
441           description: schema-set-name
442           required: true
443           schema:
444             type: string
445       responses:
446         '204':
447           description: No Content
448           content: {}
449         '400':
450           description: Bad Request
451           content:
452             application/json:
453               schema:
454                 $ref: '#/components/schemas/ErrorMessage'
455         '401':
456           description: Unauthorized
457           content:
458             application/json:
459               schema:
460                 $ref: '#/components/schemas/ErrorMessage'
461         '403':
462           description: Forbidden
463           content:
464             application/json:
465               schema:
466                 $ref: '#/components/schemas/ErrorMessage'
467         '409':
468           description: Conflict
469           content:
470             application/json:
471               schema:
472                 $ref: '#/components/schemas/ErrorMessage'
473   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node':
474     get:
475       description: >-
476         Get a node with an option to retrieve all the children for a given
477         anchor and dataspace
478       tags:
479         - cps-data
480       summary: Get a node
481       operationId: getNodeByDataspaceAndAnchor
482       parameters:
483         - name: dataspace-name
484           in: path
485           description: dataspace-name
486           required: true
487           schema:
488             type: string
489         - name: anchor-name
490           in: path
491           description: anchor-name
492           required: true
493           schema:
494             type: string
495         - name: xpath
496           in: query
497           description: xpath
498           required: false
499           schema:
500             type: string
501             default: /
502         - name: include-descendants
503           in: query
504           description: include-descendants
505           required: false
506           schema:
507             type: boolean
508             default: false
509       responses:
510         '200':
511           description: OK
512           content:
513             application/json:
514               schema:
515                 type: object
516         '400':
517           description: Bad Request
518           content:
519             application/json:
520               schema:
521                 $ref: '#/components/schemas/ErrorMessage'
522         '401':
523           description: Unauthorized
524           content:
525             application/json:
526               schema:
527                 $ref: '#/components/schemas/ErrorMessage'
528         '403':
529           description: Forbidden
530           content:
531             application/json:
532               schema:
533                 $ref: '#/components/schemas/ErrorMessage'
534         '404':
535           description: The specified resource was not found
536           content:
537             application/json:
538               schema:
539                 $ref: '#/components/schemas/ErrorMessage'
540       x-codegen-request-body-name: xpath
541   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes':
542     post:
543       description: Create a node for a given anchor and dataspace
544       tags:
545         - cps-data
546       summary: Create a node
547       operationId: createNode
548       parameters:
549         - name: dataspace-name
550           in: path
551           description: dataspace-name
552           required: true
553           schema:
554             type: string
555         - name: anchor-name
556           in: path
557           description: anchor-name
558           required: true
559           schema:
560             type: string
561       requestBody:
562         required: true
563         content:
564           application/json:
565             schema:
566               type: string
567       responses:
568         '201':
569           description: Created
570           content:
571             text/plain:
572               schema:
573                 type: string
574         '400':
575           description: Bad Request
576           content:
577             application/json:
578               schema:
579                 $ref: '#/components/schemas/ErrorMessage'
580         '401':
581           description: Unauthorized
582           content:
583             application/json:
584               schema:
585                 $ref: '#/components/schemas/ErrorMessage'
586         '403':
587           description: Forbidden
588           content:
589             application/json:
590               schema:
591                 $ref: '#/components/schemas/ErrorMessage'
592     patch:
593       description: >-
594         Update a data node leaves for a given dataspace and anchor and a parent
595         node xpath
596       tags:
597         - cps-data
598       summary: Update node leaves
599       operationId: updateNodeLeaves
600       parameters:
601         - name: dataspace-name
602           in: path
603           description: dataspace-name
604           required: true
605           schema:
606             type: string
607         - name: anchor-name
608           in: path
609           description: anchor-name
610           required: true
611           schema:
612             type: string
613         - name: xpath
614           in: query
615           description: xpath
616           required: false
617           schema:
618             type: string
619             default: /
620       requestBody:
621         required: true
622         content:
623           application/json:
624             schema:
625               type: string
626       responses:
627         '200':
628           description: OK
629           content:
630             application/json:
631               schema:
632                 type: object
633         '400':
634           description: Bad Request
635           content:
636             application/json:
637               schema:
638                 $ref: '#/components/schemas/ErrorMessage'
639         '401':
640           description: Unauthorized
641           content:
642             application/json:
643               schema:
644                 $ref: '#/components/schemas/ErrorMessage'
645         '403':
646           description: Forbidden
647           content:
648             application/json:
649               schema:
650                 $ref: '#/components/schemas/ErrorMessage'
651     put:
652       description: >-
653         Replace a node with descendants for a given dataspace, anchor and a
654         parent node xpath
655       tags:
656         - cps-data
657       summary: Replace a node with descendants
658       operationId: replaceNode
659       parameters:
660         - name: dataspace-name
661           in: path
662           description: dataspace-name
663           required: true
664           schema:
665             type: string
666         - name: anchor-name
667           in: path
668           description: anchor-name
669           required: true
670           schema:
671             type: string
672         - name: xpath
673           in: query
674           description: xpath
675           required: false
676           schema:
677             type: string
678             default: /
679       requestBody:
680         required: true
681         content:
682           application/json:
683             schema:
684               type: string
685       responses:
686         '200':
687           description: OK
688           content:
689             application/json:
690               schema:
691                 type: object
692         '400':
693           description: Bad Request
694           content:
695             application/json:
696               schema:
697                 $ref: '#/components/schemas/ErrorMessage'
698         '401':
699           description: Unauthorized
700           content:
701             application/json:
702               schema:
703                 $ref: '#/components/schemas/ErrorMessage'
704         '403':
705           description: Forbidden
706           content:
707             application/json:
708               schema:
709                 $ref: '#/components/schemas/ErrorMessage'
710   '/v1/dataspaces/{dataspace-name}/nodes':
711     get:
712       description: >-
713         Get all nodes for a given dataspace using an xpath or schema node
714         identifier - DRAFT
715       tags:
716         - cps-data
717       summary: Get nodes
718       operationId: getNodesByDataspace
719       parameters:
720         - name: dataspace-name
721           in: path
722           description: dataspace-name
723           required: true
724           schema:
725             type: string
726       responses:
727         '200':
728           description: OK
729           content:
730             application/json:
731               schema:
732                 type: object
733         '400':
734           description: Bad Request
735           content:
736             application/json:
737               schema:
738                 $ref: '#/components/schemas/ErrorMessage'
739         '401':
740           description: Unauthorized
741           content:
742             application/json:
743               schema:
744                 $ref: '#/components/schemas/ErrorMessage'
745         '403':
746           description: Forbidden
747           content:
748             application/json:
749               schema:
750                 $ref: '#/components/schemas/ErrorMessage'
751         '404':
752           description: The specified resource was not found
753           content:
754             application/json:
755               schema:
756                 $ref: '#/components/schemas/ErrorMessage'
757       x-codegen-request-body-name: requestBody
758   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query':
759     get:
760       description: Query data nodes for the given dataspace and anchor using CPS path
761       tags:
762         - cps-query
763       summary: Query data nodes
764       operationId: getNodesByDataspaceAndAnchorAndCpsPath
765       parameters:
766         - name: dataspace-name
767           in: path
768           description: dataspace-name
769           required: true
770           schema:
771             type: string
772         - name: anchor-name
773           in: path
774           description: anchor-name
775           required: true
776           schema:
777             type: string
778         - name: cps-path
779           in: query
780           description: cps-path
781           required: false
782           schema:
783             type: string
784             default: /
785         - name: include-descendants
786           in: query
787           description: include-descendants
788           required: false
789           schema:
790             type: boolean
791             default: false
792       responses:
793         '200':
794           description: OK
795           content:
796             application/json:
797               schema:
798                 type: object
799         '400':
800           description: Bad Request
801           content:
802             application/json:
803               schema:
804                 $ref: '#/components/schemas/ErrorMessage'
805         '401':
806           description: Unauthorized
807           content:
808             application/json:
809               schema:
810                 $ref: '#/components/schemas/ErrorMessage'
811         '403':
812           description: Forbidden
813           content:
814             application/json:
815               schema:
816                 $ref: '#/components/schemas/ErrorMessage'
817         '404':
818           description: The specified resource was not found
819           content:
820             application/json:
821               schema:
822                 $ref: '#/components/schemas/ErrorMessage'
823       x-codegen-request-body-name: xpath
824 components:
825   schemas:
826     ErrorMessage:
827       type: object
828       title: Error
829       properties:
830         status:
831           type: string
832           example: 400
833         message:
834           type: string
835           example: Dataspace not found
836         details:
837           type: string
838           example: Dataspace with name D1 does not exist.