Search for a Specific Policy With Policy Identifier
This endpoint searches for the specified policy using Policy Identifier Parameters as a composite key.
POST /openapi/v1/policies/search
The query body consists of a JSON body with the following schema:
Name |
Type |
Description |
---|---|---|
application_id |
string |
The ID of the application workspace. |
policy_identifier |
object |
Fields that make up the consistent policy identifier. |
The policy identifier fields are made up using the following schema:
Name |
Type |
Description |
---|---|---|
version |
string |
(optional) Indicates the version of the application for which to get the policies; defaults to the latest ’v’ version of the application when left unspecified. |
consumer_consistent_uuid |
string |
Consistent UUID of the consumer or source. |
provider_consistent_uuid |
string |
Consistent UUID of the provider or destination. |
rank |
string |
Policy rank has to be one of “DEFAULT” or “ABSOUTE”. |
action |
string |
Policy action has to be one of “ALLOW” or “DENY”. |
priority |
integer |
Priority value for the policy. |
protocol |
integer |
IP protocol number (0-255) for the . |
start_port |
integer |
(optional) Start of port range (0-65535); defaults to 0 when unspecified. |
end_port |
integer |
(optional) End of port range (0-65535); defaults to 65535 if start_port is 0 or else to the start_prot. |
Sample Python code
application_id = '5f88ca1e755f0222f85ce85c'
consumer_id = '5f88ca1e755f0222f85ce85d'
provider_id = '5f88ca1e755f0222f85ce85d'
rank = 'DEFAULT'
action = 'ALLOW'
priority = 100
protocol = 6
start_port = 80
version = 'p3'
req_body = f'''
{{
"application_id": "{application_id}",
"policy_identifier": {{
"consumer_consistent_uuid": "{consumer_id}",
"provider_consistent_uuid": "{provider_id}",
"rank": "{rank}",
"action": "{action}",
"priority": {priority},
"protocol": "{protocol}",
"start_port": "{start_port}",
"version": "{version}"
}}
}}'''
restclient.post('/policies/search', json_body=req_body)