5480fbe578765aa147789c88de03898f33c859bb
[sim/a1-interface.git] / near-rt-ric-simulator / test / KAFKA_DISPATCHER / api / KAFKA_DISPATCHER_api.yaml
1 openapi: 3.0.0
2 info:
3   title: 'Kafka message dispatcher for A1 interface'
4   version: 2.0.0
5   description: |
6     Kafka message dispatcher server.
7     © 2022, O-RAN Alliance.
8     All rights reserved.
9 externalDocs:
10   description: 'RestFUL APIs that create and dispatch Kafka messages to Kafka brokers'
11   url: 'https://docs.o-ran-sc.org/projects/o-ran-sc-sim-a1-interface/en/latest/index.html'
12 servers:
13   - url: '{apiRoot}'
14     variables:
15       apiRoot:
16         default: 'https://example.com'
17 paths:
18   '/policytypetotopicmapping/{policyTypeId}':
19     parameters:
20       - name: policyTypeId
21         in: path
22         required: true
23         schema:
24           "$ref": "#/components/schemas/PolicyTypeId"
25     get:
26       operationId: dispatcher.get_policy_type_to_topic_mapping
27       description: 'Get the kafka request and response topic map corresponding to policy type'
28       tags:
29       - The mapping from policy type to kafka topic request and response object
30       responses:
31         200:
32           description: 'The policy type to topic map schemas'
33           content:
34             application/json:
35               schema:
36                 "$ref": "#/components/schemas/PolicyTypeToTopicMap"
37         404:
38           "$ref": "#/components/responses/404-NotFound"
39         429:
40           "$ref": "#/components/responses/429-TooManyRequests"
41         503:
42           "$ref": "#/components/responses/503-ServiceUnavailable"
43
44   '/policytypes/{policyTypeId}/kafkadispatcher/{policyId}':
45     parameters:
46       - name: policyTypeId
47         in: path
48         required: true
49         schema:
50           "$ref": "#/components/schemas/PolicyTypeId"
51       - name: policyId
52         in: path
53         required: true
54         schema:
55           "$ref": "#/components/schemas/A1PolicyId"
56     put:
57       operationId: dispatcher.put_policy
58       description: 'Dispatch create and update operation as kafka message to kafka cluster'
59       tags:
60       - Individual policy Object
61       requestBody:
62         required: true
63         content:
64           application/json:
65             schema:
66               "$ref": "#/components/schemas/A1PolicyObject"
67       responses:
68         200:
69           description: 'Create or update operation dispatched'
70         400:
71           "$ref": "#/components/responses/400-BadRequest"
72         408:
73           "$ref": "#/components/responses/408-RequestTimeout"
74         419:
75           "$ref": "#/components/responses/419-KafkaMessagePublishFailed"
76         429:
77           "$ref": "#/components/responses/429-TooManyRequests"
78         503:
79           "$ref": "#/components/responses/503-ServiceUnavailable"
80         507:
81           "$ref": "#/components/responses/507-InsufficientStorage"
82     delete:
83       operationId: dispatcher.delete_policy
84       description: 'Dispatch policy delete opertion as kafka message to kafka cluster'
85       responses:
86         200:
87           description: 'Delete operation dispatched'
88         408:
89           "$ref": "#/components/responses/408-RequestTimeout"
90         419:
91           "$ref": "#/components/responses/419-KafkaMessagePublishFailed"
92         429:
93           "$ref": "#/components/responses/429-TooManyRequests"
94         503:
95           "$ref": "#/components/responses/503-ServiceUnavailable"
96
97   '/policytypes/{policyTypeId}/kafkadispatcher/{policyId}/status':
98     parameters:
99       - name: policyTypeId
100         in: path
101         required: true
102         schema:
103           "$ref": "#/components/schemas/PolicyTypeId"
104       - name: policyId
105         in: path
106         required: true
107         schema:
108           "$ref": "#/components/schemas/A1PolicyId"
109     get:
110       operationId: dispatcher.get_policy_status
111       description: 'Dispatch policy status query opertion as kafka message to kafka cluster'
112       tags:
113       - Individual A1 Policy Status Object
114       responses:
115         200:
116           description: 'Query policy status operation dispatched'
117         429:
118           "$ref": "#/components/responses/429-TooManyRequests"
119         503:
120           "$ref": "#/components/responses/503-ServiceUnavailable"
121
122 components:
123   schemas:
124     #
125     # Representation objects
126     #
127     A1PolicyObject:
128       description: 'A generic policy object'
129       type: object
130
131     A1Policy:
132       description: 'A generic policy string'
133       type: string
134
135     PolicyTypeToTopicMap:
136       description: 'Request and response topic map for each policy type'
137       type: object
138       properties:
139         policy_type:
140           type: object
141           properties:
142             request_topic:
143               type: string
144               example: kafkatopicreq
145             response_topic:
146               type: string
147               example: kafkatopicres
148
149     ProblemDetails:
150       description: 'A problem detail to carry details in a HTTP response according to RFC 7807'
151       type: object
152       properties:
153         type:
154           type: string
155         title:
156           type: string
157         status:
158           type: number
159         detail:
160           type: string
161         instance:
162           type: string
163
164     #
165     # Simple data types
166     #
167     JsonSchema:
168       description: 'A JSON schema following http://json-schema.org/draft-07/schema'
169       type: object
170
171     A1PolicyId:
172       description: 'A1 policy identifier.'
173       type: string
174
175     PolicyTypeId:
176       description: 'Policy type identifier assigned by the A1-P Provider'
177       type: string
178
179   responses:
180     400-BadRequest:
181       description: 'A1 policy not properly formulated or not related to the method'
182       content:
183         application/problem+json:
184           schema:
185             "$ref": "#/components/schemas/ProblemDetails"
186
187     404-NotFound:
188       description: 'No resource found at the URI'
189       content:
190         application/problem+json:
191           schema:
192             "$ref": "#/components/schemas/ProblemDetails"
193
194     405-MethodNotAllowed:
195       description: 'Method not allowed for the URI'
196       content:
197         application/problem+json:
198           schema:
199             "$ref": "#/components/schemas/ProblemDetails"
200
201     408-RequestTimeout:
202       description: 'Request could not be processed in given amount of time'
203       content:
204         application/problem+json:
205           schema:
206             "$ref": "#/components/schemas/ProblemDetails"
207
208     409-Conflict:
209       description: 'Request could not be processed in the current state of the resource'
210       content:
211         application/problem+json:
212           schema:
213             "$ref": "#/components/schemas/ProblemDetails"
214
215     419-KafkaMessagePublishFailed:
216       description: 'Publishing the kafka message to the broker gets fail'
217       content:
218         application/problem+json:
219           schema:
220             "$ref": "#/components/schemas/ProblemDetails"
221
222     429-TooManyRequests:
223       description: 'Too many requests have been sent in a given amount of time'
224       content:
225         application/problem+json:
226           schema:
227             "$ref": "#/components/schemas/ProblemDetails"
228
229     503-ServiceUnavailable:
230       description: 'The provider is currently unable to handle the request due to a temporary overload'
231       content:
232         application/problem+json:
233           schema:
234             "$ref": "#/components/schemas/ProblemDetails"
235
236     507-InsufficientStorage:
237       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'
238       content:
239         application/problem+json:
240           schema:
241             "$ref": "#/components/schemas/ProblemDetails"