Skip to main content

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