diff options
author | 2021-02-16 14:53:43 +0100 | |
---|---|---|
committer | 2021-02-23 09:51:46 +0000 | |
commit | 44a539f0b8ac56494ce2100aab798f268526a127 (patch) | |
tree | 0c7d974d9872d42c541a4149b676f78cd7df8779 /src/main/resources/clds/camel/rest | |
parent | 09ace211a47e77a922911126ca2ba144500c4cfe (diff) |
Introduce a new endpoint to create policy
One first part of the update is to create a policy version from an existing one (this is similar as the create new policy).
The policy-flow.xml has been refactored so that the same policy query is done for policies and loop related flows. A code has been added to remove fields from the UI that could be present (the PDP group info json enrichment)
Issue-ID: POLICY-2926
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: Ia60c656a9b5100296042d3346d5c97c8dad5d041
(cherry picked from commit a0a3a03686a386bf6def6f7da6de4d3f6a11ce61)
Diffstat (limited to 'src/main/resources/clds/camel/rest')
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 7ca4f081e..bcad3ea33 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -1316,7 +1316,9 @@ </doTry> </route> </get> - <get uri="/v2/policies/list" outType="com.google.gson.JsonObject" produces="application/json"> + + <!-- Policy Related endpoints, not related to LOOP --> + <get uri="/v2/policies" outType="com.google.gson.JsonObject" produces="application/json"> <route> <removeHeaders pattern="*"/> <doTry> @@ -1347,17 +1349,63 @@ <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=errorLog()"/> <log loggingLevel="ERROR" - message="GET Policy Model YAML request failed for type: ${header.policyModelType}, ${exception.stacktrace}"/> + message="GET Policies list JSON request failed: ${exception.stacktrace}"/> <setHeader headerName="CamelHttpResponseCode"> <constant>500</constant> </setHeader> <setBody> - <simple>GET Policy model YAML FAILED</simple> + <simple>GET Policies list JSON FAILED</simple> </setBody> </doCatch> </doTry> </route> </get> + <!-- Update an existing policy, therefore it removes it from pdp first, delete it and then recreate it --> + <!-- TO BE DONE --> + + <!-- Create a new policy --> + <post uri="/v2/policies/{policyModelName}/{policyModelVersion}" outType="com.google.gson.JsonObject" produces="application/json"> + <route> + <removeHeaders pattern="*" + excludePattern="policyModelName|policyModelVersion"/> + <doTry> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'CREATE a new Policy ')"/> + <to + uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'policies','','update')"/> + <setProperty propertyName="policyModelName"> + <simple>${header.policyModelName}</simple> + </setProperty> + <setProperty propertyName="policyModelVersion"> + <simple>${header.policyModelVersion}</simple> + </setProperty> + <setBody> + <method ref="org.onap.policy.clamp.policy.pdpgroup.PoliciesPdpMerger" + method="removePdpStatesOnePolicy(${body})"/> + </setBody> + <to uri="direct:create-policy"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/> + <doCatch> + <exception>java.lang.Exception</exception> + <handled> + <constant>true</constant> + </handled> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=errorLog()"/> + <log loggingLevel="ERROR" + message="CREATE Policy request failed for type: ${header.policyModelType}/${header.policyModelVersion}, ${exception.stacktrace}"/> + <setHeader headerName="CamelHttpResponseCode"> + <constant>500</constant> + </setHeader> + <setBody> + <simple>CREATE Policy FAILED</simple> + </setBody> + </doCatch> + </doTry> + </route> + </post> + <get uri="/v2/clampInformation" outType="org.onap.policy.clamp.clds.model.ClampInformation" produces="application/json"> <to |