generating swagger-ui and controller interface using openapi.yml
[cps/cps-temporal.git] / docs / api / 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/after'
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.000000-0:00'
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/after'
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.000000-0:00'
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     after:
140       name: after
141       in: query
142       description: Fetch data after <br/> Format - 'yyyy-MM-ddTHH:mm:ss.SSSZ'
143       required: false
144       schema:
145         type: string
146         example: '2021-03-21T00:00:00.000000-0:00'
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.000000-0:00'
162     pageLimit:
163       in: query
164       name: pageLimit
165       required: false
166       schema:
167         type: integer
168         minimum: 0
169         maximum: 10000
170         default: 1000
171       description: The numbers of items to return
172     pageNumber:
173       name: pageNumber
174       in: query
175       description: Page number
176       required: false
177       schema:
178         type: integer
179         minimum: 0
180         default: 0
181     sort:
182       in: query
183       name: sort
184       required: false
185       schema:
186         type: string
187         default: timestamp:desc
188       description: "Sort by timestamp in 'asc' or 'desc' order. Supported values: <br/> timestamp:desc<br/>timestamp:asc"
189   responses:
190     BadRequest:
191       description: Bad Request
192       content:
193         application/json:
194           schema:
195             $ref: '#/components/schemas/ErrorMessage'
196     Unauthorized:
197       description: Unauthorized
198       content:
199         application/json:
200           schema:
201             $ref: '#/components/schemas/ErrorMessage'
202     Forbidden:
203       description: Forbidden
204       content:
205         application/json:
206           schema:
207             $ref: '#/components/schemas/ErrorMessage'
208   schemas:
209     AnchorDetails:
210       type: object
211       title: AnchorDetails
212       properties:
213         timestamp:
214           type: string
215           format: date-time
216           example: '2021-03-21T00:00:00.000000-0:00'
217         dataspace:
218           type: string
219           example: 'my-dataspace'
220         schemaSet:
221           type: string
222           example: 'my-schema-set'
223         anchor:
224           type: string
225           example: 'my-anchor'
226         data:
227           type: object
228           example: { "status" : "UP" }
229     AnchorHistory:
230       type: object
231       title: AnchorHistory
232       properties:
233         nextRecordsLink:
234           type: string
235           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=2
236         previousRecordsLink:
237           type: string
238           example: /v1/dataspace/dataspace-name/anchors/history?pageLimit=20&pageNumber=0
239         records:
240           type: array
241           items:
242             $ref: '#/components/schemas/AnchorDetails'
243       required:
244         - records
245     ErrorMessage:
246       type: object
247       title: Error
248       properties:
249         status:
250           type: string
251           example: 400
252         message:
253           type: string
254           example: Data could not be fetched
255         details:
256           type: string
257           example: "after parameter should have datetime value in ISO format yyyy-MM-ddTHH:mm:ss.SSSZ"