a022ef1d943c02e2955be6578944e10c3516f0ac
[cps.git] / cps-rest / docs / openapi / cpsAdmin.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021 Bell Canada.
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 dataspaces:
20   post:
21     description: Create a new dataspace
22     tags:
23       - cps-admin
24     summary: Create a dataspace
25     operationId: createDataspace
26     parameters:
27       - $ref: 'components.yml#/components/parameters/dataspaceNameInQuery'
28     responses:
29       '201':
30         $ref: 'components.yml#/components/responses/Created'
31       '400':
32         $ref: 'components.yml#/components/responses/BadRequest'
33       '401':
34         $ref: 'components.yml#/components/responses/Unauthorized'
35       '403':
36         $ref: 'components.yml#/components/responses/Forbidden'
37
38 schemaSet:
39   post:
40     description: Create a new schema set in the given dataspace
41     tags:
42       - cps-admin
43     summary: Create a schema set
44     operationId: createSchemaSet
45     parameters:
46       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
47       - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery'
48     requestBody:
49       required: true
50       content:
51         multipart/form-data:
52           schema:
53             $ref: 'components.yml#/components/schemas/MultipartFile'
54
55     responses:
56       '201':
57         $ref: 'components.yml#/components/responses/Created'
58       '400':
59         $ref: 'components.yml#/components/responses/BadRequest'
60       '401':
61         $ref: 'components.yml#/components/responses/Unauthorized'
62       '403':
63         $ref: 'components.yml#/components/responses/Forbidden'
64
65 schemaSetBySchemaSetName:
66   get:
67     description: Read a schema set given a schema set name and a dataspace
68     tags:
69       - cps-admin
70     summary: Get a schema set
71     operationId: getSchemaSet
72     parameters:
73       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
74       - $ref: 'components.yml#/components/parameters/schemaSetNameInPath'
75     responses:
76       '200':
77         description: OK
78         content:
79           application/json:
80             schema:
81               $ref: 'components.yml#/components/schemas/SchemaSetDetails'
82       '400':
83         $ref: 'components.yml#/components/responses/BadRequest'
84       '401':
85         $ref: 'components.yml#/components/responses/Unauthorized'
86       '403':
87         $ref: 'components.yml#/components/responses/Forbidden'
88       '404':
89         $ref: 'components.yml#/components/responses/NotFound'
90
91   delete:
92     description: Delete a schema set given a schema set name and a dataspace
93     tags:
94       - cps-admin
95     summary: Delete a schema set
96     operationId: deleteSchemaSet
97     parameters:
98       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
99       - $ref: 'components.yml#/components/parameters/schemaSetNameInPath'
100     responses:
101       '204':
102         $ref: 'components.yml#/components/responses/NoContent'
103       '400':
104         $ref: 'components.yml#/components/responses/BadRequest'
105       '401':
106         $ref: 'components.yml#/components/responses/Unauthorized'
107       '403':
108         $ref: 'components.yml#/components/responses/Forbidden'
109       '409':
110         $ref: 'components.yml#/components/responses/Conflict'
111
112 anchorsByDataspace:
113   get:
114     description: Read all anchors, given a dataspace
115     tags:
116       - cps-admin
117     summary: Get anchors
118     operationId: getAnchors
119     parameters:
120       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
121     responses:
122       '200':
123         description: OK
124         content:
125           application/json:
126             schema:
127               type: array
128               items:
129                 $ref: 'components.yml#/components/schemas/AnchorDetails'
130       '400':
131         $ref: 'components.yml#/components/responses/BadRequest'
132       '401':
133         $ref: 'components.yml#/components/responses/Unauthorized'
134       '403':
135         $ref: 'components.yml#/components/responses/Forbidden'
136       '404':
137         $ref: 'components.yml#/components/responses/NotFound'
138
139   post:
140     description: Create a new anchor in the given dataspace
141     tags:
142       - cps-admin
143     summary: Create an anchor
144     operationId: createAnchor
145     parameters:
146       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
147       - $ref: 'components.yml#/components/parameters/schemaSetNameInQuery'
148       - $ref: 'components.yml#/components/parameters/anchorNameInQuery'
149     responses:
150       '201':
151         $ref: 'components.yml#/components/responses/Created'
152       '400':
153         $ref: 'components.yml#/components/responses/BadRequest'
154       '401':
155         $ref: 'components.yml#/components/responses/Unauthorized'
156       '403':
157         $ref: 'components.yml#/components/responses/Forbidden'
158
159 anchorByDataspaceAndAnchorName:
160   get:
161     description: Read an anchor given an anchor name and a dataspace
162     tags:
163       - cps-admin
164     summary: Get an anchor
165     operationId: getAnchor
166     parameters:
167       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
168       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
169     responses:
170       '200':
171         description: OK
172         content:
173           application/json:
174             schema:
175               $ref: 'components.yml#/components/schemas/AnchorDetails'
176       '400':
177         $ref: 'components.yml#/components/responses/BadRequest'
178       '401':
179         $ref: 'components.yml#/components/responses/Unauthorized'
180       '403':
181         $ref: 'components.yml#/components/responses/Forbidden'
182       '404':
183         $ref: 'components.yml#/components/responses/NotFound'
184
185   delete:
186     description: Delete an anchor given an anchor name and a dataspace
187     tags:
188       - cps-admin
189     summary: Delete an anchor
190     operationId: deleteAnchor
191     parameters:
192       - $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
193       - $ref: 'components.yml#/components/parameters/anchorNameInPath'
194     responses:
195       '204':
196         $ref: 'components.yml#/components/responses/NoContent'
197       '400':
198         $ref: 'components.yml#/components/responses/BadRequest'
199       '401':
200         $ref: 'components.yml#/components/responses/Unauthorized'
201       '403':
202         $ref: 'components.yml#/components/responses/Forbidden'