ansible-role-conductor-work.../templates/role_created.json.j2

162 lines
5.7 KiB
Plaintext
Raw Normal View History

2021-03-23 13:40:05 +01:00
{
"ownerApp" : "Orchestrator",
"name" : "role_created",
"createBy" : "Marco Lettere",
"description": "Handle workflow related to Portal event role_created",
"version" : 1,
"ownerEmail" : "marco.lettere@nubisware.com",
2021-04-30 14:41:48 +02:00
"inputParameters" : ["role", "first", "max"],
2021-03-23 13:40:05 +01:00
"tasks" : [
{
"name": "LAMBDA_TASK",
"taskReferenceName": "init",
"type": "LAMBDA",
"inputParameters": {
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
2021-03-23 19:02:35 +01:00
"scriptExpression": "1 == 1"
2021-03-23 13:40:05 +01:00
}
},
{
"name" : "pyrest",
"taskReferenceName" : "authorize",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "{{ keycloak }}/master/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth_master }}",
"grant_type" : "client_credentials"
}
}
},
{
"name" : "pyrest",
"taskReferenceName" : "get_all_vres",
"type" : "SIMPLE",
"inputParameters" : {
2022-03-16 09:55:08 +01:00
"url" : "${init.input.keycloak_admin}/clients?clientId=%252F&search=true",
2021-03-23 13:40:05 +01:00
"method" : "GET",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}",
"Accept" : "application/json"
}
}
},
{
"name" : "pyrest",
"taskReferenceName" : "authorize2",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "{{ keycloak }}/master/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth_master }}",
"grant_type" : "client_credentials"
}
}
},
2021-03-23 13:40:05 +01:00
{
"name": "LAMBDA_TASK",
"taskReferenceName": "build_add_role_tasks",
"type": "LAMBDA",
"inputParameters": {
"role" : "${workflow.input.role}",
"vres" : "${get_all_vres.output.body}",
"scriptExpression": "inputs={};tasks=[];for(var i=0;i<$.vres.length;i++)vre=$.vres[i],tasks.push({name:'pyrest',type:'SIMPLE',taskReferenceName:'create_role_'+i}),inputs['create_role_'+i]={url:'${init.input.keycloak_admin}/clients/' + vre.id + '/roles',body:{clientRole:true,name:$.role,description: $.role + ' role'},method:'POST',headers:{Authorization:'Bearer ${authorize2.output.body.access_token}','Content-Type':'application/json'}};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};"
2021-03-23 19:31:04 +01:00
}
},
{
"name" : "fork_dynamic",
"type" : "FORK_JOIN_DYNAMIC",
"taskReferenceName" : "parallel_add_role",
"inputParameters" : {
"tasks" : "${build_add_role_tasks.output.result.tasks}",
"inputs" : "${build_add_role_tasks.output.result.inputs}"
},
"dynamicForkTasksParam": "tasks",
"dynamicForkTasksInputParamName": "inputs"
},
{
"name" : "join",
"type" : "JOIN",
"taskReferenceName" : "join_parallel_role_addition"
2021-03-24 09:03:01 +01:00
},
{
"name" : "pyrest",
"taskReferenceName" : "authorize3",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "{{ keycloak }}/master/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth_master }}",
"grant_type" : "client_credentials"
}
}
},
2021-03-24 09:03:01 +01:00
{
"name": "LAMBDA_TASK",
"taskReferenceName": "build_get_back_role_tasks",
"type": "LAMBDA",
"inputParameters": {
"roleurls" : "${join_parallel_role_addition.output[*]..location}",
"scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.roleurls.length;i++)u=$.roleurls[i],tasks.push({name:'pyrest',type:'SIMPLE',taskReferenceName:'get_back_'+i}),inputs['get_back_'+i]={url:u,method:'GET',headers:{Authorization:'Bearer ${authorize3.output.body.access_token}',Accept:'application/json'}};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};"
2021-03-24 09:03:01 +01:00
}
},
{
"name" : "fork_dynamic",
"type" : "FORK_JOIN_DYNAMIC",
"taskReferenceName" : "parallel_get_back_role",
"inputParameters" : {
"tasks" : "${build_get_back_role_tasks.output.result.tasks}",
"inputs" : "${build_get_back_role_tasks.output.result.inputs}"
},
"dynamicForkTasksParam": "tasks",
"dynamicForkTasksInputParamName": "inputs"
},
{
"name" : "join",
"type" : "JOIN",
"taskReferenceName" : "join_parallel_getting_back"
},
{
"name": "LAMBDA_TASK",
2021-03-24 12:02:28 +01:00
"taskReferenceName": "build_policy_permission_tasks",
"type": "LAMBDA",
"inputParameters": {
2021-03-24 10:46:28 +01:00
"roles" : "${join_parallel_getting_back.output[*].body}",
2021-03-24 12:20:48 +01:00
"scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.roles.length;i++)r=$.roles[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'call_policy_workflow_'+i, subWorkflowParam:{ name:'add_role_policy_permission'}}),inputs['call_policy_workflow_'+i]={role:r};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};"
2021-03-24 10:46:28 +01:00
}
},
{
"name" : "fork_dynamic",
"type" : "FORK_JOIN_DYNAMIC",
2021-03-24 12:02:28 +01:00
"taskReferenceName" : "parallel_call_policy_permission_workflow",
"inputParameters" : {
2021-03-24 12:02:28 +01:00
"tasks" : "${build_policy_permission_tasks.output.result.tasks}",
"inputs" : "${build_policy_permission_tasks.output.result.inputs}"
},
"dynamicForkTasksParam": "tasks",
"dynamicForkTasksInputParamName": "inputs"
},
2021-03-24 09:03:01 +01:00
{
"name" : "join",
"type" : "JOIN",
2021-03-24 12:02:28 +01:00
"taskReferenceName" : "join_parallel_policy_permission_addition"
2021-03-23 19:31:04 +01:00
}
2021-03-23 13:40:05 +01:00
]
}