added ID extraction and check

master
Marco Lettere 9 months ago
parent 2cc42d9e6d
commit 1306b1bdfe

@ -64,6 +64,15 @@
"Authorization" : "Bearer ${authorize_uma_rootvo.output.body.access_token}"
}
}
},
{
"name" : "pyeval",
"taskReferenceName" : "extract_infrastructure_id",
"type" : "SIMPLE",
"inputParameters" : {
"code" : "exec('import xml.etree.ElementTree as ET') or list(map(lambda n: n.text, ET.fromstring(data['xmlstring']).findall('Resource[Profile/SecondaryType = \"INFRASTRUCTURE\"]/ID')))",
"xmlstring" : "${retrieve_vre.output.body}"
}
}
],
[
@ -97,6 +106,15 @@
"Authorization" : "Bearer ${authorize_uma_paarent_vo.output.body.access_token}"
}
}
},
{
"name" : "pyeval",
"taskReferenceName" : "extract_vre_id",
"type" : "SIMPLE",
"inputParameters" : {
"code" : "exec('import xml.etree.ElementTree as ET') or list(map(lambda n: n.text, ET.fromstring(data['xmlstring']).findall('Resource/ID')))",
"xmlstring" : "${retrieve_vre.output.body}"
}
}
]
]
@ -105,7 +123,17 @@
"name": "notification_join",
"taskReferenceName": "notification_join_ref",
"type": "JOIN",
"joinOn": ["retrieve_infrastructure", "retrieve_vre"]
"joinOn": ["extract_infrastructure_id", "extract_vre_id"]
},
{
"type" : "LAMBDA",
"name": "LAMBDA_TASK",
"taskReferenceName": "check",
"inputParameters": {
"vre": "${extract_vre_id.output.result}",
"infra": "${extract_vre_id.output.result}",
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))} if(e($.vre) || e($.infra)) throw('VRE ID and Infra ID must not be empty'); var tree = $.ctx.split('%2F'); return { child : tree[tree.length - 1], parent : tree[tree.length-2], decoded_root_vo : $.root_vo.replace('%2F', '/') }"
}
},
{
"name" : "pyrest",

Loading…
Cancel
Save