windmill-api 1.683.2

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * Windmill API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.683.2
 * Contact: contact@windmill.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NewSchedule {
    /// The unique path identifier for this schedule
    #[serde(rename = "path")]
    pub path: String,
    /// Cron expression with 6 fields (seconds, minutes, hours, day of month, month, day of week). Example '0 0 12 * * *' for daily at noon
    #[serde(rename = "schedule")]
    pub schedule: String,
    /// IANA timezone for the schedule (e.g., 'UTC', 'Europe/Paris', 'America/New_York')
    #[serde(rename = "timezone")]
    pub timezone: String,
    /// Path to the script or flow to execute when triggered
    #[serde(rename = "script_path")]
    pub script_path: String,
    /// True if script_path points to a flow, false if it points to a script
    #[serde(rename = "is_flow")]
    pub is_flow: bool,
    /// The arguments to pass to the script or flow
    #[serde(rename = "args")]
    pub args: std::collections::HashMap<String, serde_json::Value>,
    /// Whether the schedule is currently active and will trigger jobs
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// Path to a script or flow to run when the scheduled job fails
    #[serde(rename = "on_failure", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub on_failure: Option<Option<String>>,
    /// Number of consecutive failures before the on_failure handler is triggered (default 1)
    #[serde(rename = "on_failure_times", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub on_failure_times: Option<Option<f64>>,
    /// If true, trigger on_failure handler only on exactly N failures, not on every failure after N
    #[serde(rename = "on_failure_exact", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub on_failure_exact: Option<Option<bool>>,
    /// The arguments to pass to the script or flow
    #[serde(rename = "on_failure_extra_args", skip_serializing_if = "Option::is_none")]
    pub on_failure_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Path to a script or flow to run when the schedule recovers after failures
    #[serde(rename = "on_recovery", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub on_recovery: Option<Option<String>>,
    /// Number of consecutive successes before the on_recovery handler is triggered (default 1)
    #[serde(rename = "on_recovery_times", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub on_recovery_times: Option<Option<f64>>,
    /// The arguments to pass to the script or flow
    #[serde(rename = "on_recovery_extra_args", skip_serializing_if = "Option::is_none")]
    pub on_recovery_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Path to a script or flow to run after each successful execution
    #[serde(rename = "on_success", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub on_success: Option<Option<String>>,
    /// The arguments to pass to the script or flow
    #[serde(rename = "on_success_extra_args", skip_serializing_if = "Option::is_none")]
    pub on_success_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// If true, the workspace-level error handler will not be triggered for this schedule's failures
    #[serde(rename = "ws_error_handler_muted", skip_serializing_if = "Option::is_none")]
    pub ws_error_handler_muted: Option<bool>,
    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
    pub retry: Option<Box<models::Retry>>,
    /// If true, skip this schedule's execution if the previous run is still in progress (prevents concurrent runs)
    #[serde(rename = "no_flow_overlap", skip_serializing_if = "Option::is_none")]
    pub no_flow_overlap: Option<bool>,
    /// Short summary describing the purpose of this schedule
    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub summary: Option<Option<String>>,
    /// Detailed description of what this schedule does
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    /// Worker tag to route jobs to specific worker groups
    #[serde(rename = "tag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tag: Option<Option<String>>,
    /// ISO 8601 datetime until which the schedule is paused. Schedule resumes automatically after this time
    #[serde(rename = "paused_until", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub paused_until: Option<Option<String>>,
    /// Cron parser version. Use 'v2' for extended syntax with additional features
    #[serde(rename = "cron_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub cron_version: Option<Option<String>>,
    /// Path to a script that validates scheduled datetimes. Receives scheduled_for datetime and returns boolean to skip (true) or run (false)
    #[serde(rename = "dynamic_skip", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub dynamic_skip: Option<Option<String>>,
    /// The user or group this schedule runs as. Used during deployment to preserve the original schedule owner.
    #[serde(rename = "permissioned_as", skip_serializing_if = "Option::is_none")]
    pub permissioned_as: Option<String>,
    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
    #[serde(rename = "preserve_permissioned_as", skip_serializing_if = "Option::is_none")]
    pub preserve_permissioned_as: Option<bool>,
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
}

impl NewSchedule {
    pub fn new(path: String, schedule: String, timezone: String, script_path: String, is_flow: bool, args: std::collections::HashMap<String, serde_json::Value>) -> NewSchedule {
        NewSchedule {
            path,
            schedule,
            timezone,
            script_path,
            is_flow,
            args,
            enabled: None,
            on_failure: None,
            on_failure_times: None,
            on_failure_exact: None,
            on_failure_extra_args: None,
            on_recovery: None,
            on_recovery_times: None,
            on_recovery_extra_args: None,
            on_success: None,
            on_success_extra_args: None,
            ws_error_handler_muted: None,
            retry: None,
            no_flow_overlap: None,
            summary: None,
            description: None,
            tag: None,
            paused_until: None,
            cron_version: None,
            dynamic_skip: None,
            permissioned_as: None,
            preserve_permissioned_as: None,
            labels: None,
        }
    }
}