diff options
author | sebdet <sebastien.determe@intl.att.com> | 2021-04-21 12:01:28 +0200 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2021-04-22 11:26:15 +0000 |
commit | 5ce5937197df5eed3895e2590ea31b23207026b4 (patch) | |
tree | 076209298551c69208de2d9be4c2c58954daa774 /src | |
parent | cbe49c6c89c395988808b6ba297e003f15c6d326 (diff) |
Add Camel flows to create policy-type
Add the required camel flows to create a policy type in the clamp BE
Issue-ID: POLICY-3228
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I5c89823eb5f3f0e369fae5b27a803cb509cef128
Diffstat (limited to 'src')
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 34 | ||||
-rw-r--r-- | src/main/resources/clds/camel/routes/policy-flows.xml | 34 |
2 files changed, 68 insertions, 0 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 bba76f7ed..3238822d3 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -1501,6 +1501,40 @@ </route> </put> + <post uri="/v2/policies/policytype" consumes="application/yaml"> + <route> + <removeHeaders pattern="*"/> + <doTry> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Create policy type')"/> + <to + uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'policies','','update')"/> + <setProperty name="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <to uri="direct:create-policy-type"/> + <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 type request failed: ${exception.stacktrace}"/> + <setHeader name="CamelHttpResponseCode"> + <constant>500</constant> + </setHeader> + <setBody> + <simple>Create policy type request FAILED</simple> + </setBody> + </doCatch> + </doTry> + </route> + </post> + <get uri="/v2/clampInformation" outType="org.onap.policy.clamp.clds.model.ClampInformation" produces="application/json"> <route> diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index 4048af496..19092bfac 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -614,4 +614,38 @@ </doFinally> </doTry> </route> + <route id="create-policy-type"> + <from uri="direct:create-policy-type"/> + <doTry> + <log loggingLevel="INFO" + message="Creating Policy type"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create policy typ')"/> + <setHeader name="CamelHttpMethod"> + <constant>POST</constant> + </setHeader> + <setHeader name="X-ONAP-RequestID"> + <simple>${exchangeProperty[X-ONAP-RequestID]} + </simple> + </setHeader> + <setHeader name="X-ONAP-InvocationID"> + <simple>${exchangeProperty[X-ONAP-InvocationID]} + </simple> + </setHeader> + <setHeader name="X-ONAP-PartnerName"> + <simple>${exchangeProperty[X-ONAP-PartnerName]} + </simple> + </setHeader> + <log loggingLevel="INFO" + message="Endpoint to create policy type: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes"></log> + <toD + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&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 |