Skip to content

Commit

Permalink
add validations for policy undeployments
Browse files Browse the repository at this point in the history
  • Loading branch information
YasasRangika committed Jan 10, 2024
1 parent 07de543 commit 52ea95c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ public Response engageGlobalPolicy(String gatewayPolicyMappingId,
// checks whether the gateway policy mapping exists in the particular gateway
for (GatewayPolicyDeploymentDTO gatewayPolicyDeploymentDTO : gatewayPolicyDeploymentDTOList) {
String gwName = gatewayPolicyDeploymentDTO.getGatewayLabel();
if (apiProvider.hasExistingDeployments(organization, gwName)) {
boolean isDeployment = gatewayPolicyDeploymentDTO.isGatewayDeployment();
if (isDeployment && apiProvider.hasExistingDeployments(organization, gwName)) {
RestApiUtil.handleBadRequest("Gateway policy mapping is already deployed in the gateway: " + gwName,
log);
} else if (!isDeployment && !apiProvider.hasExistingDeployments(organization, gwName)) {
RestApiUtil.handleBadRequest("Gateway policy mapping is not deployed in the gateway: " + gwName,
log);
}
}
List<OperationPolicyData> operationPolicyDataList = apiProvider.getGatewayPolicyDataListByPolicyId(
Expand Down

0 comments on commit 52ea95c

Please sign in to comment.