diff options
author | saul.gill <saul.gill@est.tech> | 2021-07-09 12:10:46 +0100 |
---|---|---|
committer | saul.gill <saul.gill@est.tech> | 2021-07-13 14:12:58 +0100 |
commit | ccf9b0dc2858265e3a3d7da28a653f6bc7e2e8a3 (patch) | |
tree | 0c34f1c0556bba3376a8c321ac010e44a673c2ce /runtime/src/main/resources/clds | |
parent | 94d85829c2067c8f27f3fd5c49673b5eabbceccb (diff) |
Added get json schema endpoints
Added runtime-controlloop endpoint to return Json Schema
Schema returned can be for specified type within Tosca Service Template
Added Camel in runtime endpoint to proxy the Schema endpoint
Dependency added to pom for the json schema generation
Issue-ID: POLICY-3439
Change-Id: I2a98ce16dfb3761a174c90f4b965d1a37a0d8576
Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime/src/main/resources/clds')
-rw-r--r-- | runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml | 34 | ||||
-rw-r--r-- | runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml | 28 |
2 files changed, 62 insertions, 0 deletions
diff --git a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml index d560db660..8a7523c2b 100644 --- a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -1575,6 +1575,40 @@ </doTry> </route> </get> + <get uri="/v2/toscaControlLoop/getJsonSchema" outType="java.lang.String" bindingMode="off" produces="application/json"> + <route> + <removeHeaders pattern="*" + excludePattern="section"/> + <doTry> + <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Json Schema ')"/> + <to uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')"/> + <setHeader name="Content-Type"> + <constant>application/json</constant> + </setHeader> + <setProperty name="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <to uri="direct:get-json-schema"/> + <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="GET JSON Schema request failed: ${exception.stacktrace}"/> + <setHeader name="CamelHttpResponseCode"> + <constant>500</constant> + </setHeader> + <setBody> + <simple>GET JSON Schema FAILED</simple> + </setBody> + </doCatch> + </doTry> + </route> + </get> <post uri="/v2/toscaControlLoop/postToscaInstantiation" type="java.lang.String" diff --git a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml index b7da4a743..a888d6bf0 100644 --- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml +++ b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml @@ -104,4 +104,32 @@ </doFinally> </doTry> </route> + <route id="get-json-schema"> + <from uri="direct:get-json-schema"/> + <doTry> + <log loggingLevel="INFO" + message="Getting the JSON Schema"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('ControlLoop', 'Getting the JSON Schema')"/> + <setHeader name="CamelHttpMethod"> + <constant>GET</constant> + </setHeader> + <setHeader name="Content-Type"> + <constant>application/json</constant> + </setHeader> + <setProperty name="section"> + <simple>${header.section}</simple> + </setProperty> + <log loggingLevel="INFO" + message="Endpoint to get Json Schema: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaServiceTemplateSchema"></log> + <toD + uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission/toscaServiceTemplateSchema?section=${exchangeProperty[section]}&bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.controlloop.runtime.userName}}&authPassword={{clamp.config.controlloop.runtime.password}}&authenticationPreemptive=true&connectionClose=true"/> + <convertBodyTo type="java.lang.String"/> + <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> |