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.727.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 Schedule {
16    /// The unique Windmill path for this schedule. Must be of the form `u/<user>/<path>` or `f/<folder>/<path>`.
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    /// The user or group this schedule runs as (e.g., 'u/admin' or 'g/mygroup')
50    #[serde(rename = "permissioned_as")]
51    pub permissioned_as: String,
52    /// Last error message if the schedule failed to trigger
53    #[serde(rename = "error", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
54    pub error: Option<Option<String>>,
55    /// Path to a script or flow to run when the scheduled job fails
56    #[serde(rename = "on_failure", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
57    pub on_failure: Option<Option<String>>,
58    /// Number of consecutive failures before the on_failure handler is triggered (default 1)
59    #[serde(rename = "on_failure_times", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
60    pub on_failure_times: Option<Option<f64>>,
61    /// If true, trigger on_failure handler only on exactly N failures, not on every failure after N
62    #[serde(rename = "on_failure_exact", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
63    pub on_failure_exact: Option<Option<bool>>,
64    /// The arguments to pass to the script or flow
65    #[serde(rename = "on_failure_extra_args", skip_serializing_if = "Option::is_none")]
66    pub on_failure_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
67    /// Path to a script or flow to run when the schedule recovers after failures
68    #[serde(rename = "on_recovery", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
69    pub on_recovery: Option<Option<String>>,
70    /// Number of consecutive successes before the on_recovery handler is triggered (default 1)
71    #[serde(rename = "on_recovery_times", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
72    pub on_recovery_times: Option<Option<f64>>,
73    /// The arguments to pass to the script or flow
74    #[serde(rename = "on_recovery_extra_args", skip_serializing_if = "Option::is_none")]
75    pub on_recovery_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
76    /// Path to a script or flow to run after each successful execution
77    #[serde(rename = "on_success", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
78    pub on_success: Option<Option<String>>,
79    /// The arguments to pass to the script or flow
80    #[serde(rename = "on_success_extra_args", skip_serializing_if = "Option::is_none")]
81    pub on_success_extra_args: Option<std::collections::HashMap<String, serde_json::Value>>,
82    /// If true, the workspace-level error handler will not be triggered for this schedule's failures
83    #[serde(rename = "ws_error_handler_muted", skip_serializing_if = "Option::is_none")]
84    pub ws_error_handler_muted: Option<bool>,
85    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
86    pub retry: Option<Box<models::Retry>>,
87    /// Short summary describing the purpose of this schedule
88    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
89    pub summary: Option<Option<String>>,
90    /// Detailed description of what this schedule does
91    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
92    pub description: Option<Option<String>>,
93    /// If true, skip this schedule's execution if the previous run is still in progress (prevents concurrent runs)
94    #[serde(rename = "no_flow_overlap", skip_serializing_if = "Option::is_none")]
95    pub no_flow_overlap: Option<bool>,
96    /// Worker tag to route jobs to specific worker groups
97    #[serde(rename = "tag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
98    pub tag: Option<Option<String>>,
99    /// ISO 8601 datetime until which the schedule is paused. Schedule resumes automatically after this time
100    #[serde(rename = "paused_until", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
101    pub paused_until: Option<Option<String>>,
102    /// Cron parser version. Use 'v2' for extended syntax with additional features
103    #[serde(rename = "cron_version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
104    pub cron_version: Option<Option<String>>,
105    /// Path to a script that validates scheduled datetimes. Receives scheduled_for datetime and returns boolean to skip (true) or run (false)
106    #[serde(rename = "dynamic_skip", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
107    pub dynamic_skip: Option<Option<String>>,
108    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
109    pub labels: Option<Vec<String>>,
110    /// True when this row is a per-user draft with no deployed schedule at the same path. Frontend renders a \"Draft\" badge. 
111    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
112    pub draft_only: Option<bool>,
113    /// True when the authed user has a per-user draft at this path (over a deployed row or a synthesized draft-only row). Frontend appends a `*` to the displayed name. 
114    #[serde(rename = "is_draft", skip_serializing_if = "Option::is_none")]
115    pub is_draft: Option<bool>,
116    /// Labels inherited from the parent folder, computed at read time. Read-only — edit them on the folder. 
117    #[serde(rename = "inherited_labels", skip_serializing_if = "Option::is_none")]
118    pub inherited_labels: Option<Vec<String>>,
119}
120
121impl Schedule {
122    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, permissioned_as: String) -> Schedule {
123        Schedule {
124            path,
125            edited_by,
126            edited_at,
127            schedule,
128            timezone,
129            enabled,
130            script_path,
131            is_flow,
132            args: None,
133            extra_perms,
134            email,
135            permissioned_as,
136            error: None,
137            on_failure: None,
138            on_failure_times: None,
139            on_failure_exact: None,
140            on_failure_extra_args: None,
141            on_recovery: None,
142            on_recovery_times: None,
143            on_recovery_extra_args: None,
144            on_success: None,
145            on_success_extra_args: None,
146            ws_error_handler_muted: None,
147            retry: None,
148            summary: None,
149            description: None,
150            no_flow_overlap: None,
151            tag: None,
152            paused_until: None,
153            cron_version: None,
154            dynamic_skip: None,
155            labels: None,
156            draft_only: None,
157            is_draft: None,
158            inherited_labels: None,
159        }
160    }
161}
162