import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to provide legacy REST API services.
@Consumes("application/json")
public class LegacyApiRestController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(LegacyApiRestController.class);
+
/**
* Retrieves all versions of a particular guard policy.
*
* @return the Response object containing the results of the API operation
*/
@GET
- @Path("/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies/{policyId}")
+ @Path("/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/{policyId}")
@ApiOperation(value = "Retrieve all versions of a particular guard policy",
notes = "Returns a list of all versions of the specified guard policy",
response = LegacyGuardPolicyOutput.class, responseContainer = "Map",
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policies).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/{}",
+ policyId, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@GET
- @Path("/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies/{policyId}/versions/{policyVersion}")
+ @Path("/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/{policyId}/versions/{policyVersion}")
@ApiOperation(value = "Retrieve one version of a particular guard policy",
notes = "Returns a particular version of a specified guard policy",
response = LegacyGuardPolicyOutput.class, responseContainer = "Map",
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policies).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/{}/versions/{}",
+ policyId, policyVersion, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@POST
- @Path("/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies")
+ @Path("/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies")
@ApiOperation(value = "Create a new guard policy",
notes = "Client should provide entity body of the new guard policy",
authorizations = @Authorization(value = "basicAuth"),
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policy).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("POST /policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies", pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@DELETE
- @Path("/policytypes/onap.policy.controlloop.guard/versions/1.0.0/policies/{policyId}/versions/{policyVersion}")
+ @Path("/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/{policyId}/versions/{policyVersion}")
@ApiOperation(value = "Delete a particular version of a guard policy",
notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",
authorizations = @Authorization(value = "basicAuth"),
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policies).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("DELETE /policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/{}/versions/{}",
+ policyId, policyVersion, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@GET
- @Path("/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies/{policyId}")
+ @Path("/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/{policyId}")
@ApiOperation(value = "Retrieve all versions of a particular operational policy",
notes = "Returns a list of all versions of the specified operational policy",
response = LegacyOperationalPolicy.class,
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policy).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/{}",
+ policyId, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@GET
- @Path("/policytypes/onap.policy.controlloop.operational/versions/1.0.0/"
+ @Path("/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/"
+ "policies/{policyId}/versions/{policyVersion}")
@ApiOperation(value = "Retrieve one version of a particular operational policy",
notes = "Returns a particular version of a specified operational policy",
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policy).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/onap.policies.controlloop.Operational/versions/1.0.0/"
+ + "policies/{}/versions/{}", policyId, policyVersion, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@POST
- @Path("/policytypes/onap.policy.controlloop.operational/versions/1.0.0/policies")
+ @Path("/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies")
@ApiOperation(value = "Create a new operational policy",
notes = "Client should provide entity body of the new operational policy",
authorizations = @Authorization(value = "basicAuth"),
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policy).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("POST /policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies", pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
* @return the Response object containing the results of the API operation
*/
@DELETE
- @Path("/policytypes/onap.policy.controlloop.operational/versions/1.0.0/"
+ @Path("/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/"
+ "policies/{policyId}/versions/{policyVersion}")
@ApiOperation(value = "Delete a particular version of a specified operational policy",
notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(policy).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("DELETE /policytypes/onap.policies.controlloop.Operational/versions/1.0.0/"
+ + "policies/{}/versions/{}", policyId, policyVersion, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();