View Source IncidentIo.WorkflowsV2 (IncidentIo v0.1.0)
Manage workflows.
Workflows allow you to automate certain actions and behaviors based on specific triggers.
Summary
Functions
Create a new workflow.
Archive an existing workflow.
List all workflows for an organisation.
Get a single workflow.
Update an existing workflow.
Functions
@spec create(IncidentIo.Client.t(), request_body()) :: IncidentIo.response()
Create a new workflow.
Workflow body example:
%{
annotations: %{
"incident.io/terraform/version": "3.0.0"
},
condition_groups: [
%{
conditions: [
%{
operation: "one_of",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
],
subject: "incident.severity"
}
]
}
],
continue_on_step_error: true,
delay: %{
conditions_apply_over_delay: false,
for_seconds: 60
},
expressions: [
%{
else_branch: %{
result: %{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
},
label: "Team Slack channel",
operations: [
%{
branches: %{
branches: [
%{
condition_groups: [
%{
conditions: [
%{
operation: "one_of",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
],
subject: "incident.severity"
}
]
}
],
result: %{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
}
],
returns: %{
array: true,
type: "IncidentStatus"
}
},
filter: %{
condition_groups: [
%{
conditions: [
%{
operation: "one_of",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
],
subject: "incident.severity"
}
]
}
]
},
navigate: %{
reference: "catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]"
},
operation_type: "navigate",
parse: %{
returns: %{
array: true,
type: "IncidentStatus"
},
source: "metadata.annotations["github.com/repo"]"
}
}
],
reference: "abc123",
root_reference: "incident.status"
}
],
folder: "My folder 01",
include_private_incidents: true,
name: "My workflow",
once_for: [
"incident.url"
],
runs_on_incident_modes: [
"standard",
"retrospective"
],
runs_on_incidents: "newly_created",
state: "active",
steps: [
%{
for_each: "abc123",
id: "abc123",
name: "pagerduty.escalate",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
]
}
],
trigger: "incident.updated"
}
Example
IncidentIo.WorkflowsV2.create(client, body)
More information at: https://api-docs.incident.io/tag/Workflows-V2#operation/Workflows%20V2_Create
@spec destroy(IncidentIo.Client.t(), binary()) :: IncidentIo.response()
Archive an existing workflow.
Example
IncidentIo.WorkflowsV2.destroy(client, "some-workflow-id")
More information at: https://api-docs.incident.io/tag/Workflows-V2#operation/Workflows%20V2_Delete
@spec list(IncidentIo.Client.t()) :: IncidentIo.response()
List all workflows for an organisation.
Example
IncidentIo.WorkflowsV2.list(client)
More information at: https://api-docs.incident.io/tag/Workflows-V2#operation/Workflows%20V2_List
@spec show(IncidentIo.Client.t(), binary()) :: IncidentIo.response()
Get a single workflow.
Example
IncidentIo.WorkflowsV2.show(client, "some-workflow-id")
More information at: https://api-docs.incident.io/tag/Workflows-V2#operation/Workflows%20V2_Show
@spec update(IncidentIo.Client.t(), binary(), request_body()) :: IncidentIo.response()
Update an existing workflow.
Workflow body example:
%{
annotations: %{
"incident.io/terraform/version": "3.0.0"
},
condition_groups: [
%{
conditions: [
%{
operation: "one_of",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
],
subject: "incident.severity"
}
]
}
],
continue_on_step_error: true,
delay: %{
conditions_apply_over_delay: false,
for_seconds: 60
},
expressions: [
%{
else_branch: %{
result: %{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
},
label: "Team Slack channel",
operations: [
%{
branches: %{
branches: [
%{
condition_groups: [
%{
conditions: [
%{
operation: "one_of",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
],
subject: "incident.severity"
}
]
}
],
result: %{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
}
],
returns: %{
array: true,
type: "IncidentStatus"
}
},
filter: %{
condition_groups: [
%{
conditions: [
%{
operation: "one_of",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
],
subject: "incident.severity"
}
]
}
]
},
navigate: %{
reference: "catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]"
},
operation_type: "navigate",
parse: %{
returns: %{
array: true,
type: "IncidentStatus"
},
source: "metadata.annotations["github.com/repo"]"
}
}
],
reference: "abc123",
root_reference: "incident.status"
}
],
folder: "My folder 01",
include_private_incidents: true,
name: "My workflow",
once_for: [
"incident.url"
],
runs_on_incident_modes: [
"standard",
"retrospective"
],
runs_on_incidents: "newly_created",
state: "active",
steps: [
%{
for_each: "abc123",
id: "abc123",
name: "pagerduty.escalate",
param_bindings: [
%{
array_value: [
%{
literal: "SEV123",
reference: "incident.severity"
}
],
value: %{
literal: "SEV123",
reference: "incident.severity"
}
}
]
}
],
trigger: "incident.updated"
}
Example
IncidentIo.WorkflowsV2.update(client, "some-workflow-id", body)
More information at: https://api-docs.incident.io/tag/Workflows-V2#operation/Workflows%20V2_Update