| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- syntax = "proto3";
- package smartbotic.proto;
- // Lets a running workflow switch another workflow on or off, and read its
- // state, without going through the REST API.
- //
- // It lives on the webserver rather than in the runner because the webserver
- // owns the scheduler. Writing "active" straight into the workflows collection
- // would set a flag nothing acts on: registering and unregistering triggers
- // happens here, and a workflow switched on by a database write would sit there
- // looking enabled and never run.
- //
- // Served on the same port as CredentialService, and for the same reason - the
- // runner already holds a channel to it, and a request says which workflow is
- // asking so the webserver can decide whether to allow it.
- service WorkflowControlService {
- // Switch a workflow on or off. Registers or unregisters its triggers as
- // part of the same call.
- rpc SetWorkflowActive(SetWorkflowActiveRequest) returns (SetWorkflowActiveResponse);
- // What a workflow's state is: whether it is on, and how close it is to
- // being switched off by consecutive failures.
- rpc GetWorkflowState(GetWorkflowStateRequest) returns (GetWorkflowStateResponse);
- }
- message SetWorkflowActiveRequest {
- string workflow_id = 1; // the workflow to switch
- bool active = 2;
- string requesting_workflow_id = 3; // who is asking, for access control
- }
- message SetWorkflowActiveResponse {
- bool success = 1;
- bool active = 2; // the state afterwards
- bool changed = 3; // false when it was already in that state
- string error = 4;
- }
- message GetWorkflowStateRequest {
- string workflow_id = 1;
- string requesting_workflow_id = 2;
- }
- message GetWorkflowStateResponse {
- bool success = 1;
- string name = 2;
- bool active = 3;
- int32 consecutive_failures = 4;
- int32 deactivate_after_failures = 5; // 0 when the workflow never switches itself off
- string deactivated_reason = 6; // why it switched itself off, when it did
- int64 published_version = 7;
- string error = 8;
- }
|