Skip to main content

windmill_api/models/
whileloop_flow.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/// WhileloopFlow : Executes nested modules repeatedly until stopped. The implicit iterator is the iteration counter, so 'flow_input.iter.value' equals 'flow_input.iter.index' (0, 1, 2, ...) and never carries state. To carry state across iterations, a step reads its own previous-iteration result via 'results.<its_own_id>' with a first-iteration fallback - the loop's stop_after_if must then be on that inner step (a plain single-step body with stop_after_if on the loop module does not resolve 'results' across iterations and never terminates); plain counters can instead be derived from 'flow_input.iter.index', which works in every configuration. stop_after_if is evaluated after each iteration - on the loop module 'result' is the last iteration's result
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct WhileloopFlow {
17    /// Steps to execute in each iteration
18    #[serde(rename = "modules")]
19    pub modules: Vec<models::FlowModule>,
20    /// If true, iteration failures don't stop the loop. Failed iterations return null
21    #[serde(rename = "skip_failures")]
22    pub skip_failures: bool,
23    #[serde(rename = "type")]
24    pub r#type: Type,
25    /// If true, iterations run concurrently (use with caution in while loops)
26    #[serde(rename = "parallel", skip_serializing_if = "Option::is_none")]
27    pub parallel: Option<bool>,
28    #[serde(rename = "parallelism", skip_serializing_if = "Option::is_none")]
29    pub parallelism: Option<Box<models::InputTransform>>,
30    #[serde(rename = "squash", skip_serializing_if = "Option::is_none")]
31    pub squash: Option<bool>,
32    /// Maximum number of iterations. Checked after each iteration; when reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'
33    #[serde(rename = "max_iterations", skip_serializing_if = "Option::is_none")]
34    pub max_iterations: Option<i32>,
35    /// Maximum wall-clock seconds since the first iteration started, checked after each iteration. A running iteration is not interrupted, so the loop can exceed the limit by up to one iteration; the timeout of the body's steps caps an iteration. When reached and stop_after_if did not stop the loop, the loop fails with an error named 'LoopExhausted'
36    #[serde(rename = "max_duration_secs", skip_serializing_if = "Option::is_none")]
37    pub max_duration_secs: Option<i32>,
38}
39
40impl WhileloopFlow {
41    /// Executes nested modules repeatedly until stopped. The implicit iterator is the iteration counter, so 'flow_input.iter.value' equals 'flow_input.iter.index' (0, 1, 2, ...) and never carries state. To carry state across iterations, a step reads its own previous-iteration result via 'results.<its_own_id>' with a first-iteration fallback - the loop's stop_after_if must then be on that inner step (a plain single-step body with stop_after_if on the loop module does not resolve 'results' across iterations and never terminates); plain counters can instead be derived from 'flow_input.iter.index', which works in every configuration. stop_after_if is evaluated after each iteration - on the loop module 'result' is the last iteration's result
42    pub fn new(modules: Vec<models::FlowModule>, skip_failures: bool, r#type: Type) -> WhileloopFlow {
43        WhileloopFlow {
44            modules,
45            skip_failures,
46            r#type,
47            parallel: None,
48            parallelism: None,
49            squash: None,
50            max_iterations: None,
51            max_duration_secs: None,
52        }
53    }
54}
55/// 
56#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
57pub enum Type {
58    #[serde(rename = "whileloopflow")]
59    Whileloopflow,
60}
61
62impl Default for Type {
63    fn default() -> Type {
64        Self::Whileloopflow
65    }
66}
67