/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.864.0
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// FlowValue : The flow structure containing modules and optional preprocessor/failure handlers
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FlowValue {
/// Array of steps that execute in sequence. Each step can be a script, subflow, loop, or branch
#[serde(rename = "modules")]
pub modules: Vec<models::FlowModule>,
#[serde(rename = "failure_module", skip_serializing_if = "Option::is_none")]
pub failure_module: Option<Box<models::FlowModule>>,
#[serde(rename = "preprocessor_module", skip_serializing_if = "Option::is_none")]
pub preprocessor_module: Option<Box<models::FlowModule>>,
/// If true, all steps run on the same worker for better performance
#[serde(rename = "same_worker", skip_serializing_if = "Option::is_none")]
pub same_worker: Option<bool>,
/// If true and the flow runs on a custom worker tag, steps that declare their own non-empty tag run on it instead of inheriting the flow tag. Steps without their own tag still inherit the flow tag.
#[serde(rename = "preserve_step_tags", skip_serializing_if = "Option::is_none")]
pub preserve_step_tags: Option<bool>,
/// Maximum number of concurrent executions of this flow
#[serde(rename = "concurrent_limit", skip_serializing_if = "Option::is_none")]
pub concurrent_limit: Option<f64>,
/// Expression to group concurrent executions (e.g., by user ID)
#[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")]
pub concurrency_key: Option<String>,
/// Time window in seconds for concurrent_limit
#[serde(rename = "concurrency_time_window_s", skip_serializing_if = "Option::is_none")]
pub concurrency_time_window_s: Option<f64>,
/// What a run of this flow does when its concurrency limit is reached. `queue` (default) re-queues it to a later slot, `fail` ends it immediately as failed, like any failed step.
#[serde(rename = "on_concurrency_limit", skip_serializing_if = "Option::is_none")]
pub on_concurrency_limit: Option<OnConcurrencyLimit>,
/// Delay in seconds to debounce flow executions
#[serde(rename = "debounce_delay_s", skip_serializing_if = "Option::is_none")]
pub debounce_delay_s: Option<i32>,
/// Expression to group debounced executions
#[serde(rename = "debounce_key", skip_serializing_if = "Option::is_none")]
pub debounce_key: Option<String>,
/// Arguments to accumulate across debounced executions
#[serde(rename = "debounce_args_to_accumulate", skip_serializing_if = "Option::is_none")]
pub debounce_args_to_accumulate: Option<Vec<String>>,
/// Maximum total time in seconds that a job can be debounced
#[serde(rename = "max_total_debouncing_time", skip_serializing_if = "Option::is_none")]
pub max_total_debouncing_time: Option<i32>,
/// Maximum number of times a job can be debounced
#[serde(rename = "max_total_debounces_amount", skip_serializing_if = "Option::is_none")]
pub max_total_debounces_amount: Option<i32>,
/// JavaScript expression to conditionally skip the entire flow
#[serde(rename = "skip_expr", skip_serializing_if = "Option::is_none")]
pub skip_expr: Option<String>,
/// Cache duration in seconds for flow results
#[serde(rename = "cache_ttl", skip_serializing_if = "Option::is_none")]
pub cache_ttl: Option<f64>,
#[serde(rename = "cache_ignore_s3_path", skip_serializing_if = "Option::is_none")]
pub cache_ignore_s3_path: Option<bool>,
/// If set, delete the flow job's args, result and logs after this many seconds following job completion
#[serde(rename = "delete_after_secs", skip_serializing_if = "Option::is_none")]
pub delete_after_secs: Option<i32>,
/// Wall-clock limit in seconds for the whole flow run, counted from its start and including time spent sleeping or suspended at an approval. It also applies when the flow is called as a subflow step, unless that step sets its own timeout, which replaces it. It is checked periodically, so a run can go a few seconds past it. When it expires, the running steps are cancelled, the failure module runs if there is one, and the flow ends cancelled with a timeout error. A calling flow sees the subflow step fail with that error.
#[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
pub timeout: Option<i32>,
/// Environment variables available to all steps. Values can be strings, JSON values, or special references: '$var:path' (workspace variable) or '$res:path' (resource).
#[serde(rename = "flow_env", skip_serializing_if = "Option::is_none")]
pub flow_env: Option<std::collections::HashMap<String, serde_json::Value>>,
/// Execution priority (higher numbers run first)
#[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
pub priority: Option<f64>,
/// Id of the step whose result a sync webhook returns as soon as that step completes, while the rest of the flow keeps running. When the step does not run, or fails while the flow has a failure module, the flow's final result is returned instead.
#[serde(rename = "early_return", skip_serializing_if = "Option::is_none")]
pub early_return: Option<String>,
/// Whether this flow accepts chat-style input
#[serde(rename = "chat_input_enabled", skip_serializing_if = "Option::is_none")]
pub chat_input_enabled: Option<bool>,
/// Sticky notes attached to the flow
#[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
pub notes: Option<Vec<models::FlowNote>>,
/// Semantic groups of modules for organizational purposes
#[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<models::FlowGroup>>,
}
impl FlowValue {
/// The flow structure containing modules and optional preprocessor/failure handlers
pub fn new(modules: Vec<models::FlowModule>) -> FlowValue {
FlowValue {
modules,
failure_module: None,
preprocessor_module: None,
same_worker: None,
preserve_step_tags: None,
concurrent_limit: None,
concurrency_key: None,
concurrency_time_window_s: None,
on_concurrency_limit: None,
debounce_delay_s: None,
debounce_key: None,
debounce_args_to_accumulate: None,
max_total_debouncing_time: None,
max_total_debounces_amount: None,
skip_expr: None,
cache_ttl: None,
cache_ignore_s3_path: None,
delete_after_secs: None,
timeout: None,
flow_env: None,
priority: None,
early_return: None,
chat_input_enabled: None,
notes: None,
groups: None,
}
}
}
/// What a run of this flow does when its concurrency limit is reached. `queue` (default) re-queues it to a later slot, `fail` ends it immediately as failed, like any failed step.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OnConcurrencyLimit {
#[serde(rename = "queue")]
Queue,
#[serde(rename = "fail")]
Fail,
}
impl Default for OnConcurrencyLimit {
fn default() -> OnConcurrencyLimit {
Self::Queue
}
}