blob: 868f2da810af23c8c77f017fedf441aad27711a0 [file] [log] [blame]
ToineSiebelink8593bae2024-07-01 17:50:54 +01001# ============LICENSE_START=======================================================
2# Copyright (C) 2024 Nordix Foundation
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
19openapi: 3.0.3
20info:
21 title: Policy Executor
22 description: "Allows NCMP to execute a policy defined by a third party implementation before proceeding with an operation"
23 version: 1.0.0
24servers:
25 - url: /policy-executor
26tags:
27 - name: policy-executor
28 description: "Execute all your policies"
29paths:
30 /policy-executor/api/v1/{action}:
31 post:
32 description: "Fire a Policy action"
33 operationId: executePolicyAction
34 parameters:
35 - $ref: '#/components/parameters/actionInPath'
36 requestBody:
37 required: true
38 description: "The action request body"
39 content:
40 application/3gpp-json-patch+json:
41 schema:
42 $ref: '#/components/schemas/PolicyExecutionRequest'
43 tags:
44 - policy-executor
45 responses:
46 '200':
47 description: "Successful policy execution"
48 content:
49 application/json:
50 schema:
51 $ref: '#/components/schemas/PolicyExecutionResponse'
52 '400':
53 $ref: '#/components/responses/BadRequest'
54 '403':
55 $ref: '#/components/responses/Forbidden'
56 '500':
57 $ref: '#/components/responses/InternalServerError'
58
59components:
60 securitySchemes:
61 bearerAuth:
62 type: http
63 description: "Bearer token (from client that called CPS-NCMP),used by policies to identify the client"
64 scheme: bearer
65 schemas:
66 ErrorMessage:
67 type: object
68 title: Error
69 properties:
70 status:
71 type: string
72 message:
73 type: string
74 details:
75 type: string
76
77 Payload:
78 type: object
79 properties:
80 targetFdn:
81 type: string
82 description: "The complete FDN (Fully Distinguished Name) for the element to be changed"
83 example: "/Subnetwork=Ireland/MeContext=Athlone/ManagedElement=Athlone/SomeFunction=1/Cell=12"
84 cmHandleId:
85 type: string
86 description: "The CM handle ID (optional)"
87 example: "F811AF64F5146DFC545EC60B73DE948E"
88 resourceIdentifier:
89 type: string
90 description: "The resource identifier (optional)"
91 example: "ManagedElement=Athlone/SomeFunction=1/Cell=12"
92 cmChangeRequest:
93 type: object
94 description: "The content of the change to be made"
95 example: '{"Cell":[{"id":"Cell-id","attributes":{"administrativeState":"UNLOCKED"}}]}'
96 required:
97 - targetFdn
98 - cmChangeRequest
99
100 PolicyExecutionRequest:
101 type: object
102 properties:
103 payloadType:
104 type: string
105 description: "The type of payload. Currently supported options: 'CM_Write'"
106 example: "CM_Write"
107 decisionType:
108 type: string
109 description: "The type of decision. Currently supported options: 'Allow'"
110 example: "Allow"
111 payload:
112 type: array
113 items:
114 $ref: '#/components/schemas/Payload'
115 required:
116 - payloadType
117 - decisionType
118 - payload
119
120 PolicyExecutionResponse:
121 type: object
122 properties:
123 decisionId:
124 type: string
125 description: "Unique ID for the decision (for auditing purposes)"
126 example: "550e8400-e29b-41d4-a716-446655440000"
127 decision:
128 type: string
129 description: "The decision outcome. Currently supported values: 'Allow','Deny'"
130 example: "Deny"
131 message:
132 type: string
133 description: "Additional information regarding the decision outcome"
134 example: "Object locked due to recent change"
135 required:
136 - decisionId
137 - decision
138 - message
139
140 responses:
141 NotFound:
142 description: "The specified resource was not found"
143 content:
144 application/json:
145 schema:
146 $ref: '#/components/schemas/ErrorMessage'
147 example:
148 status: 404
149 message: "Resource Not Found"
150 details: "The requested resource is not found"
151 Unauthorized:
152 description: "Unauthorized request"
153 content:
154 application/json:
155 schema:
156 $ref: '#/components/schemas/ErrorMessage'
157 example:
158 status: 401
159 message: "Unauthorized request"
160 details: "This request is unauthorized"
161 Forbidden:
162 description: "Request forbidden"
163 content:
164 application/json:
165 schema:
166 $ref: '#/components/schemas/ErrorMessage'
167 example:
168 status: 403
169 message: "Request Forbidden"
170 details: "This request is forbidden"
171 BadRequest:
172 description: "Bad request"
173 content:
174 application/json:
175 schema:
176 $ref: '#/components/schemas/ErrorMessage'
177 example:
178 status: 400
179 message: "Bad Request"
180 details: "The provided request is not valid"
181
182 InternalServerError:
183 description: "Internal server error"
184 content:
185 application/json:
186 schema:
187 $ref: '#/components/schemas/ErrorMessage'
188 example:
189 status: 500
190 message: "Internal Server Error"
191 details: "Internal server error occurred"
192
193 NotImplemented:
194 description: "Method not (yet) implemented"
195 content:
196 application/json:
197 schema:
198 $ref: '#/components/schemas/ErrorMessage'
199 example:
200 status: 501
201 message: "Not Implemented"
202 details: "Method not implemented"
203
204 parameters:
205 actionInPath:
206 name: action
207 in: path
208 description: "The policy action. Currently supported options: 'Execute'"
209 required: true
210 schema:
211 type: string
212 example: "Execute"
213security:
214 - bearerAuth: []