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