{ "ownerApp" : "Orchestrator", "name" : "da_cache_to_shub", "createBy" : "Marco Lettere", "description": "Workflow for streaming da_cache files to storage hub", "version" : 1, "ownerEmail" : "marco.lettere@nubisware.com", "inputParameters" : ["token", "descriptor"], "tasks" : [ { "name": "LAMBDA_TASK", "taskReferenceName": "init", "type": "LAMBDA", "inputParameters": { "downloads" : "${workflow.input.descriptor.downloads.*}", "storagehub" : "{{ storagehub }}", "auth" : "Bearer ${workflow.input.token}", "parentfolder" : "Blue-Cloud Data Downloads", "folder" : "${workflow.input.descriptor.order_name}-${workflow.input.descriptor.order_number}", "scriptExpression": "1 === 1" } }, { "name" : "http", "taskReferenceName" : "get_workspace", "type" : "HTTP", "inputParameters" : { "http_request": { "uri" : "${init.input.storagehub}/workspace", "method" : "GET", "headers" : { "Authorization" : "${init.input.auth}" } } } }, { "name": "LAMBDA_TASK", "taskReferenceName": "init2", "type": "LAMBDA", "inputParameters": { "workspace_root_folder_id" : "${get_workspace.output.response.body.item.id}", "scriptExpression": "1 === 1" } }, { "name" : "http", "taskReferenceName" : "check_folder", "type" : "HTTP", "inputParameters" : { "http_request": { "uri" : "${init.input.storagehub}/workspace/items/${init2.input.workspace_root_folder_id}/items/${init.input.parentfolder}", "method" : "GET", "headers" : { "Authorization" : "${init.input.auth}" } } } }, { "name": "LAMBDA_TASK", "taskReferenceName": "build_transfer_tasks", "type": "LAMBDA", "inputParameters": { "work" : "${workflow.input.descriptor.downloads.*}", "upload" : "https://workspace-repository.dev.d4science.org/storagehub/workspace/items/68e30cd7-8728-429e-9a98-50039e309095/create/FILE", "auth" : "Bearer ${workflow.input.token}", "description" : "${workflow.input.descriptor.order_name}", "scriptExpression": "inputs={};tasks=[];for(var i=0;i<$.downloads.length;i++)download=$.downloads[i],tasks.push({name:'pyrestbridge',type:'SIMPLE',taskReferenceName:'bridge_'+i}),inputs['bridge_'+i]={ datamap : { place: 'files', name : 'file'}, endpoint1 : { url: download.url}, endpoint2 : { url: $.upload, headers: { Authorization : $.auth}, files: { name : 'file' + download.number, description : $.description[0]}} };return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" } } ] }