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.896.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    #[serde(rename = "failure_threshold", skip_serializing_if = "Option::is_none")]
39    pub failure_threshold: Option<Box<models::InputTransform>>,
40}
41
42impl WhileloopFlow {
43    /// 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
44    pub fn new(modules: Vec<models::FlowModule>, skip_failures: bool, r#type: Type) -> WhileloopFlow {
45        WhileloopFlow {
46            modules,
47            skip_failures,
48            r#type,
49            parallel: None,
50            parallelism: None,
51            squash: None,
52            max_iterations: None,
53            max_duration_secs: None,
54            failure_threshold: None,
55        }
56    }
57}
58/// 
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum Type {
61    #[serde(rename = "whileloopflow")]
62    Whileloopflow,
63}
64
65impl Default for Type {
66    fn default() -> Type {
67        Self::Whileloopflow
68    }
69}
70