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.772.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}
33
34impl WhileloopFlow {
35 /// 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
36 pub fn new(modules: Vec<models::FlowModule>, skip_failures: bool, r#type: Type) -> WhileloopFlow {
37 WhileloopFlow {
38 modules,
39 skip_failures,
40 r#type,
41 parallel: None,
42 parallelism: None,
43 squash: None,
44 }
45 }
46}
47///
48#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
49pub enum Type {
50 #[serde(rename = "whileloopflow")]
51 Whileloopflow,
52}
53
54impl Default for Type {
55 fn default() -> Type {
56 Self::Whileloopflow
57 }
58}
59