CPS-723: Add Examples in the NCMP openapi
[cps.git] / cps-ncmp-rest / docs / openapi / ncmp.yml
1 #  ============LICENSE_START=======================================================
2 #  Copyright (C) 2021 Nordix Foundation
3 #  Modifications Copyright (C) 2021 Pantheon.tech
4 #  Modifications Copyright (C) 2021 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 nodeByCmHandleAndXpath:
22   get:
23     description: Get a node with an option to retrieve all the children for a given cm Handle
24     deprecated: true
25     tags:
26       - network-cm-proxy
27     summary: Get a node given a cm Handle and xpath
28     operationId: getNodeByCmHandleAndXpath
29     parameters:
30       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
31       - $ref: 'components.yaml#/components/parameters/xpathInQuery'
32       - $ref: 'components.yaml#/components/parameters/includeDescendantsOptionInQuery'
33     responses:
34       200:
35         $ref: 'components.yaml#/components/responses/Ok'
36       400:
37         $ref: 'components.yaml#/components/responses/BadRequest'
38       401:
39         $ref: 'components.yaml#/components/responses/Unauthorized'
40       403:
41         $ref: 'components.yaml#/components/responses/Forbidden'
42       404:
43         $ref: 'components.yaml#/components/responses/NotFound'
44
45 nodesByCmHandleAndCpsPath:
46   get:
47     description: Query nodes for the given cps path and cm Handle
48     deprecated: true
49     tags:
50       - network-cm-proxy
51     summary: Query data nodes
52     operationId: queryNodesByCmHandleAndCpsPath
53     parameters:
54       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
55       - $ref: 'components.yaml#/components/parameters/cpsPathInQuery'
56       - $ref: 'components.yaml#/components/parameters/includeDescendantsOptionInQuery'
57     responses:
58       200:
59         $ref: 'components.yaml#/components/responses/Ok'
60       400:
61         $ref: 'components.yaml#/components/responses/BadRequest'
62       401:
63         $ref: 'components.yaml#/components/responses/Unauthorized'
64       403:
65         $ref: 'components.yaml#/components/responses/Forbidden'
66       404:
67         $ref: 'components.yaml#/components/responses/NotFound'
68
69 nodesByCmHandleAndXpath:
70   post:
71     description: Create a node with descendants for the given CM Handle; top level or under existing node (requires xpath)
72     deprecated: true
73     tags:
74       - network-cm-proxy
75     summary: Create a node with descendants
76     operationId: createNode
77     parameters:
78       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
79       - $ref: 'components.yaml#/components/parameters/xpathInQuery'
80     requestBody:
81       required: true
82       content:
83         application/json:
84           schema:
85             type: string
86     responses:
87       201:
88         $ref: 'components.yaml#/components/responses/Created'
89       400:
90         $ref: 'components.yaml#/components/responses/BadRequest'
91       401:
92         $ref: 'components.yaml#/components/responses/Unauthorized'
93       403:
94         $ref: 'components.yaml#/components/responses/Forbidden'
95       404:
96         $ref: 'components.yaml#/components/responses/NotFound'
97
98   patch:
99     description: Update node leaves for the given cps path and cm Handle
100     deprecated: true
101     tags:
102       - network-cm-proxy
103     summary: Update node leaves
104     operationId: updateNodeLeaves
105     parameters:
106       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
107       - $ref: 'components.yaml#/components/parameters/xpathInQuery'
108     requestBody:
109       required: true
110       content:
111         application/json:
112           schema:
113             type: string
114     responses:
115       200:
116         $ref: 'components.yaml#/components/responses/Ok'
117       400:
118         $ref: 'components.yaml#/components/responses/BadRequest'
119       401:
120         $ref: 'components.yaml#/components/responses/Unauthorized'
121       403:
122         $ref: 'components.yaml#/components/responses/Forbidden'
123       404:
124         $ref: 'components.yaml#/components/responses/NotFound'
125
126   put:
127     description: Replace a node with descendants for the given cps path and cm Handle
128     deprecated: true
129     tags:
130       - network-cm-proxy
131     summary: Replace a node with descendants
132     operationId: replaceNode
133     parameters:
134       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
135       - $ref: 'components.yaml#/components/parameters/xpathInQuery'
136     requestBody:
137       required: true
138       content:
139         application/json:
140           schema:
141             type: string
142     responses:
143       200:
144         $ref: 'components.yaml#/components/responses/Ok'
145       400:
146         $ref: 'components.yaml#/components/responses/BadRequest'
147       401:
148         $ref: 'components.yaml#/components/responses/Unauthorized'
149       403:
150         $ref: 'components.yaml#/components/responses/Forbidden'
151       404:
152         $ref: 'components.yaml#/components/responses/NotFound'
153
154 listNodeByCmHandleAndXpath:
155   post:
156     description: Add one or more list-node child elements under existing node for the given CM Handle
157     deprecated: true
158     tags:
159       - network-cm-proxy
160     summary: Add list-node child element(s)
161     operationId: addListNodeElements
162     parameters:
163       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
164       - $ref: 'components.yaml#/components/parameters/requiredXpathInQuery'
165     requestBody:
166       required: true
167       content:
168         application/json:
169           schema:
170             type: string
171     responses:
172       201:
173         $ref: 'components.yaml#/components/responses/Created'
174       400:
175         $ref: 'components.yaml#/components/responses/BadRequest'
176       401:
177         $ref: 'components.yaml#/components/responses/Unauthorized'
178       403:
179         $ref: 'components.yaml#/components/responses/Forbidden'
180       404:
181         $ref: 'components.yaml#/components/responses/NotFound'
182
183 getResourceDataForPassthroughOperational:
184   get:
185     tags:
186       - network-cm-proxy
187     summary: Get resource data from pass-through operational for cm handle
188     description: Get resource data from pass-through operational for given cm handle
189     operationId: getResourceDataOperationalForCmHandle
190     parameters:
191       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
192       - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery'
193       - $ref: 'components.yaml#/components/parameters/acceptParamInHeader'
194       - $ref: 'components.yaml#/components/parameters/optionsParamInQuery'
195     responses:
196       200:
197         description: OK
198         content:
199           application/json:
200             schema:
201               type: object
202             examples:
203               dataSampleResponse:
204                 $ref: 'components.yaml#/components/examples/dataSampleResponse'
205       400:
206         $ref: 'components.yaml#/components/responses/BadRequest'
207       401:
208         $ref: 'components.yaml#/components/responses/Unauthorized'
209       403:
210         $ref: 'components.yaml#/components/responses/Forbidden'
211       404:
212         $ref: 'components.yaml#/components/responses/NotFound'
213
214 resourceDataForPassthroughRunning:
215   get:
216     tags:
217       - network-cm-proxy
218     summary: Get resource data from pass-through running for cm handle
219     description: Get resource data from pass-through running for given cm handle
220     operationId: getResourceDataRunningForCmHandle
221     parameters:
222       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
223       - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery'
224       - $ref: 'components.yaml#/components/parameters/acceptParamInHeader'
225       - $ref: 'components.yaml#/components/parameters/optionsParamInQuery'
226     responses:
227       200:
228         description: OK
229         content:
230           application/json:
231             schema:
232               type: object
233             examples:
234               dataSampleResponse:
235                 $ref: 'components.yaml#/components/examples/dataSampleResponse'
236       400:
237         $ref: 'components.yaml#/components/responses/BadRequest'
238       401:
239         $ref: 'components.yaml#/components/responses/Unauthorized'
240       403:
241         $ref: 'components.yaml#/components/responses/Forbidden'
242       404:
243         $ref: 'components.yaml#/components/responses/NotFound'
244   post:
245     tags:
246       - network-cm-proxy
247     summary: create resource data from pass-through running for cm handle
248     description: create resource data from pass-through running for given cm handle
249     operationId: createResourceDataRunningForCmHandle
250     parameters:
251       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
252       - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery'
253       - $ref: 'components.yaml#/components/parameters/contentParamInHeader'
254     requestBody:
255       required: true
256       content:
257         application/json:
258           schema:
259             type: string
260           examples:
261             dataSampleRequest:
262               $ref: 'components.yaml#/components/examples/dataSampleRequest'
263         application/yang-data+json:
264           schema:
265             type: string
266     responses:
267       201:
268         $ref: 'components.yaml#/components/responses/Created'
269       400:
270         $ref: 'components.yaml#/components/responses/BadRequest'
271       401:
272         $ref: 'components.yaml#/components/responses/Unauthorized'
273       403:
274         $ref: 'components.yaml#/components/responses/Forbidden'
275       404:
276         $ref: 'components.yaml#/components/responses/NotFound'
277
278   put:
279     tags:
280       - network-cm-proxy
281     summary: Update resource data from pass-through running for a cm handle
282     description: Update resource data from pass-through running for the given cm handle
283     operationId: updateResourceDataRunningForCmHandle
284     parameters:
285       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
286       - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery'
287       - $ref: 'components.yaml#/components/parameters/contentParamInHeader'
288     requestBody:
289       required: true
290       content:
291         application/json:
292           schema:
293             type: string
294           examples:
295             dataSampleRequest:
296               $ref: 'components.yaml#/components/examples/dataSampleRequest'
297         application/yang-data+json:
298           schema:
299             type: string
300     responses:
301       200:
302         $ref: 'components.yaml#/components/responses/Ok'
303       400:
304         $ref: 'components.yaml#/components/responses/BadRequest'
305       401:
306         $ref: 'components.yaml#/components/responses/Unauthorized'
307       403:
308         $ref: 'components.yaml#/components/responses/Forbidden'
309       404:
310         $ref: 'components.yaml#/components/responses/NotFound'
311
312 fetchModuleReferencesByCmHandle:
313   get:
314     description: fetch all module references (name and revision) for a given cm handle
315     tags:
316       - network-cm-proxy
317     summary: Fetch all module references (name and revision) for a given cm handle
318     operationId: getModuleReferencesByCmHandle
319     parameters:
320       - $ref: 'components.yaml#/components/parameters/cmHandleInPath'
321     responses:
322       200:
323         description: OK
324         content:
325           application/json:
326             schema:
327               type: object
328             examples:
329               moduleReferencesResponse:
330                 summary: Sample response
331                 value:
332                   - moduleName: my-module-name
333                     revision: yyyy-mm-dd
334                   - moduleName: my-module-name-2
335                     revision: yyyy-mm-dd
336       400:
337         $ref: 'components.yaml#/components/responses/BadRequest'
338       401:
339         $ref: 'components.yaml#/components/responses/Unauthorized'
340       403:
341         $ref: 'components.yaml#/components/responses/Forbidden'
342       404:
343         $ref: 'components.yaml#/components/responses/NotFound'
344
345 executeCmHandleSearch:
346   post:
347     description: Execute cm handle searches using 'hasAllModules' condition to get all cm handles for the given module names
348     tags:
349       - network-cm-proxy
350     summary: Execute cm handle search using the available conditions
351     operationId: executeCmHandleSearch
352     requestBody:
353       required: true
354       content:
355         application/json:
356           schema:
357             $ref: 'components.yaml#/components/schemas/Conditions'
358     responses:
359       200:
360         description: OK
361         content:
362           application/json:
363             schema:
364               $ref: 'components.yaml#/components/schemas/CmHandles'
365       400:
366         $ref: 'components.yaml#/components/responses/BadRequest'
367       401:
368         $ref: 'components.yaml#/components/responses/Unauthorized'
369       403:
370         $ref: 'components.yaml#/components/responses/Forbidden'