* ================================================================================
* Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public static final String POLICY_STATUS_URI = "/policy/pap/v1/policies/status";
public static final String DEPLOYMENT_RESPONSE_MSG = "Use the policy status url to fetch the latest status. "
- + "Kindly note that when a policy is successfully undeployed,"
- + " it will no longer appear in policy status response.";
+ + "Kindly note that when a policy is successfully undeployed,"
+ + " it will no longer appear in policy status response.";
private static final Logger logger = LoggerFactory.getLogger(PdpGroupDeployControllerV1.class);
// @formatter:on
public Response updateGroupPolicies(
- @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "List of PDP Group Deployments", required = true) DeploymentGroups groups) {
-
- return doOperation(requestId, "update policy deployments failed", () -> provider.updateGroupPolicies(groups));
+ @HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ @ApiParam(value = "List of PDP Group Deployments", required = true) DeploymentGroups groups) {
+ return doOperation(requestId, "update policy deployments failed",
+ () -> provider.updateGroupPolicies(groups, getPrincipal()));
}
/**
// @formatter:on
public Response deployPolicies(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "PDP Policies; only the name is required",
- required = true) PdpDeployPolicies policies) {
-
- return doOperation(requestId, "deploy policies failed", () -> provider.deployPolicies(policies));
+ @ApiParam(value = "PDP Policies; only the name is required", required = true) PdpDeployPolicies policies) {
+ return doOperation(requestId, "deploy policies failed",
+ () -> provider.deployPolicies(policies, getPrincipal()));
}
/**
try {
runnable.run();
return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.ACCEPTED)), requestId)
- .entity(new PdpGroupDeployResponse(DEPLOYMENT_RESPONSE_MSG, POLICY_STATUS_URI))
- .build();
+ .entity(new PdpGroupDeployResponse(DEPLOYMENT_RESPONSE_MSG, POLICY_STATUS_URI)).build();
} catch (PfModelException | PfModelRuntimeException e) {
logger.warn(errmsg, e);
var resp = new PdpGroupDeployResponse();
resp.setErrorDetails(e.getErrorResponse().getErrorMessage());
return addLoggingHeaders(addVersionControlHeaders(Response.status(e.getErrorResponse().getResponseCode())),
- requestId).entity(resp).build();
+ requestId).entity(resp).build();
}
}
}