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.626.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", skip_serializing_if = "Option::is_none")]
27    pub on_failure: Option<String>,
28    /// Number of consecutive failures before the on_failure handler is triggered (default 1)
29    #[serde(rename = "on_failure_times", skip_serializing_if = "Option::is_none")]
30    pub on_failure_times: 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", skip_serializing_if = "Option::is_none")]
33    pub on_failure_exact: 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", skip_serializing_if = "Option::is_none")]
39    pub on_recovery: Option<String>,
40    /// Number of consecutive successes before the on_recovery handler is triggered (default 1)
41    #[serde(rename = "on_recovery_times", skip_serializing_if = "Option::is_none")]
42    pub on_recovery_times: 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", skip_serializing_if = "Option::is_none")]
48    pub on_success: 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", skip_serializing_if = "Option::is_none")]
62    pub summary: Option<String>,
63    /// Detailed description of what this schedule does
64    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
65    pub description: Option<String>,
66    /// Worker tag to route jobs to specific worker groups
67    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
68    pub tag: Option<String>,
69    /// ISO 8601 datetime until which the schedule is paused. Schedule resumes automatically after this time
70    #[serde(rename = "paused_until", skip_serializing_if = "Option::is_none")]
71    pub paused_until: Option<String>,
72    /// Cron parser version. Use 'v2' for extended syntax with additional features
73    #[serde(rename = "cron_version", skip_serializing_if = "Option::is_none")]
74    pub cron_version: 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", skip_serializing_if = "Option::is_none")]
77    pub dynamic_skip: Option<String>,
78}
79
80impl EditSchedule {
81    pub fn new(schedule: String, timezone: String, args: std::collections::HashMap<String, serde_json::Value>) -> EditSchedule {
82        EditSchedule {
83            schedule,
84            timezone,
85            args,
86            on_failure: None,
87            on_failure_times: None,
88            on_failure_exact: None,
89            on_failure_extra_args: None,
90            on_recovery: None,
91            on_recovery_times: None,
92            on_recovery_extra_args: None,
93            on_success: None,
94            on_success_extra_args: None,
95            ws_error_handler_muted: None,
96            retry: None,
97            no_flow_overlap: None,
98            summary: None,
99            description: None,
100            tag: None,
101            paused_until: None,
102            cron_version: None,
103            dynamic_skip: None,
104        }
105    }
106}
107