pub enum EscalationPolicy {
AutoApprove,
AutoReject,
Notify(Vec<NotificationTarget>),
Escalate(Assignee),
Chain(Vec<EscalationPolicy>),
}Expand description
What to do when an approval gate misses its SLA deadline.
§Examples
use ironflow_engine::config::{EscalationPolicy, NotificationTarget};
// Warn the on-call channel after one hour, give up after two.
let policy = EscalationPolicy::Chain(vec![
EscalationPolicy::Notify(vec![NotificationTarget::Slack {
webhook_url: "https://hooks.slack.com/services/T/B/X".to_string(),
channel: "#deploys".to_string(),
}]),
EscalationPolicy::AutoReject,
]);
assert_eq!(policy.len(), 2);Variants§
AutoApprove
Complete the step with approved_by: "system:timeout" and resume the run.
AutoReject
Fail the step and the run with the reason "approval timeout".
Notify(Vec<NotificationTarget>)
Notify each target without changing state, then restart the timer.
Escalate(Assignee)
Reassign the approval to another user or group, then restart the timer.
Chain(Vec<EscalationPolicy>)
Apply the policies one per expiry, in order.
Implementations§
Source§impl EscalationPolicy
impl EscalationPolicy
Sourcepub fn stage(&self, index: usize) -> Option<&EscalationPolicy>
pub fn stage(&self, index: usize) -> Option<&EscalationPolicy>
The policy to apply at escalation stage index.
For a Chain, this is the index-th link.
For any other variant, stage 0 is the policy itself and every later
stage is None — the chain is exhausted. A repeating policy never
reaches stage 1 outside a chain because it re-arms at the same stage;
see is_repeating.
§Examples
use ironflow_engine::config::EscalationPolicy;
use ironflow_store::entities::Assignee;
let single = EscalationPolicy::AutoReject;
assert_eq!(single.stage(0), Some(&EscalationPolicy::AutoReject));
assert_eq!(single.stage(1), None);
let chain = EscalationPolicy::Chain(vec![
EscalationPolicy::Escalate(Assignee::group("sre-oncall")),
EscalationPolicy::AutoReject,
]);
assert_eq!(chain.stage(1), Some(&EscalationPolicy::AutoReject));
assert_eq!(chain.stage(2), None);Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Whether this policy resolves the gate instead of leaving it open.
§Examples
use ironflow_engine::config::EscalationPolicy;
use ironflow_store::entities::Assignee;
assert!(EscalationPolicy::AutoApprove.is_terminal());
assert!(EscalationPolicy::AutoReject.is_terminal());
assert!(!EscalationPolicy::Escalate(Assignee::group("sre")).is_terminal());Sourcepub fn is_repeating(&self) -> bool
pub fn is_repeating(&self) -> bool
Whether this policy re-arms the timer at the same stage.
Outside a Chain, a repeating policy fires
again at every expiry until a human resolves the gate. Inside a chain,
the stage still advances so the next link eventually runs.
§Examples
use ironflow_engine::config::EscalationPolicy;
use ironflow_store::entities::Assignee;
assert!(EscalationPolicy::Notify(Vec::new()).is_repeating());
assert!(EscalationPolicy::Escalate(Assignee::group("sre")).is_repeating());
assert!(!EscalationPolicy::AutoApprove.is_repeating());Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether this policy declares no stage at all.
Only an empty Chain is empty: it never
escalates, and the gate stays open with no timer after the first expiry.
§Examples
use ironflow_engine::config::EscalationPolicy;
assert!(EscalationPolicy::Chain(Vec::new()).is_empty());
assert!(!EscalationPolicy::AutoReject.is_empty());Trait Implementations§
Source§impl Clone for EscalationPolicy
impl Clone for EscalationPolicy
Source§impl Debug for EscalationPolicy
impl Debug for EscalationPolicy
Source§impl<'de> Deserialize<'de> for EscalationPolicy
impl<'de> Deserialize<'de> for EscalationPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EscalationPolicy
Source§impl<'_derivative_strum> From<&'_derivative_strum EscalationPolicy> for &'static str
impl<'_derivative_strum> From<&'_derivative_strum EscalationPolicy> for &'static str
Source§fn from(x: &'_derivative_strum EscalationPolicy) -> &'static str
fn from(x: &'_derivative_strum EscalationPolicy) -> &'static str
Source§impl From<EscalationPolicy> for &'static str
impl From<EscalationPolicy> for &'static str
Source§fn from(x: EscalationPolicy) -> &'static str
fn from(x: EscalationPolicy) -> &'static str
Source§impl PartialEq for EscalationPolicy
impl PartialEq for EscalationPolicy
Source§impl Serialize for EscalationPolicy
impl Serialize for EscalationPolicy
impl StructuralPartialEq for EscalationPolicy
Auto Trait Implementations§
impl Freeze for EscalationPolicy
impl RefUnwindSafe for EscalationPolicy
impl Send for EscalationPolicy
impl Sync for EscalationPolicy
impl Unpin for EscalationPolicy
impl UnsafeUnpin for EscalationPolicy
impl UnwindSafe for EscalationPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.