diff --git a/defaults/main.yaml b/defaults/main.yaml index 32e214b..ccbd46b 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -13,13 +13,13 @@ workflows: # - role_created # - add_role_policy_permission # - add_all_member_roles - - create_system_service - - delete_system_service - - add_all_system_services_to_vre - # - create_workspace_client - # - add_workspace_client_to_context - # - enable_workspace_clients_for_context - # - add_workspace_client_to_contexts + # - create_system_service + # - delete_system_service + # - add_all_system_services_to_vre + - create_workspace_client + - add_workspace_client_to_context + - enable_workspace_clients_for_context + - add_workspace_client_to_contexts # - ghn_client_add_to_context # - ghn_client_add_to_contexts # - ghn_client_create diff --git a/templates/add_workspace_client_to_context.json.j2 b/templates/add_workspace_client_to_context.json.j2 index a1e2dfa..ea2fc98 100644 --- a/templates/add_workspace_client_to_context.json.j2 +++ b/templates/add_workspace_client_to_context.json.j2 @@ -8,9 +8,9 @@ "inputParameters" : ["client_id", "context"], "tasks" : [ { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "init", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "root_vo": "{{ root_vo }}", "storagehub" : "{{ storagehub }}", @@ -18,7 +18,8 @@ "keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}", "id" : "${workflow.input.client_id}", "ctx" : "${workflow.input.context}", - "scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.id) || e($.ctx)) throw('Client ID and Context must not be empty'); else return { encoded_root_vo : encodeURI($.root_vo), encoded_context : $.ctx.replaceAll('/', '%2F')}" + "evaluatorType": "javascript", + "expression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; function f(){if(e($.id) || e($.ctx)) throw('Client ID and Context must not be empty'); else return { encoded_root_vo : encodeURI($.root_vo), encoded_context : $.ctx.replaceAll('/', '%2F')}} f()" } }, { @@ -59,12 +60,13 @@ } }, { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "extract_ws_client", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "client" : "${lookup_client.output.body}", - "scriptExpression": "function e(v){ return (v.length === 0)}; if(e($.client)) throw('Workspace client not found'); else return { client : $.client[0], id : $.client[0].id}" + "evaluatorType" : "javascript", + "expression": "function e(v){ return (v.length === 0)}; function f(){if(e($.client)) throw('Workspace client not found'); else return { client : $.client[0], id : $.client[0].id}} f()" } }, { @@ -97,12 +99,13 @@ } }, { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "extract_context", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "client" : "${lookup_context.output.body}", - "scriptExpression": "function e(v){ return (v.length === 0)}; if(e($.client)) throw('Workspace client not found'); else return { client : $.client[0], id: $.client[0].id }" + "evaluatorType" : "javascript", + "expression": "function e(v){ return (v.length === 0)}; function f(){if(e($.client)) throw('Workspace client not found'); else return { client : $.client[0], id: $.client[0].id }} f()" } }, { @@ -128,12 +131,13 @@ } }, { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "shubify_context_name", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "context_name" : "${extract_context.output.result.client.name}", - "scriptExpression": "var s = $.context_name; return { shubified_context_name : (s[0] === '/' ? s.replace('/', '') : s).split('/').join('-')}" + "evaluatorType" : "javascript", + "expression": "var s = $.context_name; function f(){return { shubified_context_name : (s[0] === '/' ? s.replace('/', '') : s).split('/').join('-')}} f()" } } ] diff --git a/templates/add_workspace_client_to_contexts.json.j2 b/templates/add_workspace_client_to_contexts.json.j2 index c648bb9..f328d3d 100644 --- a/templates/add_workspace_client_to_contexts.json.j2 +++ b/templates/add_workspace_client_to_contexts.json.j2 @@ -8,25 +8,27 @@ "inputParameters" : ["client_id", "context_list"], "tasks" : [ { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "init", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { - "root_vo": "{{ root_vo }}", - "keycloak": "{{ keycloak }}/{{ keycloak_realm }}", - "id" : "${workflow.input.client_id}", - "keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}", - "scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.id)) throw('Client ID must not be empty'); return { }" + "root_vo": "{{ root_vo }}", + "keycloak": "{{ keycloak }}/{{ keycloak_realm }}", + "id" : "${workflow.input.client_id}", + "keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}", + "evaluatorType" : "javascript", + "expression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; function f(){if(e($.id)) throw('Client ID must not be empty'); return { }} f()" } }, { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "build_tasks_to_add_ws_client_to_all_contexts", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "context_list" : "${workflow.input.context_list}", "client_id" : "${workflow.input.client_id}", - "scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.context_list.length;i++)c=$.context_list[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'add_workspace_client_to_context_'+i, subWorkflowParam:{ name:'add_workspace_client_to_context'}}),inputs['add_workspace_client_to_context_'+i]={client_id : $.client_id, context: c};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" + "evaluatorType" : "javascript", + "expression": "inputs={},tasks=[];functionf(){for(var i=0;i<$.context_list.length;i++)c=$.context_list[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'add_workspace_client_to_context_'+i, subWorkflowParam:{ name:'add_workspace_client_to_context'}}),inputs['add_workspace_client_to_context_'+i]={client_id : $.client_id, context: c};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};} f()" } }, { diff --git a/templates/create_workspace_client.json.j2 b/templates/create_workspace_client.json.j2 index 7625715..3beac9e 100644 --- a/templates/create_workspace_client.json.j2 +++ b/templates/create_workspace_client.json.j2 @@ -8,9 +8,9 @@ "inputParameters" : ["client_id", "client_secret", "description", "context_list"], "tasks" : [ { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "init", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "root_vo": "{{ root_vo }}", "keycloak": "{{ keycloak }}/{{ keycloak_realm }}", @@ -19,7 +19,8 @@ "id" : "${workflow.input.client_id}", "secret" : "${workflow.input.client_secret}", "description" : "${workflow.input.description}", - "scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.id)) throw('Client ID must not be empty'); return { encoded_root_vo : encodeURI($.root_vo), client : { clientId : $.id, description : ($.description ? $.description : $.id), secret : ($.secret ? $.secret : Java.type('java.util.UUID').randomUUID().toString()), rootUrl : '', enabled : true, serviceAccountsEnabled : true, standardFlowEnabled : true, authorizationServicesEnabled : false, publicClient : false, fullScopeAllowed : true, protocol : 'openid-connect'} }" + "evaluatorType" : "javascript", + "expression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; function f(){if(e($.id)) throw('Client ID must not be empty'); return { encoded_root_vo : encodeURI($.root_vo), client : { clientId : $.id, description : ($.description ? $.description : $.id), secret : ($.secret ? $.secret : Java.type('java.util.UUID').randomUUID().toString()), rootUrl : '', enabled : true, serviceAccountsEnabled : true, standardFlowEnabled : true, authorizationServicesEnabled : false, publicClient : false, fullScopeAllowed : true, protocol : 'openid-connect'}}} f()" } }, { @@ -60,12 +61,13 @@ } }, { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "extract_client_id", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "client_location" : "${create_client.output.headers.location}", - "scriptExpression": "var client_id = $.client_location.split('/').pop(); return {'client_resource_id' : client_id}" + "evaluatorType" :"javascript", + "expression": "var client_id = $.client_location.split('/').pop(); function f(){return {'client_resource_id' : client_id}} f()" } }, { @@ -184,8 +186,9 @@ "inputParameters": { "status": "${check_workspace.output.status}" }, - "type": "DECISION", - "caseExpression": "($.status === 406 ? 'create' : 'exists')", + "type": "SWITCH", + "evaluatorType" : "javascript", + "expression": "($.status === 406 ? 'create' : 'exists')", "decisionCases": { "create": [ { @@ -225,13 +228,14 @@ } }, { - "name": "LAMBDA_TASK", + "name": "INLINE_TASK", "taskReferenceName": "build_tasks_to_add_ws_client_to_all_contexts", - "type": "LAMBDA", + "type": "INLINE", "inputParameters": { "context_list" : "${workflow.input.context_list}", "client_id" : "${workflow.input.client_id}", - "scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.context_list.length;i++)c=$.context_list[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'add_workspace_client_to_context_'+i, subWorkflowParam:{ name:'add_workspace_client_to_context'}}),inputs['add_workspace_client_to_context_'+i]={client_id : $.client_id, context: c};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" + "evaluatorType" : "javascript", + "expression": "inputs={},tasks=[];function f(){for(var i=0;i<$.context_list.length;i++)c=$.context_list[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'add_workspace_client_to_context_'+i, subWorkflowParam:{ name:'add_workspace_client_to_context'}}),inputs['add_workspace_client_to_context_'+i]={client_id : $.client_id, context: c};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};} f()" } }, {