windmill-api 1.683.1

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.1
 * 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 EditSchedule {
    /// 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,
    /// The arguments to pass to the script or flow
    #[serde(rename = "args")]
    pub args: std::collections::HashMap<String, serde_json::Value>,
    /// 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 (e.g., 'u/admin' or 'g/mygroup'). Only admins and wm_deployers can set this via preserve_permissioned_as.
    #[serde(rename = "permissioned_as", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub permissioned_as: Option<Option<String>>,
    /// If true and user is admin/wm_deployers, preserve the provided permissioned_as instead of using the deploying user's identity
    #[serde(rename = "preserve_permissioned_as", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub preserve_permissioned_as: Option<Option<bool>>,
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<String>>,
}

impl EditSchedule {
    pub fn new(schedule: String, timezone: String, args: std::collections::HashMap<String, serde_json::Value>) -> EditSchedule {
        EditSchedule {
            schedule,
            timezone,
            args,
            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,
        }
    }
}