pub struct CreateRunRequest {
pub workflow: String,
pub payload: Option<Value>,
pub labels: Option<HashMap<String, String>>,
pub scheduled_at: Option<DateTime<Utc>>,
pub max_retries: Option<u32>,
pub max_cost_usd: Option<Decimal>,
}Expand description
Request to trigger a workflow.
§Examples
use ironflow_api::entities::CreateRunRequest;
use serde_json::json;
let req = CreateRunRequest {
workflow: "deploy".to_string(),
payload: Some(json!({"env": "prod"})),
labels: None,
scheduled_at: None,
max_retries: Some(2),
max_cost_usd: None,
};
assert_eq!(req.workflow, "deploy");Fields§
§workflow: StringThe workflow name to trigger.
payload: Option<Value>Optional input payload for the workflow.
labels: Option<HashMap<String, String>>Optional key-value labels for categorization and filtering.
scheduled_at: Option<DateTime<Utc>>Optional deferred execution time. None means run immediately.
max_retries: Option<u32>How many times the run may be replayed automatically after a transient
failure. Defaults to 0, meaning no automatic retry.
Each retry waits an exponential backoff (30 s, 2 min, 8 min, capped at 15 min) before the run is replayed from the start. Failures that cannot succeed on replay – an unknown workflow, an invalid payload, an exhausted agent budget, a rejected approval, a manual cancellation – consume no attempt.
max_cost_usd: Option<Decimal>Optional cumulative cost cap for this run, in USD.
Overrides the workflow default and the server default. None falls back
to those. Must be zero or positive.
Implementations§
Source§impl CreateRunRequest
impl CreateRunRequest
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the request body.
§Errors
Returns a human-readable message when max_cost_usd is negative.
§Examples
use ironflow_api::entities::CreateRunRequest;
use rust_decimal::Decimal;
let req = CreateRunRequest {
workflow: "deploy".to_string(),
payload: None,
labels: None,
scheduled_at: None,
max_retries: None,
max_cost_usd: Some(Decimal::new(-1, 0)),
};
assert!(req.validate().is_err());