blob: f80b99836901d759ba29bc740e1986f8c79d0b09 [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'
ToineSiebelink53375822024-07-29 17:45:52 +010055 '401':
56 $ref: '#/components/responses/Unauthorized'
ToineSiebelink8593bae2024-07-01 17:50:54 +010057 '403':
58 $ref: '#/components/responses/Forbidden'
59 '500':
60 $ref: '#/components/responses/InternalServerError'
61
62components:
63 securitySchemes:
64 bearerAuth:
65 type: http
66 description: "Bearer token (from client that called CPS-NCMP),used by policies to identify the client"
67 scheme: bearer
68 schemas:
69 ErrorMessage:
70 type: object
71 title: Error
72 properties:
73 status:
74 type: string
75 message:
76 type: string
77 details:
78 type: string
79
ToineSiebelink53375822024-07-29 17:45:52 +010080 Request:
ToineSiebelink8593bae2024-07-01 17:50:54 +010081 type: object
82 properties:
ToineSiebelink53375822024-07-29 17:45:52 +010083 schema:
ToineSiebelink8593bae2024-07-01 17:50:54 +010084 type: string
ToineSiebelink53375822024-07-29 17:45:52 +010085 description: "The schema for the data in this request. The schema name should include the type of operation"
86 example: "org.onap.cps.ncmp.policy-executor:ncmp-create-schema:1.0.0"
87 data:
ToineSiebelink8593bae2024-07-01 17:50:54 +010088 type: object
ToineSiebelink53375822024-07-29 17:45:52 +010089 description: "The data related to the request. The format of the object is determined by the schema"
ToineSiebelink8593bae2024-07-01 17:50:54 +010090 required:
ToineSiebelink53375822024-07-29 17:45:52 +010091 - schema
92 - data
ToineSiebelink8593bae2024-07-01 17:50:54 +010093
94 PolicyExecutionRequest:
95 type: object
96 properties:
ToineSiebelink8593bae2024-07-01 17:50:54 +010097 decisionType:
98 type: string
ToineSiebelink53375822024-07-29 17:45:52 +010099 description: "The type of decision. Currently supported options: 'allow'"
100 example: "allow"
101 requests:
ToineSiebelink8593bae2024-07-01 17:50:54 +0100102 type: array
103 items:
ToineSiebelink53375822024-07-29 17:45:52 +0100104 $ref: '#/components/schemas/Request'
ToineSiebelink8593bae2024-07-01 17:50:54 +0100105 required:
ToineSiebelink8593bae2024-07-01 17:50:54 +0100106 - decisionType
ToineSiebelink53375822024-07-29 17:45:52 +0100107 - requests
ToineSiebelink8593bae2024-07-01 17:50:54 +0100108
109 PolicyExecutionResponse:
110 type: object
111 properties:
112 decisionId:
113 type: string
114 description: "Unique ID for the decision (for auditing purposes)"
115 example: "550e8400-e29b-41d4-a716-446655440000"
116 decision:
117 type: string
ToineSiebelink53375822024-07-29 17:45:52 +0100118 description: "The decision outcome. Currently supported values: 'allow','deny'"
ToineSiebelinkd7914bc2024-07-04 15:15:36 +0100119 example: "deny"
ToineSiebelink8593bae2024-07-01 17:50:54 +0100120 message:
121 type: string
122 description: "Additional information regarding the decision outcome"
123 example: "Object locked due to recent change"
124 required:
125 - decisionId
126 - decision
127 - message
128
129 responses:
ToineSiebelink53375822024-07-29 17:45:52 +0100130 BadRequest:
131 description: "Bad request"
ToineSiebelink8593bae2024-07-01 17:50:54 +0100132 content:
133 application/json:
134 schema:
135 $ref: '#/components/schemas/ErrorMessage'
136 example:
ToineSiebelink53375822024-07-29 17:45:52 +0100137 status: 400
138 message: "Bad Request"
139 details: "The provided request is not valid"
ToineSiebelink8593bae2024-07-01 17:50:54 +0100140 Unauthorized:
141 description: "Unauthorized request"
142 content:
143 application/json:
144 schema:
145 $ref: '#/components/schemas/ErrorMessage'
146 example:
147 status: 401
148 message: "Unauthorized request"
149 details: "This request is unauthorized"
150 Forbidden:
151 description: "Request forbidden"
152 content:
153 application/json:
154 schema:
155 $ref: '#/components/schemas/ErrorMessage'
156 example:
157 status: 403
158 message: "Request Forbidden"
159 details: "This request is forbidden"
ToineSiebelink8593bae2024-07-01 17:50:54 +0100160
161 InternalServerError:
162 description: "Internal server error"
163 content:
164 application/json:
165 schema:
166 $ref: '#/components/schemas/ErrorMessage'
167 example:
168 status: 500
169 message: "Internal Server Error"
170 details: "Internal server error occurred"
171
172 NotImplemented:
173 description: "Method not (yet) implemented"
174 content:
175 application/json:
176 schema:
177 $ref: '#/components/schemas/ErrorMessage'
178 example:
179 status: 501
180 message: "Not Implemented"
181 details: "Method not implemented"
182
183 parameters:
184 actionInPath:
185 name: action
186 in: path
ToineSiebelinkd7914bc2024-07-04 15:15:36 +0100187 description: "The policy action. Currently supported options: 'execute'"
ToineSiebelink8593bae2024-07-01 17:50:54 +0100188 required: true
189 schema:
190 type: string
ToineSiebelinkd7914bc2024-07-04 15:15:36 +0100191 example: "execute"
192 authorizationInHeader:
193 name: Authorization
194 in: header
ToineSiebelink49629222024-07-10 09:24:22 +0100195 description: "Bearer token may be used to identify client as part of a policy"
ToineSiebelinkd7914bc2024-07-04 15:15:36 +0100196 schema:
197 type: string
198
ToineSiebelink8593bae2024-07-01 17:50:54 +0100199security:
200 - bearerAuth: []