diff options
author | sebdet <sebastien.determe@intl.att.com> | 2021-02-23 14:51:54 +0100 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2021-02-24 17:14:21 +0000 |
commit | f12066418c402d3a7fe34667a9fc87295a347b8a (patch) | |
tree | c4eb334c75bb747083cc0d47d0ac212ea79f3bb3 /src/main/resources/clds/camel/rest/clamp-api-v2.xml | |
parent | 3664078317de1bfc75f0bf427e859daa2070fb35 (diff) |
Add new delete policy endpoint
Refactor the camel code so that the policy delete can be called "by loop" related flows and "by policy only" related flows.
A new endpoint for policy deletion has been added as well. This one will be called by the UI
Issue-ID: POLICY-2927
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I3c4bd2e22200788360575aa61a0122b7ed4e608d
Diffstat (limited to 'src/main/resources/clds/camel/rest/clamp-api-v2.xml')
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 58 |
1 files changed, 53 insertions, 5 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 f924a8a24..01ad8a8a3 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -499,7 +499,7 @@ <setProperty propertyName="raiseHttpExceptionFlag"> <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-policy"/> + <to uri="direct:delete-policy-from-loop-object"/> <to uri="direct:create-policy"/> </split> <log loggingLevel="INFO" @@ -516,7 +516,7 @@ <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-policy"/> + <to uri="direct:delete-policy-from-loop-object"/> <to uri="direct:create-policy"/> </split> @@ -584,7 +584,7 @@ <setProperty propertyName="raiseHttpExceptionFlag"> <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-policy"/> + <to uri="direct:delete-policy-from-loop-object"/> </split> <log loggingLevel="INFO" message="Deleting all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}"/> @@ -599,7 +599,7 @@ <setProperty propertyName="raiseHttpExceptionFlag"> <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-policy"/> + <to uri="direct:delete-policy-from-loop-object"/> </split> <to uri="bean:org.onap.policy.clamp.loop.LoopController?method=deleteLoop(${header.loopName})"/> @@ -737,7 +737,7 @@ <setProperty propertyName="raiseHttpExceptionFlag"> <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-policy"/> + <to uri="direct:delete-policy-from-loop-object"/> <to uri="bean:org.onap.policy.clamp.loop.LoopController?method=removeOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})"/> <to @@ -1412,6 +1412,54 @@ </route> </post> + <delete uri="/v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}"> + <route> + <removeHeaders pattern="*" + excludePattern="policyModelType|policyModelVersion|policyName|policyVersion"/> + <doTry> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DELETE a Policy ')"/> + <to + uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'policies','','update')"/> + <setProperty propertyName="policyModelType"> + <simple>${header.policyModelType}</simple> + </setProperty> + <setProperty propertyName="policyModelVersion"> + <simple>${header.policyModelVersion}</simple> + </setProperty> + <setProperty propertyName="policyName"> + <simple>${header.policyName}</simple> + </setProperty> + <setProperty propertyName="policyVersion"> + <simple>${header.policyVersion}</simple> + </setProperty> + <setProperty propertyName="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">false</simple> + </setProperty> + <to uri="direct:undeploy-one-policy-from-pap"/> + <to uri="direct:delete-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="DELETE Policy request failed for policy: ${header.policyName}/${header.policyVersion}, ${exception.stacktrace}"/> + <setHeader headerName="CamelHttpResponseCode"> + <constant>500</constant> + </setHeader> + <setBody> + <simple>DELETE Policy FAILED</simple> + </setBody> + </doCatch> + </doTry> + </route> + </delete> + <get uri="/v2/clampInformation" outType="org.onap.policy.clamp.clds.model.ClampInformation" produces="application/json"> <to |