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/routes/policy-flows.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/routes/policy-flows.xml')
-rw-r--r-- | src/main/resources/clds/camel/routes/policy-flows.xml | 79 |
1 files changed, 51 insertions, 28 deletions
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index 0a9c1f511..f9f2b1d72 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -172,41 +172,27 @@ </doTry> </route> - <route id="delete-policy"> - <from uri="direct:delete-policy"/> + <route id="delete-policy-from-loop-object"> + <from uri="direct:delete-policy-from-loop-object"/> <doTry> <log loggingLevel="INFO" - message="Deleting Policy: ${exchangeProperty[policy].getName()}"/> + message="Deleting Policy in a loop: ${exchangeProperty[policy].getName()}"/> <to - uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Policy')"/> - <setBody> - <constant>null</constant> - </setBody> - <setHeader headerName="CamelHttpMethod"> - <constant>DELETE</constant> - </setHeader> - <setHeader headerName="X-ONAP-RequestID"> - <simple>${exchangeProperty[X-ONAP-RequestID]} - </simple> - </setHeader> - <setHeader headerName="X-ONAP-InvocationID"> - <simple>${exchangeProperty[X-ONAP-InvocationID]} - </simple> - </setHeader> - <setHeader headerName="X-ONAP-PartnerName"> - <simple>${exchangeProperty[X-ONAP-PartnerName]} - </simple> - </setHeader> + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Policy in a loop')"/> + <setProperty propertyName="policyModelType"> + <simple>${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}</simple> + </setProperty> + <setProperty propertyName="policyModelVersion"> + <simple>${exchangeProperty[policy].getPolicyModel().getVersion()</simple> + </setProperty> + <setProperty propertyName="policyName"> + <simple>${exchangeProperty[policy].getName()}</simple> + </setProperty> <setProperty propertyName="policyVersion"> <simple>1.0.0</simple> </setProperty> - <log loggingLevel="INFO" - message="Endpoint to delete policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/${exchangeProperty[policyVersion]}"></log> - <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - + <to uri="direct:delete-policy"/> <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> <setProperty propertyName="logMessage"> @@ -575,4 +561,41 @@ </doFinally> </doTry> </route> + <route id="delete-policy"> + <from uri="direct:delete-policy"/> + <doTry> + <log loggingLevel="INFO" + message="Deleting Policy: ${exchangeProperty[policyName]}"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Policy')"/> + <setBody> + <constant>null</constant> + </setBody> + <setHeader headerName="CamelHttpMethod"> + <constant>DELETE</constant> + </setHeader> + <setHeader headerName="X-ONAP-RequestID"> + <simple>${exchangeProperty[X-ONAP-RequestID]} + </simple> + </setHeader> + <setHeader headerName="X-ONAP-InvocationID"> + <simple>${exchangeProperty[X-ONAP-InvocationID]} + </simple> + </setHeader> + <setHeader headerName="X-ONAP-PartnerName"> + <simple>${exchangeProperty[X-ONAP-PartnerName]} + </simple> + </setHeader> + <log loggingLevel="INFO" + message="Endpoint to delete policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelType]}/versions/${exchangeProperty[policyModelVersion]}/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log> + <toD + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelType]}/versions/${exchangeProperty[policyModelVersion]}/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + + <doFinally> + <to uri="direct:reset-raise-http-exception-flag"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> + </doFinally> + </doTry> + </route> </routes>
\ No newline at end of file |