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
diff --git a/platform-logic/restapi-templates/src/main/velocity/a1-policy-type-create-schema-property-payload-template.vtl b/platform-logic/restapi-templates/src/main/velocity/a1-policy-type-create-schema-property-payload-template.vtl
new file mode 100644 (file)
index 0000000..0230add
--- /dev/null
@@ -0,0 +1,26 @@
+## Velocity template for creating the payload for creating A1 policy type
+#set($begCntr1=0)
+#set($endCntr1=0)
+#set($entries=$ctx.getAttribute("create-policy-type-input.properties_length"))
+#set($endCntr1=$endCntr1.parseInt($entries))
+#set( $endCntr1 = $endCntr1 - 1)
+{
+  "description": "$ctx.getAttribute("create-policy-type-input.description")",
+  "name": "$ctx.getAttribute("create-policy-type-input.name")",
+  "policy_type_id": $ctx.getAttribute("create-policy-type-input.policy-type-id"),
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "additionalProperties": false,
+    "type": "object",
+    "properties": {#foreach($no1 in [$begCntr1..$endCntr1])
+    "$ctx.getAttribute("create-policy-type-input.properties[$no1].property-name")" : {
+      #set($begCntr2=0)
+      #set($endCntr2=0)
+      #set($entries=$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements_length"))
+      #set($endCntr2=$endCntr2.parseInt($entries))
+      #set( $endCntr2 = $endCntr2 - 1)
+      #foreach($no2 in [$begCntr2..$endCntr2])
+        "$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements[$no2].policy-statement")" :
+        "$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements[$no2].policy-statement-value")"
+         #if( $no2 < $endCntr2), #end#end}#if( $no1 < $endCntr1), #end #end
+}}}