diff --git a/templates/create_workspace_client.json.j2 b/templates/create_workspace_client.json.j2 index d289013..bbd16f0 100644 --- a/templates/create_workspace_client.json.j2 +++ b/templates/create_workspace_client.json.j2 @@ -171,12 +171,44 @@ "inputParameters" : { "url" : "${init.input.storagehub}/workspace", "method" : "GET", + "expect" : [200, 406], "headers" : { "Accept" : "application/json", "Authorization" : "Bearer ${authorize_with_uma_rpt.output.body.access_token}" } } - } + }, + { + "name": "decision", + "taskReferenceName": "check_workspace_existance", + "inputParameters": { + "status": "${check_workspace.output.status}" + }, + "type": "DECISION", + "caseExpression": "($.status === 406 ? 'create' : 'exists')", + "decisionCases": { + "create": [ + { + "name" : "pyrest", + "taskReferenceName" : "create_jcr_account", + "type" : "SIMPLE", + "inputParameters" : { + "url" : "${init.input.storagehub}/workspace/users", + "method" : "POST", + "headers" : { + "Content-Type" : "application/x-www-form-urlencoded", + "Accept" : "application/json", + "Authorization" : "Bearer ${authorize.output.body.access_token}" + }, + "body" : { + "user" : "${get_service_account_user.output.body.username}", + "password" : "r3u4h-ewrqwli!_m" + } + } + } + ] + } + }, ] }