API versioning supported and added different versions for POST APIs
[cps.git] / cps-rest / docs / openapi / cpsAdmin.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021 Bell Canada.
3 # Modifications Copyright (C) 2021-2022 Nordix Foundation
4 # Modifications Copyright (C) 2022 TechMahindra Ltd.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20
21 dataspaces:
22   delete:
23     description: Delete a dataspace
24     tags:
25       - cps-admin
26     summary: Delete a dataspace
27     operationId: deleteDataspace
28     parameters:
29       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
30       - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery'
31     responses:
32       '204':
33         $ref: 'components.yml#/components/responses/NoContent'
34       '400':
35         $ref: 'components.yml#/components/responses/BadRequest'
36       '401':
37         $ref: 'components.yml#/components/responses/Unauthorized'
38       '403':
39         $ref: 'components.yml#/components/responses/Forbidden'
40       '409':
41         $ref: 'components.yml#/components/responses/Conflict'
42       '500':
43         $ref: 'components.yml#/components/responses/InternalServerError'
44
45 schemaSet:
46   get:
47     description: Read all schema sets, given a dataspace
48     tags:
49       - cps-admin
50     summary: Get schema sets
51     operationId: getSchemaSets
52     parameters:
53       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
54       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
55     responses:
56       '200':
57         description: OK
58         content:
59           application/json:
60             schema:
61               type: array
62               items:
63                 $ref: 'components.yml#/components/schemas/SchemaSetDetails'
64       '400':
65         $ref: 'components.yml#/components/responses/BadRequest'
66       '401':
67         $ref: 'components.yml#/components/responses/Unauthorized'
68       '403':
69         $ref: 'components.yml#/components/responses/Forbidden'
70       '500':
71         $ref: 'components.yml#/components/responses/InternalServerError'
72
73 schemaSetBySchemaSetName:
74   get:
75     description: Read a schema set given a schema set name and a dataspace
76     tags:
77       - cps-admin
78     summary: Get a schema set
79     operationId: getSchemaSet
80     parameters:
81       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
82       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
83       - $ref: 'components.yml#/components/parameters/schemaSetNameInPath'
84     responses:
85       '200':
86         description: OK
87         content:
88           application/json:
89             schema:
90               $ref: 'components.yml#/components/schemas/SchemaSetDetails'
91       '400':
92         $ref: 'components.yml#/components/responses/BadRequest'
93       '401':
94         $ref: 'components.yml#/components/responses/Unauthorized'
95       '403':
96         $ref: 'components.yml#/components/responses/Forbidden'
97       '500':
98         $ref: 'components.yml#/components/responses/InternalServerError'
99   delete:
100     description: Delete a schema set given a schema set name and a dataspace
101     tags:
102       - cps-admin
103     summary: Delete a schema set
104     operationId: deleteSchemaSet
105     parameters:
106       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
107       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
108       - $ref: 'components.yml#/components/parameters/schemaSetNameInPath'
109     responses:
110       '204':
111         $ref: 'components.yml#/components/responses/NoContent'
112       '400':
113         $ref: 'components.yml#/components/responses/BadRequest'
114       '401':
115         $ref: 'components.yml#/components/responses/Unauthorized'
116       '403':
117         $ref: 'components.yml#/components/responses/Forbidden'
118       '409':
119         $ref: 'components.yml#/components/responses/Conflict'
120       '500':
121         $ref: 'components.yml#/components/responses/InternalServerError'
122
123 anchorsByDataspace:
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       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
132       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
133     responses:
134       '200':
135         description: OK
136         content:
137           application/json:
138             schema:
139               type: array
140               items:
141                 $ref: 'components.yml#/components/schemas/AnchorDetails'
142       '400':
143         $ref: 'components.yml#/components/responses/BadRequest'
144       '401':
145         $ref: 'components.yml#/components/responses/Unauthorized'
146       '403':
147         $ref: 'components.yml#/components/responses/Forbidden'
148       '500':
149         $ref: 'components.yml#/components/responses/InternalServerError'
150
151 anchorByDataspaceAndAnchorName:
152   get:
153     description: Read an anchor given an anchor name and a dataspace
154     tags:
155       - cps-admin
156     summary: Get an anchor
157     operationId: getAnchor
158     parameters:
159       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
160       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
161       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
162     responses:
163       '200':
164         description: OK
165         content:
166           application/json:
167             schema:
168               $ref: 'components.yml#/components/schemas/AnchorDetails'
169       '400':
170         $ref: 'components.yml#/components/responses/BadRequest'
171       '401':
172         $ref: 'components.yml#/components/responses/Unauthorized'
173       '403':
174         $ref: 'components.yml#/components/responses/Forbidden'
175       '500':
176         $ref: 'components.yml#/components/responses/InternalServerError'
177   delete:
178     description: Delete an anchor given an anchor name and a dataspace
179     tags:
180       - cps-admin
181     summary: Delete an anchor
182     operationId: deleteAnchor
183     parameters:
184       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
185       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
186       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
187     responses:
188       '204':
189         $ref: 'components.yml#/components/responses/NoContent'
190       '400':
191         $ref: 'components.yml#/components/responses/BadRequest'
192       '401':
193         $ref: 'components.yml#/components/responses/Unauthorized'
194       '403':
195         $ref: 'components.yml#/components/responses/Forbidden'
196       '500':
197         $ref: 'components.yml#/components/responses/InternalServerError'
198
199 adminDataspaces:
200  get:
201    description: Read all dataspaces
202    tags:
203      - cps-admin
204    summary: Get all dataspaces
205    operationId: getAllDataspaces
206    parameters:
207       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
208    responses:
209      '200':
210        description: OK
211        content:
212          application/json:
213            schema:
214              type: array
215              items:
216                $ref: 'components.yml#/components/schemas/DataspaceDetails'
217      '400':
218        $ref: 'components.yml#/components/responses/BadRequest'
219      '401':
220        $ref: 'components.yml#/components/responses/Unauthorized'
221      '403':
222        $ref: 'components.yml#/components/responses/Forbidden'
223      '500':
224        $ref: 'components.yml#/components/responses/InternalServerError'
225
226 adminDataspace:
227  get:
228    description: Read a dataspace given a dataspace name
229    tags:
230      - cps-admin
231    summary: Get a dataspace
232    operationId: getDataspace
233    parameters:
234       - $ref: 'components.yml#/components/parameters/apiVersionInPath'
235       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
236    responses:
237      '200':
238        description: OK
239        content:
240          application/json:
241            schema:
242              $ref: 'components.yml#/components/schemas/DataspaceDetails'
243      '400':
244        $ref: 'components.yml#/components/responses/BadRequest'
245      '401':
246        $ref: 'components.yml#/components/responses/Unauthorized'
247      '403':
248        $ref: 'components.yml#/components/responses/Forbidden'
249      '500':
250        $ref: 'components.yml#/components/responses/InternalServerError'