Velocity templates for A1 Adapter DG's
[sdnc/oam.git] / platform-logic / restapi-templates / src / main / velocity / a1-policy-type-create-schema-property-payload-template.vtl
1 ## Velocity template for creating the payload for creating A1 policy type
2 #set($begCntr1=0)
3 #set($endCntr1=0)
4 #set($entries=$ctx.getAttribute("create-policy-type-input.properties_length"))
5 #set($endCntr1=$endCntr1.parseInt($entries))
6 #set( $endCntr1 = $endCntr1 - 1)
7 {
8   "description": "$ctx.getAttribute("create-policy-type-input.description")",
9   "name": "$ctx.getAttribute("create-policy-type-input.name")",
10   "policy_type_id": $ctx.getAttribute("create-policy-type-input.policy-type-id"),
11   "create_schema": {
12     "$schema": "http://json-schema.org/draft-07/schema#",
13     "additionalProperties": false,
14     "type": "object",
15     "properties": {#foreach($no1 in [$begCntr1..$endCntr1])
16     "$ctx.getAttribute("create-policy-type-input.properties[$no1].property-name")" : {
17       #set($begCntr2=0)
18       #set($endCntr2=0)
19       #set($entries=$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements_length"))
20       #set($endCntr2=$endCntr2.parseInt($entries))
21       #set( $endCntr2 = $endCntr2 - 1)
22       #foreach($no2 in [$begCntr2..$endCntr2])
23         "$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements[$no2].policy-statement")" :
24         "$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements[$no2].policy-statement-value")"
25          #if( $no2 < $endCntr2), #end#end}#if( $no1 < $endCntr1), #end #end
26 }}}