# Can be executed with HTTP client built-in plugin in IDEA
################ RBAC CHECK ################
### Check if user has network-operator privileges GET http://localhost:8088/rbac/editableworkflows x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.body === true, response.body);
}); %}
### Check if user has network-operator privileges GET http://localhost:8088/rbac/editableworkflows x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.body === false, response.body);
}); %}
################ RBAC CHECK END ################
################ WORKFLOW METADATA ################
## Add new WF def
### Add new workflow def as admin via proxy accessible only to admins PUT http://localhost:8088/proxy/api/metadata/workflow Content-Type: application/json x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
- [
- {
"name": "fx1", "description": "accessible to admins only", "ownerEmail": "[email protected]", "version": 1, "schemaVersion": 2, "tasks": [
- {
"name": "bar", "taskReferenceName": "barref", "type": "TERMINATE", "inputParameters": {
"terminationStatus": "FAILED"
}
}
]
}
]
> {% client.test("test", function() {
client.assert(response.status === 204);
}); %}
### Add new workflow def as admin via proxy accessible to also operators and testers PUT http://localhost:8088/proxy/api/metadata/workflow Content-Type: application/json x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
- [
- {
"name": "fx3", "description": "accessible to operators and testers - OPERATOR,TEST", "ownerEmail": "[email protected]", "version": 1, "schemaVersion": 2, "tasks": [
- {
"name": "bar", "taskReferenceName": "barref", "type": "TERMINATE", "inputParameters": {
"terminationStatus": "FAILED"
}
}
]
}
]
> {% client.test("test", function() {
client.assert(response.status === 204);
}); %}
### Get all workflows
### Get all workflow defs as admin via proxy GET http://localhost:8088/proxy/api/metadata/workflow x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).length === 2, response.body);
}); %}
### Get all workflow defs as operator via rbac_proxy GET http://localhost:8088/rbac_proxy/api/metadata/workflow x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).length === 1, response.body);
}); %}
### Get a single workflow def
### Get a single workflow def as admin via proxy GET http://localhost:8088/proxy/api/metadata/workflow/fx3 x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).name === "fx3", response.body);
}); %}
### Get a single workflow def as operator via proxy GET http://localhost:8088/rbac_proxy/api/metadata/workflow/fx3 x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).name === "fx3", response.body);
}); %}
### Get a single workflow def as operator via proxy: FAIL 401 GET http://localhost:8088/rbac_proxy/api/metadata/workflow/fx1 x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
################ WORKFLOW METADATA END ################
################ WORKFLOW EXEC ################
## Execute WF
### Execute workflow as an admin via proxy POST http://localhost:8088/proxy/api/workflow Content-Type: application/json x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
- {
- "name": "fx1"
}
> {% client.test("test", function() {
client.assert(response.status === 200, response.body);
}); client.global.set("admin_exec_1", response.body); %}
### Execute workflow as an admin via rbac proxy POST http://localhost:8088/rbac_proxy/api/workflow Content-Type: application/json x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
- {
- "name": "fx3"
}
> {% client.test("test", function() {
client.assert(response.status === 200, response.body);
}); client.global.set("admin_exec_2", response.body); %}
### Execute workflow as operator via rbac_proxy: FAIL 401 (workflow not accessible for operators) POST http://localhost:8088/rbac_proxy/api/workflow Content-Type: application/json x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
- {
- "name": "fx1"
}
> {% client.test("test", function() {
client.assert(response.status === 401, response.body);
}); %}
### Execute workflow as operator via rbac_proxy # SUCCESS POST http://localhost:8088/rbac_proxy/api/workflow Content-Type: application/json x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
- {
- "name": "fx3", "version": 1
}
> {% client.test("test", function() {
client.assert(response.status === 200, response.body);
}); client.global.set("oper_exec_1", response.body); // Sleep a little to make sure this wf finishes before moving to next request // This is running in nashorn so we can use JVM sleep java.lang.Thread.sleep(2000) %}
### Search WF executions
### Get all workflow executions as admin via proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 3, response.body);
}); %}
### Get all workflow executions as operator via proxy GET http://localhost:8088/rbac_proxy/api/workflow/search x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 1, response.body);
}); %}
## Get a single workflow execution
### Get a single workflow execution as admin via proxy GET http://localhost:8088/proxy/api/workflow/{{admin_exec_1}}?includeTasks=true x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).workflowName === "fx1", response.body);
}); %}
### Get a single workflow execution as admin via rbac_proxy GET http://localhost:8088/rbac_proxy/api/workflow/{{admin_exec_2}}?includeTasks=true x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).workflowName === "fx3", response.body);
}); %}
### Get a single workflow execution as operator via proxy: FAIL 401 GET http://localhost:8088/proxy/api/workflow/{{oper_exec_1}}?includeTasks=true x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
### Get a single workflow execution as operator via rbac_proxy: OK correlation ID matches GET http://localhost:8088/rbac_proxy/api/workflow/{{oper_exec_1}}?includeTasks=true x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response.status); client.assert(JSON.parse(response.body).workflowName === "fx3", response.body);
}); %}
### Get a single workflow execution as operator via rbac_proxy: FAIL 401 correlation ID doesn't match GET http://localhost:8088/rbac_proxy/api/workflow/{{admin_exec_1}}?includeTasks=true x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
## Search for workflow executions
### Get filtered workflow executions as admin via proxy (COMPLETED) GET http://localhost:8088/proxy/api/workflow/search?query=status+IN+(COMPLETED) x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 0, response.body);
}); %}
### Get filtered workflow executions as admin via proxy (executed by fb-operator) GET http://localhost:8088/proxy/api/workflow/search?query=correlationId+IN+(fb-operator) x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 1, response.body);
}); %}
### Get all workflow executions as admin via proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 3, response.body);
}); %}
### Get all workflow executions as admin via rbac proxy GET http://localhost:8088/rbac_proxy/api/workflow/search x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 2, response.body);
}); %}
### Get all workflow executions as operator via rbac proxy GET http://localhost:8088/rbac_proxy/api/workflow/search x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 1, response.body);
}); %}
## Delete workflow executions
### Delete workflow execution as operator via rbac-proxy: FAIL 401 wrong correlation ID DELETE http://localhost:8088/rbac_proxy/api/workflow/{{admin_exec_1}}/remove x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
### Delete workflow execution as operator via rbac-proxy DELETE http://localhost:8088/rbac_proxy/api/workflow/{{oper_exec_1}}/remove x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
### Delete workflow execution as admin via proxy DELETE http://localhost:8088/proxy/api/workflow/{{admin_exec_1}}/remove x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
### Delete workflow execution as admin via proxy DELETE http://localhost:8088/proxy/api/workflow/{{admin_exec_2}}/remove x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
################ WORKFLOW END ################
################ WORKFLOW METADATA DELETION ################
## Delete a single workflow def
### Delete workflow def as operator via rbac_proxy: FAIL 401 DELETE http://localhost:8088/rbac_proxy/api/metadata/workflow/fx1/1 x-tenant-id: fb from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 404, response);
}); %}
### Delete workflow def as admin via proxy DELETE http://localhost:8088/proxy/api/metadata/workflow/fx1/1 x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
### Delete workflow def as admin via proxy DELETE http://localhost:8088/proxy/api/metadata/workflow/fx3/1 x-tenant-id: fb from: fb-user x-auth-user-roles: OWNER
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
################ WORKFLOW METADATA DELETION END ################