[cps] Fix getResourceDataForPassthroughOperational endpoint
[cps.git] / cps-ncmp-rest / docs / openapi / components.yaml
1 #  ============LICENSE_START=======================================================
2 #  Copyright (C) 2021-2022 Nordix Foundation
3 #  Modifications Copyright (C) 2021 Pantheon.tech
4 #  Modifications Copyright (C) 2022 Bell Canada
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 components:
22   schemas:
23     # Common Schemas
24     ErrorMessage:
25       type: object
26       title: Error
27       properties:
28         status:
29           type: string
30         message:
31           type: string
32         details:
33           type: string
34     # DMI Server Exception Schema
35     DmiErrorMessage:
36       title: DMI Error Message
37       type: object
38       properties:
39         message:
40           type: string
41           example: "Bad Gateway Error Message NCMP"
42         dmi-response:
43           type: object
44           properties:
45             http-code:
46               type: integer
47               example: 400
48             body:
49               type: string
50               example: Bad Request
51     # Request Schemas
52     RestDmiPluginRegistration:
53       type: object
54       properties:
55         dmiPlugin:
56           type: string
57           example: my-dmi-plugin
58           default: ""
59         dmiDataPlugin:
60           type: string
61           example: my-dmi-data-plugin
62           default: ""
63         dmiModelPlugin:
64           type: string
65           example: my-dmi-model-plugin
66           default: ""
67         createdCmHandles:
68           type: array
69           items:
70             $ref: '#/components/schemas/RestInputCmHandle'
71         updatedCmHandles:
72           type: array
73           items:
74             $ref: '#/components/schemas/RestInputCmHandle'
75             example:
76               cmHandle: my-cm-handle
77               cmHandleProperties:
78                 add-my-property: add-property
79                 update-my-property: updated-property
80                 delete-my-property: '~'
81               publicCmHandleProperties:
82                 add-my-property: add-property
83                 update-my-property: updated-property
84                 delete-my-property: '~'
85         removedCmHandles:
86           type: array
87           items:
88             type: string
89           example: [my-cm-handle1, my-cm-handle2, my-cm-handle3]
90     DmiPluginRegistrationErrorResponse:
91       type: object
92       properties:
93         failedCreatedCmHandles:
94           type: array
95           items:
96             $ref: '#/components/schemas/CmHandlerRegistrationErrorResponse'
97           example: [
98             {
99               "cmHandle": "my-cm-handle-01",
100               "errorCode": "01",
101               "errorText": "cm-handle already exists"
102             }
103           ]
104         failedUpdatedCmHandles:
105           type: array
106           items:
107             $ref: '#/components/schemas/CmHandlerRegistrationErrorResponse'
108           example: [
109             {
110               "cmHandle": "my-cm-handle-02",
111               "errorCode": "02",
112               "errorText": "cm-handle does not exist"
113             }
114           ]
115         failedRemovedCmHandles:
116           type: array
117           items:
118             $ref: '#/components/schemas/CmHandlerRegistrationErrorResponse'
119           example: [
120             {
121               "cmHandle": "my-cm-handle-02",
122               "errorCode": "02",
123               "errorText": "cm-handle does not exist"
124             }
125           ]
126     CmHandlerRegistrationErrorResponse:
127       type: object
128       properties:
129         cmHandle:
130           type: string
131           example: my-cm-handle
132         errorCode:
133           type: string
134           example: '01'
135         errorText:
136           type: string
137           example: 'cm-handle already exists'
138
139     RestInputCmHandle:
140       required:
141         - cmHandle
142       type: object
143       properties:
144         cmHandle:
145           type: string
146           example: my-cm-handle
147         cmHandleProperties:
148             $ref: '#/components/schemas/RestCmHandleProperties'
149         publicCmHandleProperties:
150             $ref: '#/components/schemas/RestCmHandleProperties'
151     RestCmHandleProperties:
152         type: object
153         additionalProperties:
154             type: string
155             example: my-property
156
157     Conditions:
158       type: object
159       properties:
160         conditions:
161           $ref: '#/components/schemas/ConditionsData'
162     ConditionsData:
163       type: array
164       items:
165         type: object
166         $ref: '#/components/schemas/ConditionProperties'
167     ConditionProperties:
168       properties:
169         name:
170           type: string
171           example: hasAllModules
172         conditionParameters:
173           $ref: '#/components/schemas/ModuleNamesAsJsonArray'
174     ModuleNamesAsJsonArray:
175       type: array
176       items:
177         type: object
178         $ref: '#/components/schemas/ModuleNameAsJsonObject'
179         example: [my-module-1, my-module-2, my-module-3]
180     ModuleNameAsJsonObject:
181         properties:
182           moduleName:
183             type: string
184             example: my-module
185
186     #Response Schemas
187     CmHandles:
188       type: object
189       properties:
190         cmHandles:
191           $ref: '#/components/schemas/CmHandleProperties'
192     CmHandleProperties:
193       type: array
194       items:
195         type: object
196         $ref: '#/components/schemas/CmHandleProperty'
197     CmHandleProperty:
198       properties:
199         cmHandleId:
200           type: string
201           example: my-cm-handle-id
202
203     RestModuleReference:
204       type: object
205       title: Module reference details
206       properties:
207         moduleName:
208           type: string
209           example: my-module-name
210         revision:
211           type: string
212           example: my-module-revision
213
214     RestOutputCmHandle:
215       type: object
216       title: CM handle Details
217       properties:
218         cmHandle:
219           type: string
220           example: my-cm-handle1
221         publicCmHandleProperties:
222           $ref: '#/components/schemas/CmHandlePublicProperties'
223     CmHandlePublicProperties:
224       type: array
225       items:
226         type: object
227         additionalProperties:
228           type: string
229           example: Book Type
230
231   examples:
232     dataSampleRequest:
233         summary: Sample request
234         description: Sample request body
235         value:
236           test:bookstore:
237             bookstore-name: Chapters
238             categories:
239               - code: '01'
240                 name: SciFi
241                 books:
242                 - authors:
243                     - Iain M. Banks
244                     - Ursula K. Le Guin
245               - code: '02'
246                 name: kids
247                 books:
248                 - authors:
249                     - Philip Pullman
250
251     dataSamplePatchRequest:
252       summary: Sample patch request
253       description: Sample patch request body
254       value:
255         ietf-restconf:yang-patch:
256           patch-id: patch-1
257           edit:
258             - edit-id: edit1
259               operation: merge
260               target: /
261               value:
262                 test:bookstore:
263                   bookstore-name: Chapters
264                   categories:
265                     - code: '01'
266                       name: Science
267                       books:
268                         - authors:
269                             - Author1
270                             - Author2
271                     - code: '02'
272                       name: Arts
273                       books:
274                         - authors:
275                             - Author3
276             - edit-id: edit2
277               operation: merge
278               target: /
279               value:
280                 test:bookstore:
281                   bookstore-name: Novels
282                   categories:
283                     - code: '03'
284                       name: History
285                       books:
286                         - authors:
287                             - Iain M. Banks
288                             - Ursula K. Le Guin
289                     - code: '04'
290                       name: Fiction
291                       books:
292                         - authors:
293                             - Philip Pullman
294
295     dataSampleResponse:
296         summary: Sample response
297         description: Sample response for selecting 'sample 1'.
298         value:
299           bookstore:
300             categories:
301               - code: '01'
302                 books:
303                   - authors:
304                       - Iain M. Banks
305                       - Ursula K. Le Guin
306                 name: SciFi
307               - code: '02'
308                 books:
309                   - authors:
310                       - Philip Pullman
311                 name: kids
312
313   parameters:
314     cmHandleInPath:
315       name: cm-handle
316       in: path
317       description: The identifier for a network function, network element, subnetwork or any other cm object by managed Network CM Proxy
318       required: true
319       schema:
320         type: string
321         example: my-cm-handle
322     xpathInQuery:
323       name: xpath
324       in: query
325       description: xpath
326       required: false
327       schema:
328         type: string
329         default: /
330     requiredXpathInQuery:
331       name: xpath
332       in: query
333       description: xpath
334       required: true
335       schema:
336         type: string
337     includeDescendantsOptionInQuery:
338       name: include-descendants
339       in: query
340       description: include-descendants
341       required: false
342       schema:
343         type: boolean
344         default: false
345     cpsPathInQuery:
346       name: cps-path
347       in: query
348       description: cps-path
349       required: false
350       schema:
351         type: string
352         default: /
353     resourceIdentifierInQuery:
354       name: resourceIdentifier
355       in: query
356       description: The format of resource identifier depend on the associated DMI Plugin implementation. For ONAP DMI Plugin it will be RESTConf paths but it can really be anything.
357       required: true
358       allowReserved: true
359       schema:
360         type: string
361       examples:
362         sample 1:
363           value:
364             resourceIdentifier: \shops\bookstore
365         sample 2:
366           value:
367             resourceIdentifier: \shops\bookstore\categories[@code=1]
368         sample 3:
369           value:
370             resourceIdentifier: parent=shops,child=bookstore
371     optionsParamInQuery:
372       name: options
373       in: query
374       description: options parameter in query, it is mandatory to wrap key(s)=value(s) in parenthesis'()'. The format of options parameter depend on the associated DMI Plugin implementation.
375       required: false
376       schema:
377         type: string
378       allowReserved: true
379       examples:
380         sample 1:
381           value:
382             options: (depth=3)
383         sample 2:
384           value:
385             options: (fields=book)
386         sample 3:
387           value:
388             options: (depth=2,fields=book/authors)
389     topicParamInQuery:
390       name: topic
391       in: query
392       description: topic parameter in query.
393       required: false
394       schema:
395         type: string
396       allowReserved: true
397       examples:
398         sample 1:
399           value:
400             topic: my-topic-name
401     contentParamInHeader:
402       name: Content-Type
403       in: header
404       required: false
405       description: Content parameter for request, if content parameter is null, default value is application/json.
406       schema:
407         type: string
408         default: application/json
409         example: application/yang-data+json
410
411   responses:
412     NotFound:
413       description: The specified resource was not found
414       content:
415         application/json:
416           schema:
417             $ref: '#/components/schemas/ErrorMessage'
418           example:
419             status: 400
420             message: Not found error message
421             details: Not found error details
422     Unauthorized:
423       description: Unauthorized
424       content:
425         application/json:
426           schema:
427             $ref: '#/components/schemas/ErrorMessage'
428           example:
429             status: 401
430             message: Unauthorized error message
431             details: Unauthorized error details
432     Forbidden:
433       description: Forbidden
434       content:
435         application/json:
436           schema:
437             $ref: '#/components/schemas/ErrorMessage'
438           example:
439            status: 403
440            message: Forbidden error message
441            details: Forbidden error details
442     BadRequest:
443       description: Bad Request
444       content:
445         application/json:
446           schema:
447             $ref: '#/components/schemas/ErrorMessage'
448           example:
449            status: 400 BAD_REQUEST
450            message: Bad request error message
451            details: Bad request error details
452     Conflict:
453       description: Conflict
454       content:
455         application/json:
456           schema:
457             $ref: '#/components/schemas/ErrorMessage'
458           example:
459            status: 409 CONFLICT
460            message: Conflict error message
461            details: Conflict error details
462     NotImplemented:
463       description: The given path has not been implemented
464       content:
465         application/json:
466           schema:
467             $ref: '#/components/schemas/ErrorMessage'
468           example:
469            status: 501
470            message: Not implemented error message
471            details: Not implemented error details
472     Ok:
473       description: OK
474       content:
475         application/json:
476           schema:
477             type: object
478     Created:
479       description: Created
480       content: {}
481     NoContent:
482       description: No Content
483       content: {}
484     InternalServerError:
485       description: Internal Server Error
486       content:
487         application/json:
488           schema:
489             $ref: "#/components/schemas/ErrorMessage"
490           example:
491             status: 500
492             message: Internal Server Error
493             details: Internal Server Error occurred
494     BadGateway:
495       description: Bad Gateway
496       content:
497         application/json:
498           schema:
499             $ref: "#/components/schemas/DmiErrorMessage"
500           example:
501             message: "Bad Gateway Error Message NCMP"
502             dmi-response:
503               http-code: 400
504               body: "Bad Request"