Add OpenAPI v3 specification of onboarder API
[it/dev.git] / xapp_onboarder / xapp_onboarder / xapp-onboarder-api.yaml
1 # ==================================================================================
2 #       Copyright (c) 2020 AT&T Intellectual Property.
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 openapi: 3.0.1
17 info:
18   title: RIC xApp onboarder API
19   description: APIs to manage the xApp helm charts
20   version: "1.0"
21 servers:
22 - url: /api/v1
23 tags:
24 - name: onboard
25   description: onboard xApps
26 - name: health
27   description: health check
28 - name: charts
29   description: Managing helm charts
30 paths:
31   /charts:
32     get:
33       tags:
34       - charts
35       summary: Returns the list of xApp helm charts that have been onboarded
36       operationId: get_charts_list
37       responses:
38         200:
39           description: Get helm chart list OK
40           content: {}
41         500:
42           description: Get helm chart list failed
43           content:
44             application/json:
45               schema:
46                 $ref: '#/components/schemas/error_message'
47
48   /charts/xapp/{xapp_chart_name}:
49     get:
50       tags:
51       - charts
52       summary: Returns the helm chart for the specified xApp
53       operationId: get_version_list
54       parameters:
55       - name: xapp_chart_name
56         in: path
57         required: true
58         schema:
59           type: string
60       responses:
61         200:
62           description: Get helm chart OK
63           content: {}
64         500:
65           description: Get helm chart failed
66           content:
67             application/json:
68               schema:
69                 $ref: '#/components/schemas/error_message'
70
71   /charts/xapp/{xapp_chart_name}/ver/{version}:
72     get:
73       tags:
74       - charts
75       summary: Returns the helm chart for the specified xApp and version
76       operationId: get_charts_fetcher
77       parameters:
78       - name: xapp_chart_name
79         in: path
80         required: true
81         schema:
82           type: string
83       - name: version
84         in: path
85         required: true
86         schema:
87           type: string
88       responses:
89         200:
90           description: Get helm chart package OK
91           content: {}
92         500:
93           description: Get helm chart package failed
94           content:
95             application/gzip:
96               schema:
97                 $ref: '#/components/schemas/error_message'
98
99   /charts/xapp/{xapp_chart_name}/ver/{version}/values.yaml:
100     get:
101       tags:
102       - charts
103       summary: Returns the helm values
104       description: yaml file of the specified xApp and version.
105       operationId: get_values_yaml_fetcher
106       parameters:
107       - name: xapp_chart_name
108         in: path
109         required: true
110         schema:
111           type: string
112       - name: version
113         in: path
114         required: true
115         schema:
116           type: string
117       responses:
118         200:
119           description: Get helm chart values.yaml OK
120           content: {}
121         500:
122           description: Get helm chart values.yaml failed
123           content:
124             text/x-yaml:
125               schema:
126                 $ref: '#/components/schemas/error_message'
127
128   /health:
129     get:
130       tags:
131       - health
132       summary: Returns the health condition of the xApp onboarder
133       operationId: get_health_check
134       responses:
135         200:
136           description: Health check OK
137           content:
138             application/json:
139               schema:
140                 $ref: '#/components/schemas/status'
141         500:
142           description: xApp onboarder is not ready
143           content:
144             application/json:
145               schema:
146                 $ref: '#/components/schemas/error_message'
147
148   /onboard:
149     post:
150       tags:
151       - onboard
152       summary: Onboard xApp using the xApp descriptor and schema in the request body
153       operationId: post_onboardx_apps
154       requestBody:
155         content:
156           application/json:
157             schema:
158               $ref: '#/components/schemas/descriptor'
159         required: true
160       responses:
161         201:
162           description: xApp onboard successfully.
163           content:
164             application/json:
165               schema:
166                 $ref: '#/components/schemas/status'
167         400:
168           description: xApp descriptor format error
169           content:
170             application/json:
171               schema:
172                 $ref: '#/components/schemas/error_message'
173         500:
174           description: xApp onboarder is not ready
175           content:
176             application/json:
177               schema:
178                 $ref: '#/components/schemas/error_message'
179       x-codegen-request-body-name: payload
180
181   /onboard/download:
182     post:
183       tags:
184       - onboard
185       summary: Onboard xApp after downloading the xApp descriptor and schema from
186         the URLs
187       operationId: post_onboardx_apps_download
188       requestBody:
189         content:
190           application/json:
191             schema:
192               $ref: '#/components/schemas/descriptor_remote'
193         required: true
194       responses:
195         201:
196           description: xApp onboard successfully.
197           content:
198             application/json:
199               schema:
200                 $ref: '#/components/schemas/status'
201         400:
202           description: xApp descriptor format error
203           content:
204             application/json:
205               schema:
206                 $ref: '#/components/schemas/error_message'
207         500:
208           description: xApp onboarder is not ready
209           content:
210             application/json:
211               schema:
212                 $ref: '#/components/schemas/error_message'
213       x-codegen-request-body-name: payload
214
215 components:
216   schemas:
217     descriptor:
218       required:
219       - config-file.json
220       type: object
221       properties:
222         config-file.json:
223           $ref: '#/components/schemas/config'
224         controls-schema.json:
225           type: object
226           properties: {}
227           description: Controls schema file body
228     config:
229       required:
230       - version
231       - xapp_name
232       type: object
233       properties:
234         xapp_name:
235           type: string
236           description: Name of the xApp chart
237         version:
238           pattern: ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
239           type: string
240           description: Version of the xApp chart
241     error_message:
242       required:
243       - error_message
244       - error_source
245       - status
246       type: object
247       properties:
248         error_source:
249           type: string
250           description: source of the error
251         error_message:
252           type: string
253           description: source of the error
254         status:
255           type: string
256           description: http response message
257     status:
258       required:
259       - status
260       type: object
261       properties:
262         status:
263           type: string
264           description: status of the service
265     descriptor_remote:
266       required:
267       - config-file.json_url
268       type: object
269       properties:
270         config-file.json_url:
271           type: string
272           description: URL to download the config-file.json file
273         controls-schema.json_url:
274           type: string
275           description: URL to download the controls schema.json file
276   responses:
277     MaskError:
278       description: When any error occurs on mask
279       content: {}
280     ParseError:
281       description: When a mask can't be parsed
282       content: {}