Change mail list from main@ to discuss@lists.o-ran-sc.org
[sim/a1-interface.git] / near-rt-ric-simulator / api / 1.1.x-alpha.2 / a1-openapi.yaml
1 openapi: 3.0.0
2 info:
3   title: 'A1-P Policy Management Service'
4   version: 1.1.x-alpha.2
5   description: |
6     API for Policy Management Service.
7     © 2019, O-RAN Alliance.
8     All rights reserved.
9 externalDocs:
10   description: 'ORAN-WG2.A1.AP-v01.01 A1 interface: Application protocol'
11   url: 'https://www.o-ran.org/specifications'
12 servers:
13   - url: '{apiRoot}/A1-P/v1'
14     variables:
15       apiRoot:
16         default: 'https://example.com'
17         description: 'apiRoot as defined in clause 4.2.1 in ORAN-WG2.A1.AP'
18 paths:
19   '/policies':
20     get:
21       operationId: a1.get_all_policy_identities
22       description: 'Get all policy identities'
23       tags:
24       - All Policy Identities
25       parameters:
26         - name: policyTypeId
27           in: query
28           required: false
29           schema:
30             "$ref": "#/components/schemas/PolicyTypeId"
31       responses:
32         200:
33           description: 'Array of all policy identities'
34           content:
35             application/json:
36               schema:
37                 type: array
38                 items:
39                   "$ref": "#/components/schemas/PolicyId"
40                 minItems: 0
41         429:
42           "$ref": "#/components/responses/429-TooManyRequests"
43         503:
44           "$ref": "#/components/responses/503-ServiceUnavailable"
45
46   '/policies/{policyId}':
47     parameters:
48       - name: policyId
49         in: path
50         required: true
51         schema:
52           "$ref": "#/components/schemas/PolicyId"
53     put:
54       operationId: a1.put_policy
55       description: 'Create, or update, a policy'
56       tags:
57       - Individual Policy Object
58       parameters:
59         - name: policyTypeId
60           in: query
61           required: false
62           schema:
63             "$ref": "#/components/schemas/PolicyTypeId"
64       requestBody:
65         content:
66           application/json:
67             schema:
68               "$ref": "#/components/schemas/PolicyObject"
69       responses:
70         200:
71           description: 'The policy was updated'
72           content:
73             application/json:
74               schema:
75                 "$ref": "#/components/schemas/PolicyObject"
76         201:
77           description: 'The policy was created'
78           content:
79             application/json:
80               schema:
81                 "$ref": "#/components/schemas/PolicyObject"
82           headers:
83             Location:
84               description: 'Contains the URI of the created policy'
85               required: true
86               schema:
87                 type: string
88         400:
89           "$ref": "#/components/responses/400-BadRequest"
90         429:
91           "$ref": "#/components/responses/429-TooManyRequests"
92         503:
93           "$ref": "#/components/responses/503-ServiceUnavailable"
94         507:
95           "$ref": "#/components/responses/507-InsufficientStorage"
96     get:
97       operationId: a1.get_policy
98       description: 'Query a policy'
99       tags:
100       - Individual Policy Object
101       responses:
102         200:
103           description: 'The requested policy'
104           content:
105             application/json:
106               schema:
107                 "$ref": "#/components/schemas/PolicyObject"
108         404:
109           "$ref": "#/components/responses/404-NotFound"
110         429:
111           "$ref": "#/components/responses/429-TooManyRequests"
112         503:
113           "$ref": "#/components/responses/503-ServiceUnavailable"
114     delete:
115       operationId: a1.delete_policy
116       description: 'Delete a policy'
117       tags:
118       - Individual Policy Object
119       responses:
120         204:
121           description: 'The policy was deleted'
122         404:
123           "$ref": "#/components/responses/404-NotFound"
124         429:
125           "$ref": "#/components/responses/429-TooManyRequests"
126         503:
127           "$ref": "#/components/responses/503-ServiceUnavailable"
128
129   '/policystatus/{policyId}':
130     parameters:
131       - name: policyId
132         in: path
133         required: true
134         schema:
135           "$ref": "#/components/schemas/PolicyId"
136     get:
137       operationId: a1.get_policy_status
138       description: 'Query a policy status'
139       tags:
140       - Individual Policy Status Object
141       responses:
142         200:
143           description: 'The requested policy status'
144           content:
145             application/json:
146               schema:
147                 "$ref": "#/components/schemas/PolicyStatusObject"
148         404:
149           "$ref": "#/components/responses/404-NotFound"
150         429:
151           "$ref": "#/components/responses/429-TooManyRequests"
152         503:
153           "$ref": "#/components/responses/503-ServiceUnavailable"
154
155   '/policytypes':
156     get:
157       operationId: a1.get_all_policytypes_identities
158       description: 'Get all policy type identities'
159       tags:
160       - All Policy Type Identities
161       responses:
162         200:
163           description: 'Array of all policy type identities'
164           content:
165             application/json:
166               schema:
167                 type: array
168                 items:
169                   "$ref": "#/components/schemas/PolicyTypeId"
170                 minItems: 0
171         429:
172           "$ref": "#/components/responses/429-TooManyRequests"
173         503:
174           "$ref": "#/components/responses/503-ServiceUnavailable"
175
176   '/policytypes/{policyTypeId}':
177     parameters:
178       - name: policyTypeId
179         in: path
180         required: true
181         schema:
182           "$ref": "#/components/schemas/PolicyTypeId"
183     get:
184       operationId: a1.get_policytypes
185       description: 'Get the schemas for a policy type'
186       tags:
187       - Individual Policy Type
188       responses:
189         200:
190           description: 'The policy type schemas'
191           content:
192             application/json:
193               schema:
194                 "$ref": "#/components/schemas/PolicyTypeObject"
195         404:
196           "$ref": "#/components/responses/404-NotFound"
197         429:
198           "$ref": "#/components/responses/429-TooManyRequests"
199         503:
200           "$ref": "#/components/responses/503-ServiceUnavailable"
201
202 components:
203   schemas:
204     #
205     # Representation objects
206     #
207     PolicyObject:
208       description: 'A generic policy object that can be used to transport any policy. Additionally, a policy shall be valid according to the schema of its specific policy type.'
209       type: object
210
211     PolicyStatusObject:
212       description: 'A generic policy status object that can be used to transport any policy status. Additionally, a policy status shall be valid according to the schema of its specific policy type.'
213       type: object
214
215     PolicyTypeObject:
216       description: 'A definition of a policy type, i.e. the schemas for a policy respectively its status'
217       type: object
218       properties:
219         policySchema:
220           "$ref": "#/components/schemas/JsonSchema"
221         statusSchema:
222           "$ref": "#/components/schemas/JsonSchema"
223       required:
224         - policySchema
225
226     ProblemDetails:
227       description: 'A problem detail to carry details in a HTTP response according to RFC 7807 extended with A1 specific attributes'
228       type: object
229       properties:
230         type:
231           type: string
232         title:
233           type: string
234         status:
235           type: number
236         detail:
237           type: string
238         instance:
239           type: string
240         cause:
241           type: string
242         invalidParams:
243           type: array
244           items:
245             "$ref": "#/components/schemas/InvalidParam"
246           minItems: 1
247
248     #
249     # Structured data types
250     #
251     InvalidParam:
252       description: 'Used in a ProblemDetails to indicate a specific invalid parameter'
253       type: object
254       properties:
255         param:
256           type: string
257         reason:
258           type: string
259       required:
260         - param
261
262     #
263     # Simple data types
264     #
265     JsonSchema:
266       description: 'A JSON schema following http://json-schema.org/draft-07/schema'
267       type: object
268
269     PolicyId:
270       description: 'Policy identifier assigned by the A1-P Consumer when a policy is created'
271       type: string
272
273     PolicyTypeId:
274       description: 'Policy type identifier assigned by the A1-P Provider'
275       type: string
276
277   responses:
278     400-BadRequest:
279       description: 'Object in payload not properly formulated or not related to the method'
280       content:
281         application/problem+json:
282           schema:
283             "$ref": "#/components/schemas/ProblemDetails"
284
285     404-NotFound:
286       description: 'No resource found at the URI'
287       content:
288         application/problem+json:
289           schema:
290             "$ref": "#/components/schemas/ProblemDetails"
291
292     405-MethodNotAllowed:
293       description: 'Method not allowed for the URI'
294       content:
295         application/problem+json:
296           schema:
297             "$ref": "#/components/schemas/ProblemDetails"
298
299     429-TooManyRequests:
300       description: 'Too many requests have been sent in a given amount of time'
301       content:
302         application/problem+json:
303           schema:
304             "$ref": "#/components/schemas/ProblemDetails"
305
306     503-ServiceUnavailable:
307       description: 'The provider is currently unable to handle the request due to a temporary overload'
308       content:
309         application/problem+json:
310           schema:
311             "$ref": "#/components/schemas/ProblemDetails"
312
313     507-InsufficientStorage:
314       description: 'The method could not be performed on the resource because the provider is unable to store the representation needed to successfully complete the request'
315       content:
316         application/problem+json:
317           schema:
318             "$ref": "#/components/schemas/ProblemDetails"