handle gateway
This commit is contained in:
parent
8805ceb944
commit
9e8e374f6d
|
@ -15,8 +15,8 @@
|
||||||
"root_vo": "{{ root_vo }}",
|
"root_vo": "{{ root_vo }}",
|
||||||
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
|
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
|
||||||
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
|
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
|
||||||
"clientId" : "${workflow.input.group}",
|
"group" : "${workflow.input.group}",
|
||||||
"scriptExpression": "var tree = $.clientId.split('%2F'); return { 'tree' : tree, 'child': tree[tree.length-1], 'append' : tree.slice(0,-1).join('/'), 'name' : tree.join('/'), encoded_root_vo : encodeURI($.root_vo)}"
|
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.group)) throw('Group must not be empty'); var tree = $.group.startsWith('%2F') ? $.group.split('%2F') : [$.group]; return { 'tree' : tree, 'child': tree[tree.length-1], 'append' : tree.slice(0,-1).join('/'), 'name' : tree.join('/'), encoded_root_vo : encodeURI($.root_vo)}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,43 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name" : "check_is_gateway",
|
||||||
|
"taskReferenceName" : "check_is_gateway",
|
||||||
|
"type" : "DECISION",
|
||||||
|
"inputParameters" :{
|
||||||
|
"group" : "${init.output.result.group}"
|
||||||
|
},
|
||||||
|
"caseExpression": "$.group.toLowerCase().endsWith(" gateway") || $.group.toLowerCase().endsWith("+gateway") ? 'gateway' : ''",
|
||||||
|
"decisionCases" : {
|
||||||
|
"gateway" : [
|
||||||
|
{
|
||||||
|
"name" : "pyrest",
|
||||||
|
"taskReferenceName" : "create_gateway_group",
|
||||||
|
"type" : "SIMPLE",
|
||||||
|
"inputParameters" : {
|
||||||
|
"url" : "${init.input.keycloak_admin}/groups",
|
||||||
|
"body" : {
|
||||||
|
"name" : "${init.output.result.child}"
|
||||||
|
},
|
||||||
|
"method" : "POST",
|
||||||
|
"headers" : {
|
||||||
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
||||||
|
"Content-Type" : "application/json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "terminate",
|
||||||
|
"taskReferenceName" : "terminate_when_gateway",
|
||||||
|
"type" : "TERMINATE",
|
||||||
|
"inputParameters" : {
|
||||||
|
"terminationStatus" : "COMPLETED"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name" : "fork_join",
|
"name" : "fork_join",
|
||||||
"taskReferenceName" : "preliminary_fork",
|
"taskReferenceName" : "preliminary_fork",
|
||||||
|
@ -49,7 +86,7 @@
|
||||||
"inputParameters" : {
|
"inputParameters" : {
|
||||||
"url" : "${init.input.keycloak_admin}/clients",
|
"url" : "${init.input.keycloak_admin}/clients",
|
||||||
"body" : {
|
"body" : {
|
||||||
"clientId": "${init.input.clientId}",
|
"clientId": "${init.input.group}",
|
||||||
"name": "${init.output.result.name}",
|
"name": "${init.output.result.name}",
|
||||||
"description": "Client representation for ${init.output.result.name} context",
|
"description": "Client representation for ${init.output.result.name} context",
|
||||||
"rootUrl": "http://localhost${init.output.result.name}",
|
"rootUrl": "http://localhost${init.output.result.name}",
|
||||||
|
|
Loading…
Reference in New Issue