/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.772.0
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// 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
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WhileloopFlow {
/// Steps to execute in each iteration
#[serde(rename = "modules")]
pub modules: Vec<models::FlowModule>,
/// If true, iteration failures don't stop the loop. Failed iterations return null
#[serde(rename = "skip_failures")]
pub skip_failures: bool,
#[serde(rename = "type")]
pub r#type: Type,
/// If true, iterations run concurrently (use with caution in while loops)
#[serde(rename = "parallel", skip_serializing_if = "Option::is_none")]
pub parallel: Option<bool>,
#[serde(rename = "parallelism", skip_serializing_if = "Option::is_none")]
pub parallelism: Option<Box<models::InputTransform>>,
#[serde(rename = "squash", skip_serializing_if = "Option::is_none")]
pub squash: Option<bool>,
}
impl 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
pub fn new(modules: Vec<models::FlowModule>, skip_failures: bool, r#type: Type) -> WhileloopFlow {
WhileloopFlow {
modules,
skip_failures,
r#type,
parallel: None,
parallelism: None,
squash: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "whileloopflow")]
Whileloopflow,
}
impl Default for Type {
fn default() -> Type {
Self::Whileloopflow
}
}