Skip to main content

windmill_api/models/
flow_value.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.864.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// FlowValue : The flow structure containing modules and optional preprocessor/failure handlers
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct FlowValue {
17    /// Array of steps that execute in sequence. Each step can be a script, subflow, loop, or branch
18    #[serde(rename = "modules")]
19    pub modules: Vec<models::FlowModule>,
20    #[serde(rename = "failure_module", skip_serializing_if = "Option::is_none")]
21    pub failure_module: Option<Box<models::FlowModule>>,
22    #[serde(rename = "preprocessor_module", skip_serializing_if = "Option::is_none")]
23    pub preprocessor_module: Option<Box<models::FlowModule>>,
24    /// If true, all steps run on the same worker for better performance
25    #[serde(rename = "same_worker", skip_serializing_if = "Option::is_none")]
26    pub same_worker: Option<bool>,
27    /// 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.
28    #[serde(rename = "preserve_step_tags", skip_serializing_if = "Option::is_none")]
29    pub preserve_step_tags: Option<bool>,
30    /// Maximum number of concurrent executions of this flow
31    #[serde(rename = "concurrent_limit", skip_serializing_if = "Option::is_none")]
32    pub concurrent_limit: Option<f64>,
33    /// Expression to group concurrent executions (e.g., by user ID)
34    #[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")]
35    pub concurrency_key: Option<String>,
36    /// Time window in seconds for concurrent_limit
37    #[serde(rename = "concurrency_time_window_s", skip_serializing_if = "Option::is_none")]
38    pub concurrency_time_window_s: Option<f64>,
39    /// 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.
40    #[serde(rename = "on_concurrency_limit", skip_serializing_if = "Option::is_none")]
41    pub on_concurrency_limit: Option<OnConcurrencyLimit>,
42    /// Delay in seconds to debounce flow executions
43    #[serde(rename = "debounce_delay_s", skip_serializing_if = "Option::is_none")]
44    pub debounce_delay_s: Option<i32>,
45    /// Expression to group debounced executions
46    #[serde(rename = "debounce_key", skip_serializing_if = "Option::is_none")]
47    pub debounce_key: Option<String>,
48    /// Arguments to accumulate across debounced executions
49    #[serde(rename = "debounce_args_to_accumulate", skip_serializing_if = "Option::is_none")]
50    pub debounce_args_to_accumulate: Option<Vec<String>>,
51    /// Maximum total time in seconds that a job can be debounced
52    #[serde(rename = "max_total_debouncing_time", skip_serializing_if = "Option::is_none")]
53    pub max_total_debouncing_time: Option<i32>,
54    /// Maximum number of times a job can be debounced
55    #[serde(rename = "max_total_debounces_amount", skip_serializing_if = "Option::is_none")]
56    pub max_total_debounces_amount: Option<i32>,
57    /// JavaScript expression to conditionally skip the entire flow
58    #[serde(rename = "skip_expr", skip_serializing_if = "Option::is_none")]
59    pub skip_expr: Option<String>,
60    /// Cache duration in seconds for flow results
61    #[serde(rename = "cache_ttl", skip_serializing_if = "Option::is_none")]
62    pub cache_ttl: Option<f64>,
63    #[serde(rename = "cache_ignore_s3_path", skip_serializing_if = "Option::is_none")]
64    pub cache_ignore_s3_path: Option<bool>,
65    /// If set, delete the flow job's args, result and logs after this many seconds following job completion
66    #[serde(rename = "delete_after_secs", skip_serializing_if = "Option::is_none")]
67    pub delete_after_secs: Option<i32>,
68    /// 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.
69    #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
70    pub timeout: Option<i32>,
71    /// Environment variables available to all steps. Values can be strings, JSON values, or special references: '$var:path' (workspace variable) or '$res:path' (resource).
72    #[serde(rename = "flow_env", skip_serializing_if = "Option::is_none")]
73    pub flow_env: Option<std::collections::HashMap<String, serde_json::Value>>,
74    /// Execution priority (higher numbers run first)
75    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
76    pub priority: Option<f64>,
77    /// 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.
78    #[serde(rename = "early_return", skip_serializing_if = "Option::is_none")]
79    pub early_return: Option<String>,
80    /// Whether this flow accepts chat-style input
81    #[serde(rename = "chat_input_enabled", skip_serializing_if = "Option::is_none")]
82    pub chat_input_enabled: Option<bool>,
83    /// Sticky notes attached to the flow
84    #[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
85    pub notes: Option<Vec<models::FlowNote>>,
86    /// Semantic groups of modules for organizational purposes
87    #[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
88    pub groups: Option<Vec<models::FlowGroup>>,
89}
90
91impl FlowValue {
92    /// The flow structure containing modules and optional preprocessor/failure handlers
93    pub fn new(modules: Vec<models::FlowModule>) -> FlowValue {
94        FlowValue {
95            modules,
96            failure_module: None,
97            preprocessor_module: None,
98            same_worker: None,
99            preserve_step_tags: None,
100            concurrent_limit: None,
101            concurrency_key: None,
102            concurrency_time_window_s: None,
103            on_concurrency_limit: None,
104            debounce_delay_s: None,
105            debounce_key: None,
106            debounce_args_to_accumulate: None,
107            max_total_debouncing_time: None,
108            max_total_debounces_amount: None,
109            skip_expr: None,
110            cache_ttl: None,
111            cache_ignore_s3_path: None,
112            delete_after_secs: None,
113            timeout: None,
114            flow_env: None,
115            priority: None,
116            early_return: None,
117            chat_input_enabled: None,
118            notes: None,
119            groups: None,
120        }
121    }
122}
123/// 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.
124#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
125pub enum OnConcurrencyLimit {
126    #[serde(rename = "queue")]
127    Queue,
128    #[serde(rename = "fail")]
129    Fail,
130}
131
132impl Default for OnConcurrencyLimit {
133    fn default() -> OnConcurrencyLimit {
134        Self::Queue
135    }
136}
137