Added check and eventually creation of parent folder

This commit is contained in:
dcore94 2021-09-13 16:11:26 +02:00
parent dad88dd17b
commit a259503e9f
1 changed files with 51 additions and 0 deletions

View File

@ -53,6 +53,57 @@
}
}
},
{
"name": "decision",
"taskReferenceName": "check_user_existance",
"inputParameters": {
"folders": "${checkfolder.output.response.body}"
},
"type": "DECISION",
"caseExpression": "($.folders.length === 0 ? 'create' : 'exists')",
"decisionCases": {
"create": [
{
"name" : "pyrest",
"taskReferenceName" : "create_parent_folder",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.storagehub}/workspace//items/{{workspace-root-id}}/create/FOLDER",
"method" : "POST",
"headers" : {
"Content-type": "application/x-www-form-urlencoded",
"Accept" : "text/plain"
},
"body" : {
"name" : "${init.input.parentfolder}",
"description" : "Root folder of all Bluecloud data downloads",
"hidden" : "false"
}
}
},
{
"name": "LAMBDA_TASK",
"taskReferenceName": "extract_folder_id_1",
"type": "LAMBDA",
"inputParameters": {
"resp" : "${create_parent_folder.output.response}",
"scriptExpression": "return { parent_folder_id : $.resp}"
}
}
],
"exists" : [
{
"name": "LAMBDA_TASK",
"taskReferenceName": "extract_folder_id_2",
"type": "LAMBDA",
"inputParameters": {
"resp" : "${checkfolder.output.response.body}",
"scriptExpression": "return { parent_folder_id : $.resp.itemlist[0].id}"
}
}
]
}
},
{
"name": "LAMBDA_TASK",
"taskReferenceName": "build_transfer_tasks",