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