Skip to main content

windmill_api/models/
edit_schedule.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.645.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct EditSchedule {
16    /// Cron expression with 6 fields (seconds, minutes, hours, day of month, month, day of week). Example '0 0 12 * * *' for daily at noon
17    #[serde(rename = "schedule")]
18    pub schedule: String,
19    /// IANA timezone for the schedule (e.g., 'UTC', 'Europe/Paris', 'America/New_York')
20    #[serde(rename = "timezone")]
21    pub timezone: String,
22    /// The arguments to pass to the script or flow
23    #[serde(rename = "args")]
24    pub args: std::collections::HashMap<String, serde_json::Value>,
25    /// Path to a script or flow to run when the scheduled job fails
26    #[serde(rename = "on_failure", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub on_failure: Option<Option<String>>,
28    /// Number of consecutive failures before the on_failure handler is triggered (default 1)
29    #[serde(rename = "on_failure_times", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub on_failure_times: Option<Option<f64>>,
31    /// If true, trigger on_failure handler only on exactly N failures, not on every failure after N
32    #[serde(rename = "on_failure_exact", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub on_failure_exact: Option<Option<bool>>,
34    /// The arguments to pass to the script or flow
35    #[serde(rename = "on_failure_extra_args", skip_serializing_if = "Option::is_none")]
36    pub on_failure_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
37    /// Path to a script or flow to run when the schedule recovers after failures
38    #[serde(rename = "on_recovery", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub on_recovery: Option<Option<String>>,
40    /// Number of consecutive successes before the on_recovery handler is triggered (default 1)
41    #[serde(rename = "on_recovery_times", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
42    pub on_recovery_times: Option<Option<f64>>,
43    /// The arguments to pass to the script or flow
44    #[serde(rename = "on_recovery_extra_args", skip_serializing_if = "Option::is_none")]
45    pub on_recovery_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
46    /// Path to a script or flow to run after each successful execution
47    #[serde(rename = "on_success", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
48    pub on_success: Option<Option<String>>,
49    /// The arguments to pass to the script or flow
50    #[serde(rename = "on_success_extra_args", skip_serializing_if = "Option::is_none")]
51    pub on_success_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
52    /// If true, the workspace-level error handler will not be triggered for this schedule's failures
53    #[serde(rename = "ws_error_handler_muted", skip_serializing_if = "Option::is_none")]
54    pub ws_error_handler_muted: Option<bool>,
55    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
56    pub retry: Option<Box<models::Retry>>,
57    /// If true, skip this schedule's execution if the previous run is still in progress (prevents concurrent runs)
58    #[serde(rename = "no_flow_overlap", skip_serializing_if = "Option::is_none")]
59    pub no_flow_overlap: Option<bool>,
60    /// Short summary describing the purpose of this schedule
61    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
62    pub summary: Option<Option<String>>,
63    /// Detailed description of what this schedule does
64    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
65    pub description: Option<Option<String>>,
66    /// Worker tag to route jobs to specific worker groups
67    #[serde(rename = "tag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
68    pub tag: Option<Option<String>>,
69    /// ISO 8601 datetime until which the schedule is paused. Schedule resumes automatically after this time
70    #[serde(rename = "paused_until", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
71    pub paused_until: Option<Option<String>>,
72    /// Cron parser version. Use 'v2' for extended syntax with additional features
73    #[serde(rename = "cron_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
74    pub cron_version: Option<Option<String>>,
75    /// Path to a script that validates scheduled datetimes. Receives scheduled_for datetime and returns boolean to skip (true) or run (false)
76    #[serde(rename = "dynamic_skip", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
77    pub dynamic_skip: Option<Option<String>>,
78    /// Email of the user who the scheduled jobs run as. Used during deployment to preserve the original schedule owner.
79    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
80    pub email: Option<String>,
81    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original email value instead of overwriting it.
82    #[serde(rename = "preserve_email", skip_serializing_if = "Option::is_none")]
83    pub preserve_email: Option<bool>,
84}
85
86impl EditSchedule {
87    pub fn new(schedule: String, timezone: String, args: std::collections::HashMap<String, serde_json::Value>) -> EditSchedule {
88        EditSchedule {
89            schedule,
90            timezone,
91            args,
92            on_failure: None,
93            on_failure_times: None,
94            on_failure_exact: None,
95            on_failure_extra_args: None,
96            on_recovery: None,
97            on_recovery_times: None,
98            on_recovery_extra_args: None,
99            on_success: None,
100            on_success_extra_args: None,
101            ws_error_handler_muted: None,
102            retry: None,
103            no_flow_overlap: None,
104            summary: None,
105            description: None,
106            tag: None,
107            paused_until: None,
108            cron_version: None,
109            dynamic_skip: None,
110            email: None,
111            preserve_email: None,
112        }
113    }
114}
115