aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java22
-rw-r--r--main/src/main/java/org/onap/policy/api/main/rest/LegacyApiRestController.java18
2 files changed, 40 insertions, 0 deletions
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
index 1863b23a..24315427 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
@@ -59,6 +59,8 @@ import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to provide REST API services.
@@ -89,6 +91,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
securityDefinition = @SecurityDefinition(basicAuthDefinitions = { @BasicAuthDefinition(key = "basicAuth") }))
public class ApiRestController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ApiRestController.class);
+
/**
* Retrieves the healthcheck status of the API component.
*
@@ -234,6 +238,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes", pfme);
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -294,6 +299,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}", policyTypeId, pfme);
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -356,6 +362,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}/versions/{}", policyTypeId, versionId, pfme);
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -416,6 +423,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}/versions/latest", policyTypeId, pfme);
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -476,6 +484,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("POST /policytypes", pfme);
updateApiStatisticsCounter(Target.POLICY_TYPE, Result.FAILURE, HttpMethod.POST);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -540,6 +549,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("DELETE /policytypes/{}/versions/{}", policyTypeId, versionId, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
@@ -603,6 +613,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}/versions/{}/policies", policyTypeId, policyTypeVersion, pfme);
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -669,6 +680,8 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("/policytypes/{}/versions/{}/policies/{}", policyTypeId, policyTypeVersion, policyId,
+ pfme);
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -737,6 +750,8 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}/versions/{}/policies/{}/versions/{}", policyTypeId,
+ policyTypeVersion, policyId, policyVersion, pfme);
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -803,6 +818,8 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}/versions/{}/policies/{}/versions/latest", policyTypeId,
+ policyTypeVersion, policyId, pfme);
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -869,6 +886,8 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(deployedPolicies).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("GET /policytypes/{}/versions/{}/policies/{}/versions/deployed", policyTypeId,
+ policyTypeVersion, policyId, pfme);
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.GET);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -936,6 +955,7 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("POST /policytypes/{}/versions/{}/policies", policyTypeId, policyTypeVersion, pfme);
updateApiStatisticsCounter(Target.POLICY, Result.FAILURE, HttpMethod.POST);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
@@ -1004,6 +1024,8 @@ public class ApiRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(serviceTemplate).build();
} catch (PfModelException | PfModelRuntimeException pfme) {
+ LOGGER.error("DELETE /policytypes/{}/versions/{}/policies/{}/versions/{}", policyTypeId,
+ policyTypeVersion, policyId, policyVersion, pfme);
return addLoggingHeaders(addVersionControlHeaders(
Response.status(pfme.getErrorResponse().getResponseCode())), requestId)
.entity(pfme.getErrorResponse()).build();
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/LegacyApiRestController.java b/main/src/main/java/org/onap/policy/api/main/rest/LegacyApiRestController.java
index ed6e1d8c..f6688817 100644
--- a/main/src/main/java/org/onap/policy/api/main/rest/LegacyApiRestController.java
+++ b/main/src/main/java/org/onap/policy/api/main/rest/LegacyApiRestController.java
@@ -50,6 +50,8 @@ import org.onap.policy.models.base.PfModelRuntimeException;
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.
@@ -62,6 +64,8 @@ import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
@Consumes("application/json")
public class LegacyApiRestController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(LegacyApiRestController.class);
+
/**
* Retrieves all versions of a particular guard policy.
*
@@ -114,6 +118,8 @@ public class LegacyApiRestController {
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();
@@ -175,6 +181,8 @@ public class LegacyApiRestController {
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();
@@ -233,6 +241,7 @@ public class LegacyApiRestController {
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();
@@ -295,6 +304,8 @@ public class LegacyApiRestController {
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();
@@ -353,6 +364,8 @@ public class LegacyApiRestController {
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();
@@ -414,6 +427,8 @@ public class LegacyApiRestController {
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();
@@ -472,6 +487,7 @@ public class LegacyApiRestController {
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();
@@ -535,6 +551,8 @@ public class LegacyApiRestController {
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();