991d807a4f5dbe54e287733faad3d5a13f9b01d9
[cps/cps-temporal.git] / openapi / swagger / openapi.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 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         - $ref: '#/components/parameters/observedTimestampAfter'
55         - $ref: '#/components/parameters/simplePayloadFilter'
56         - $ref: '#/components/parameters/pointInTime'
57         - $ref: '#/components/parameters/pageNumber'
58         - $ref: '#/components/parameters/pageLimit'
59         - $ref: '#/components/parameters/sort'
60       responses:
61         '200':
62           description: OK
63           content:
64             application/json:
65               schema:
66                 $ref: '#/components/schemas/AnchorHistory'
67               example:
68                 nextRecordsLink: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=2
69                 previousRecordsLink: /v1/dataspace/my-dataspace/anchors/my-anchor/history?pageLimit=20&pageNumber=0
70                 records:
71                   - timestamp: '2021-03-21T00:00:00.000-0000'
72                     dataspace: my-dataspace
73                     schemaSet: my-schema-set
74                     anchor: my-anchor
75                     data:
76                       status: UP
77
78
79         '400':
80           $ref: '#/components/responses/BadRequest'
81         '401':
82           $ref: '#/components/responses/Unauthorized'
83         '403':
84           $ref: '#/components/responses/Forbidden'
85   '/v1/dataspaces/{dataspace-name}/anchors/history':
86     get:
87       description: 'Read anchors data based on filter criteria provided in query parameters'
88       tags:
89         - cps-temporal-query
90       summary: Get anchors data based on filter criteria
91       operationId: getAnchorsDataByFilter
92       parameters:
93         - $ref: '#/components/parameters/dataspaceName'
94         - name: schema-set-name
95           in: query
96           description: Schema-set name
97           required: true
98           schema:
99             type: string
100         - $ref: '#/components/parameters/observedTimestampAfter'
101         - $ref: '#/components/parameters/simplePayloadFilter'
102         - $ref: '#/components/parameters/pointInTime'
103         - $ref: '#/components/parameters/pageNumber'
104         - $ref: '#/components/parameters/pageLimit'
105         - $ref: '#/components/parameters/sort'
106       responses:
107         '200':
108           description: OK
109           content:
110             application/json:
111               schema:
112                 $ref: '#/components/schemas/AnchorHistory'
113               example:
114                 nextRecordsLink: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=2
115                 previousRecordsLink: /v1/dataspace/my-dataspace/anchors/history?pageLimit=20&pageNumber=0
116                 records:
117                   - timestamp: '2021-03-21T00:00:00.000-0000'
118                     dataspace: my-dataspace
119                     schemaSet: my-schema-set
120                     anchor: my-anchor
121                     data:
122                       status: UP
123
124         '400':
125           $ref: '#/components/responses/BadRequest'
126         '401':
127           $ref: '#/components/responses/Unauthorized'
128         '403':
129           $ref: '#/components/responses/Forbidden'
130 components:
131   parameters:
132     dataspaceName:
133       name: dataspace-name
134       in: path
135       description: Dataspace Name
136       required: true
137       schema:
138         type: string
139     observedTimestampAfter:
140       name: observedTimestampAfter
141       in: query
142       description: Fetch data with observed timestamp after <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
143       required: false
144       schema:
145         type: string
146         example: '2021-03-21T00:00:00.000-0000'
147     simplePayloadFilter:
148       name: simplePayloadFilter
149       in: query
150       description: Payload filter
151       required: false
152       schema:
153         type: string
154     pointInTime:
155       name: pointInTime
156       in: query
157       description: Consider data modified before <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
158       required: false
159       schema:
160         type: string
161         example: '2021-03-21T00:00:00.000-0000'
162     pageLimit:
163       in: query
164       name: pageLimit
165       required: false
166       schema:
167         type: integer
168         minimum: 0
169         default: 1000
170       description: The numbers of items to return
171     pageNumber:
172       name: pageNumber
173       in: query
174       description: Page number
175       required: false
176       schema:
177         type: integer
178         minimum: 0
179         default: 0
180     sort:
181       in: query
182       name: sort
183       required: false
184       schema:
185         type: string
186         default: observed_timestamp:desc
187       description: "Sort by timestamp in 'asc' or 'desc' order. Supported values: <br/>observed_timestamp:desc<br/>anchor:asc,observed_timestamp:desc"
188   responses:
189     BadRequest:
190       description: Bad Request
191       content:
192         application/json:
193           schema:
194             $ref: '#/components/schemas/ErrorMessage'
195     Unauthorized:
196       description: Unauthorized
197       content:
198         application/json:
199           schema:
200             $ref: '#/components/schemas/ErrorMessage'
201     Forbidden:
202       description: Forbidden
203       content:
204         application/json:
205           schema:
206             $ref: '#/components/schemas/ErrorMessage'
207   schemas:
208     AnchorDetails:
209       type: object
210       title: AnchorDetails
211       properties:
212         observedTimestamp:
213           type: string
214           example: '2021-03-21T00:00:00.000-0000'
215         dataspace:
216           type: string
217           example: 'my-dataspace'
218         schemaSet:
219           type: string
220           example: 'my-schema-set'
221         anchor:
222           type: string
223           example: 'my-anchor'
224         data:
225           type: object
226           example: { "status" : "UP" }
227     AnchorHistory:
228       type: object
229       title: AnchorHistory
230       properties:
231         nextRecordsLink:
232           type: string
233           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=2
234         previousRecordsLink:
235           type: string
236           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=0
237         records:
238           type: array
239           items:
240             $ref: '#/components/schemas/AnchorDetails'
241       required:
242         - records
243     ErrorMessage:
244       type: object
245       title: Error
246       properties:
247         status:
248           type: string
249           example: 400
250         message:
251           type: string
252           example: Data could not be fetched
253         details:
254           type: string
255           example: "after parameter should have datetime value in ISO format yyyy-MM-ddTHH:mm:ss.SSSZ"