7c7a10dc19daec2c7bbbbbc2e9068e53a46b9987
[cps/cps-temporal.git] / docs / _static / openapi / swagger / openapi.yml
1 # ============LICENSE_START=======================================================
2 # Copyright (c) 2021-2022 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 openapi: 3.0.1
20 info:
21   title: ONAP Open API v3 Configuration Persistence Service - Temporal
22   description: CPS-Temporal is time-series database for network data
23   version: 1.0.0
24   contact:
25     name: ONAP
26     url: 'https://onap.readthedocs.io'
27     email: onap-discuss@lists.onap.org
28   license:
29     name: Apache 2.0
30     url: 'http://www.apache.org/licenses/LICENSE-2.0'
31   x-planned-retirement-date: '202212'
32   x-component: Modeling
33 servers:
34   - url: '/cps-temporal/api'
35 tags:
36   - name: cps-temporal-query
37     description: CPS Temporal Query
38 paths:
39   '/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/history':
40     get:
41       description: 'Read the data for the specified anchor based on filter criteria provided in query parameters'
42       tags:
43         - cps-temporal-query
44       summary: Get anchor data by name
45       operationId: getAnchorDataByName
46       parameters:
47         - $ref: '#/components/parameters/dataspaceName'
48         - name: anchor-name
49           in: path
50           description: Anchor Name
51           required: true
52           schema:
53             type: string
54             example: my-anchor
55         - $ref: '#/components/parameters/observedTimestampAfter'
56         - $ref: '#/components/parameters/simplePayloadFilter'
57         - $ref: '#/components/parameters/pointInTime'
58         - $ref: '#/components/parameters/pageNumber'
59         - $ref: '#/components/parameters/pageLimit'
60         - $ref: '#/components/parameters/sort'
61       responses:
62         '200':
63           description: OK
64           content:
65             application/json:
66               schema:
67                 $ref: '#/components/schemas/AnchorHistory'
68               example:
69                 nextRecordsLink: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=2
70                 previousRecordsLink: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=0
71                 records:
72                   - timestamp: '2021-03-21T00:00:00.000-0000'
73                     dataspace: my-dataspace
74                     schemaSet: my-schema-set
75                     anchor: my-anchor
76                     data:
77                       status: UP
78         '400':
79           $ref: '#/components/responses/BadRequest'
80         '401':
81           $ref: '#/components/responses/Unauthorized'
82         '403':
83           $ref: '#/components/responses/Forbidden'
84         '500':
85           $ref: '#/components/responses/InternalServerError'
86   '/v1/dataspaces/{dataspace-name}/anchors/history':
87     get:
88       description: 'Read anchors data based on filter criteria provided in query parameters'
89       tags:
90         - cps-temporal-query
91       summary: Get anchors data based on filter criteria
92       operationId: getAnchorsDataByFilter
93       parameters:
94         - $ref: '#/components/parameters/dataspaceName'
95         - name: schema-set-name
96           in: query
97           description: Schema-set name
98           required: true
99           schema:
100             type: string
101         - $ref: '#/components/parameters/observedTimestampAfter'
102         - $ref: '#/components/parameters/simplePayloadFilter'
103         - $ref: '#/components/parameters/pointInTime'
104         - $ref: '#/components/parameters/pageNumber'
105         - $ref: '#/components/parameters/pageLimit'
106         - $ref: '#/components/parameters/sort'
107       responses:
108         '200':
109           description: OK
110           content:
111             application/json:
112               schema:
113                 $ref: '#/components/schemas/AnchorHistory'
114               example:
115                 nextRecordsLink: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=2
116                 previousRecordsLink: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=0
117                 records:
118                   - timestamp: '2021-03-21T00:00:00.000-0000'
119                     dataspace: my-dataspace
120                     schemaSet: my-schema-set
121                     anchor: my-anchor
122                     data:
123                       status: UP
124
125         '400':
126           $ref: '#/components/responses/BadRequest'
127         '401':
128           $ref: '#/components/responses/Unauthorized'
129         '403':
130           $ref: '#/components/responses/Forbidden'
131         '500':
132           $ref: '#/components/responses/InternalServerError'
133 components:
134   parameters:
135     dataspaceName:
136       name: dataspace-name
137       in: path
138       description: Dataspace Name
139       required: true
140       schema:
141         type: string
142     observedTimestampAfter:
143       name: observedTimestampAfter
144       in: query
145       description: Fetch data with observed timestamp after <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
146       required: false
147       schema:
148         type: string
149         example: '2021-03-21T00:00:00.000-0000'
150     simplePayloadFilter:
151       name: simplePayloadFilter
152       in: query
153       description: Payload filter
154       required: false
155       schema:
156         type: string
157     pointInTime:
158       name: pointInTime
159       in: query
160       description: Consider data modified before <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
161       required: false
162       schema:
163         type: string
164         example: '2021-03-21T00:00:00.000-0000'
165     pageLimit:
166       in: query
167       name: pageLimit
168       required: false
169       schema:
170         type: integer
171         minimum: 0
172         default: 1000
173       description: The numbers of items to return
174     pageNumber:
175       name: pageNumber
176       in: query
177       description: Page number
178       required: false
179       schema:
180         type: integer
181         minimum: 0
182         default: 0
183     sort:
184       in: query
185       name: sort
186       required: false
187       schema:
188         type: string
189         default: observed_timestamp:desc
190       description: "Sort by timestamp in 'asc' or 'desc' order. Supported values: <br/>observed_timestamp:desc<br/>anchor:asc,observed_timestamp:desc"
191   responses:
192     BadRequest:
193       description: Bad Request
194       content:
195         application/json:
196           schema:
197             $ref: '#/components/schemas/ErrorMessage'
198           example:
199             status: 400
200             message: Bad request error message
201             details: Bad request error details
202     Unauthorized:
203       description: Unauthorized
204       content:
205         application/json:
206           schema:
207             $ref: '#/components/schemas/ErrorMessage'
208           example:
209             status: 401
210             message: Unauthorized error message
211             details: Unauthorized error details
212     Forbidden:
213       description: Forbidden
214       content:
215         application/json:
216           schema:
217             $ref: '#/components/schemas/ErrorMessage'
218           example:
219             status: 403
220             message: Forbidden error message
221             details: Forbidden error details
222     InternalServerError:
223       description: Internal Server Error
224       content:
225         application/json:
226           schema:
227             $ref: "#/components/schemas/ErrorMessage"
228           example:
229             status: 500
230             message: Internal Server Error
231             details: Internal Server Error occurred
232   schemas:
233     AnchorDetails:
234       type: object
235       title: AnchorDetails
236       properties:
237         observedTimestamp:
238           type: string
239           example: '2021-03-21T00:00:00.000-0000'
240         operation:
241           type: string
242           enum: [CREATE, UPDATE, DELETE]
243           example: UPDATE
244         dataspace:
245           type: string
246           example: 'my-dataspace'
247         schemaSet:
248           type: string
249           example: 'my-schema-set'
250         anchor:
251           type: string
252           example: 'my-anchor'
253         data:
254           type: object
255           example: { "status" : "UP" }
256     AnchorHistory:
257       type: object
258       title: AnchorHistory
259       properties:
260         nextRecordsLink:
261           type: string
262           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=2
263         previousRecordsLink:
264           type: string
265           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=0
266         records:
267           type: array
268           items:
269             $ref: '#/components/schemas/AnchorDetails'
270       required:
271         - records
272     ErrorMessage:
273       type: object
274       title: Error
275       properties:
276         status:
277           type: string
278           example: 400
279         message:
280           type: string
281           example: Data could not be fetched
282         details:
283           type: string
284           example: "after parameter should have datetime value in ISO format yyyy-MM-ddTHH:mm:ss.SSSZ"