Skip to main content

windmill_api/models/
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.628.3
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 Schedule {
16    /// The unique path identifier for this schedule
17    #[serde(rename = "path")]
18    pub path: String,
19    /// Username of the last person who edited this schedule
20    #[serde(rename = "edited_by")]
21    pub edited_by: String,
22    /// Timestamp of the last edit
23    #[serde(rename = "edited_at")]
24    pub edited_at: String,
25    /// Cron expression with 6 fields (seconds, minutes, hours, day of month, month, day of week). Example '0 0 12 * * *' for daily at noon
26    #[serde(rename = "schedule")]
27    pub schedule: String,
28    /// IANA timezone for the schedule (e.g., 'UTC', 'Europe/Paris', 'America/New_York')
29    #[serde(rename = "timezone")]
30    pub timezone: String,
31    /// Whether the schedule is currently active and will trigger jobs
32    #[serde(rename = "enabled")]
33    pub enabled: bool,
34    /// Path to the script or flow to execute when triggered
35    #[serde(rename = "script_path")]
36    pub script_path: String,
37    /// True if script_path points to a flow, false if it points to a script
38    #[serde(rename = "is_flow")]
39    pub is_flow: bool,
40    /// The arguments to pass to the script or flow
41    #[serde(rename = "args", skip_serializing_if = "Option::is_none")]
42    pub args: Option<std::collections::HashMap<String, serde_json::Value>>,
43    /// Additional permissions for this schedule
44    #[serde(rename = "extra_perms")]
45    pub extra_perms: std::collections::HashMap<String, bool>,
46    /// Email of the user who owns this schedule, used for permissioned_as
47    #[serde(rename = "email")]
48    pub email: String,
49    /// Last error message if the schedule failed to trigger
50    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
51    pub error: Option<String>,
52    /// Path to a script or flow to run when the scheduled job fails
53    #[serde(rename = "on_failure", skip_serializing_if = "Option::is_none")]
54    pub on_failure: Option<String>,
55    /// Number of consecutive failures before the on_failure handler is triggered (default 1)
56    #[serde(rename = "on_failure_times", skip_serializing_if = "Option::is_none")]
57    pub on_failure_times: Option<f64>,
58    /// If true, trigger on_failure handler only on exactly N failures, not on every failure after N
59    #[serde(rename = "on_failure_exact", skip_serializing_if = "Option::is_none")]
60    pub on_failure_exact: Option<bool>,
61    /// The arguments to pass to the script or flow
62    #[serde(rename = "on_failure_extra_args", skip_serializing_if = "Option::is_none")]
63    pub on_failure_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
64    /// Path to a script or flow to run when the schedule recovers after failures
65    #[serde(rename = "on_recovery", skip_serializing_if = "Option::is_none")]
66    pub on_recovery: Option<String>,
67    /// Number of consecutive successes before the on_recovery handler is triggered (default 1)
68    #[serde(rename = "on_recovery_times", skip_serializing_if = "Option::is_none")]
69    pub on_recovery_times: Option<f64>,
70    /// The arguments to pass to the script or flow
71    #[serde(rename = "on_recovery_extra_args", skip_serializing_if = "Option::is_none")]
72    pub on_recovery_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
73    /// Path to a script or flow to run after each successful execution
74    #[serde(rename = "on_success", skip_serializing_if = "Option::is_none")]
75    pub on_success: Option<String>,
76    /// The arguments to pass to the script or flow
77    #[serde(rename = "on_success_extra_args", skip_serializing_if = "Option::is_none")]
78    pub on_success_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
79    /// If true, the workspace-level error handler will not be triggered for this schedule's failures
80    #[serde(rename = "ws_error_handler_muted", skip_serializing_if = "Option::is_none")]
81    pub ws_error_handler_muted: Option<bool>,
82    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
83    pub retry: Option<Box<models::Retry>>,
84    /// Short summary describing the purpose of this schedule
85    #[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
86    pub summary: Option<String>,
87    /// Detailed description of what this schedule does
88    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
89    pub description: Option<String>,
90    /// If true, skip this schedule's execution if the previous run is still in progress (prevents concurrent runs)
91    #[serde(rename = "no_flow_overlap", skip_serializing_if = "Option::is_none")]
92    pub no_flow_overlap: Option<bool>,
93    /// Worker tag to route jobs to specific worker groups
94    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
95    pub tag: Option<String>,
96    /// ISO 8601 datetime until which the schedule is paused. Schedule resumes automatically after this time
97    #[serde(rename = "paused_until", skip_serializing_if = "Option::is_none")]
98    pub paused_until: Option<String>,
99    /// Cron parser version. Use 'v2' for extended syntax with additional features
100    #[serde(rename = "cron_version", skip_serializing_if = "Option::is_none")]
101    pub cron_version: Option<String>,
102    /// Path to a script that validates scheduled datetimes. Receives scheduled_for datetime and returns boolean to skip (true) or run (false)
103    #[serde(rename = "dynamic_skip", skip_serializing_if = "Option::is_none")]
104    pub dynamic_skip: Option<String>,
105}
106
107impl Schedule {
108    pub fn new(path: String, edited_by: String, edited_at: String, schedule: String, timezone: String, enabled: bool, script_path: String, is_flow: bool, extra_perms: std::collections::HashMap<String, bool>, email: String) -> Schedule {
109        Schedule {
110            path,
111            edited_by,
112            edited_at,
113            schedule,
114            timezone,
115            enabled,
116            script_path,
117            is_flow,
118            args: None,
119            extra_perms,
120            email,
121            error: None,
122            on_failure: None,
123            on_failure_times: None,
124            on_failure_exact: None,
125            on_failure_extra_args: None,
126            on_recovery: None,
127            on_recovery_times: None,
128            on_recovery_extra_args: None,
129            on_success: None,
130            on_success_extra_args: None,
131            ws_error_handler_muted: None,
132            retry: None,
133            summary: None,
134            description: None,
135            no_flow_overlap: None,
136            tag: None,
137            paused_until: None,
138            cron_version: None,
139            dynamic_skip: None,
140        }
141    }
142}
143