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