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

176 lines
5.7 KiB
Django/Jinja

{
"createTime": 1689254203836,
"updateTime": 1689259676819,
"name": "record_context_to_is",
"description": "Upon creation of a new context, record it to the Information System",
"version": 1,
"tasks": [
{
"name": "LAMBDA_TASK",
"taskReferenceName": "init",
"inputParameters": {
"base_url": "{{is_url}}/resource-registry/contexts",
"root_vo": "{{ root_vo }}",
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
"ctx": "${workflow.input.context}",
"ic_proxy" : "{{ ic_proxy }}",
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))} if(e($.ctx)) throw('Context must not be empty'); var tree = $.ctx.split('%2F'); return { child : tree[tree.length - 1], parent : tree[tree.length-2], decoded_root_vo : $.root_vo.replace('%2F', '/') }"
},
"type": "LAMBDA",
"decisionCases": {},
"defaultCase": [],
"forkTasks": [],
"startDelay": 0,
"joinOn": [],
"optional": false,
"defaultExclusiveJoinTask": [],
"asyncComplete": false,
"loopOver": []
},
{
"name" : "parallel_ic_proxy_queries",
"taskReferenceName" : "parallel_ic_proxy_queries",
"type" : "FORK_JOIN",
"forkTasks" : [
[
{
"name" : "pyrest",
"taskReferenceName" : "authorize_uma_rootvo",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak}/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"audience" : "${init.input.root_vo}",
"grant_type" : "urn:ietf:params:oauth:grant-type:uma-ticket",
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth }}"
}
}
},
{
"name" : "pyrest",
"taskReferenceName" : "retrieve_infrastructure",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "{{ ic_proxy }}/icproxy/gcube/service/GenericResource/INFRASTRUCTURE",
"method" : "GET",
"headers" : {
"Accept" : "application/xml",
"Authorization" : "Bearer ${authorize_uma_rootvo.output.body.access_token}"
}
}
}
],
[
{
"name" : "pyrest",
"taskReferenceName" : "authorize_uma_paarent_vo",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak}/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"audience" : "${init.input.root_vo}%2F${init.output.result.parent}",
"grant_type" : "urn:ietf:params:oauth:grant-type:uma-ticket",
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth }}"
}
}
},
{
"name" : "pyrest",
"taskReferenceName" : "retrieve_vre",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "{{ ic_proxy }}/icproxy/gcube/service/GenericResource/VRE/${init.output.result.child}",
"method" : "GET",
"headers" : {
"Accept" : "application/xml",
"Authorization" : "Bearer ${authorize_uma_paarent_vo.output.body.access_token}"
}
}
}
]
]
},
{
"name": "notification_join",
"taskReferenceName": "notification_join_ref",
"type": "JOIN",
"joinOn": ["retrieve_infrastructure", "retrieve_vre"]
},
{
"name" : "pyrest",
"taskReferenceName" : "authorize",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "{{ keycloak }}/{{ keycloak_realm }}/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth }}",
"grant_type" : "client_credentials"
}
}
},
{
"name": "pyrest",
"taskReferenceName": "write_to_is",
"inputParameters": {
"url": "https://en5ql62qrka7q.x.pipedream.net/${init.output.result.child}",
"method": "PUT",
"headers": {
"Authorization": "Bearer bearer_here",
"Accept": "application/json",
"Content-Type": "application/json"
},
"body": {
"type": "Context",
"id": "${init.output.result.child}",
"name": "${init.output.result.child}",
"parent": {
"type": "IsParentOf",
"source": {
"type": "Context",
"id": "${init.output.result.parent}"
}
}
}
},
"type": "SIMPLE",
"decisionCases": {},
"defaultCase": [],
"forkTasks": [],
"startDelay": 0,
"joinOn": [],
"optional": false,
"defaultExclusiveJoinTask": [],
"asyncComplete": false,
"loopOver": []
}
],
"inputParameters": [
"context"
],
"outputParameters": {},
"schemaVersion": 2,
"restartable": true,
"workflowStatusListenerEnabled": false,
"ownerEmail": "example@email.com",
"timeoutPolicy": "ALERT_ONLY",
"timeoutSeconds": 0,
"variables": {},
"inputTemplate": {}
}