Skip to main content

windmill_api/models/
new_script.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.818.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 NewScript {
16    #[serde(rename = "path")]
17    pub path: String,
18    /// The hash of the version this one supersedes: deploying with it archives that version and chains the new one onto its history, and a `path` differing from the superseded version's moves the script there.
19    #[serde(rename = "parent_hash", skip_serializing_if = "Option::is_none")]
20    pub parent_hash: Option<String>,
21    /// When true, the backend resolves the parent to the current deployed head for this path within the transaction (ignoring parent_hash), instead of failing with a \"lineage must be linear\" error when the supplied parent_hash is stale.
22    #[serde(rename = "auto_parent", skip_serializing_if = "Option::is_none")]
23    pub auto_parent: Option<bool>,
24    #[serde(rename = "summary")]
25    pub summary: String,
26    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
27    pub description: Option<String>,
28    #[serde(rename = "content")]
29    pub content: String,
30    /// JSON Schema of the arguments of `main`, which is what a run form and an MCP tool offer. Omitted (or `{}`), it is inferred from `content` for TypeScript, Python, Go, Bash, PowerShell, SQL, GraphQL and Ansible scripts. For other languages, or code that does not parse, a new script gets none. A new version of an existing script also keeps what the previous version's schema says about each argument, or that whole schema when nothing can be inferred. A dbt script always takes its schema from its descriptor, whatever is sent.
31    #[serde(rename = "schema", skip_serializing_if = "Option::is_none")]
32    pub schema: Option<serde_json::Value>,
33    #[serde(rename = "is_template", skip_serializing_if = "Option::is_none")]
34    pub is_template: Option<bool>,
35    #[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
36    pub lock: Option<String>,
37    #[serde(rename = "language")]
38    pub language: models::ScriptLang,
39    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
40    pub kind: Option<Kind>,
41    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
42    pub tag: Option<String>,
43    #[serde(rename = "envs", skip_serializing_if = "Option::is_none")]
44    pub envs: Option<Vec<String>>,
45    #[serde(rename = "concurrent_limit", skip_serializing_if = "Option::is_none")]
46    pub concurrent_limit: Option<i32>,
47    #[serde(rename = "concurrency_time_window_s", skip_serializing_if = "Option::is_none")]
48    pub concurrency_time_window_s: Option<i32>,
49    #[serde(rename = "cache_ttl", skip_serializing_if = "Option::is_none")]
50    pub cache_ttl: Option<f64>,
51    #[serde(rename = "cache_ignore_s3_path", skip_serializing_if = "Option::is_none")]
52    pub cache_ignore_s3_path: Option<bool>,
53    #[serde(rename = "dedicated_worker", skip_serializing_if = "Option::is_none")]
54    pub dedicated_worker: Option<bool>,
55    #[serde(rename = "ws_error_handler_muted", skip_serializing_if = "Option::is_none")]
56    pub ws_error_handler_muted: Option<bool>,
57    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
58    pub priority: Option<i32>,
59    #[serde(rename = "restart_unless_cancelled", skip_serializing_if = "Option::is_none")]
60    pub restart_unless_cancelled: Option<bool>,
61    #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
62    pub timeout: Option<i32>,
63    /// If set, delete the job's args, result and logs after this many seconds following job completion
64    #[serde(rename = "delete_after_secs", skip_serializing_if = "Option::is_none")]
65    pub delete_after_secs: Option<i32>,
66    #[serde(rename = "deployment_message", skip_serializing_if = "Option::is_none")]
67    pub deployment_message: Option<String>,
68    #[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")]
69    pub concurrency_key: Option<String>,
70    #[serde(rename = "debounce_key", skip_serializing_if = "Option::is_none")]
71    pub debounce_key: Option<String>,
72    #[serde(rename = "debounce_delay_s", skip_serializing_if = "Option::is_none")]
73    pub debounce_delay_s: Option<i32>,
74    #[serde(rename = "debounce_args_to_accumulate", skip_serializing_if = "Option::is_none")]
75    pub debounce_args_to_accumulate: Option<Vec<String>>,
76    #[serde(rename = "max_total_debouncing_time", skip_serializing_if = "Option::is_none")]
77    pub max_total_debouncing_time: Option<i32>,
78    #[serde(rename = "max_total_debounces_amount", skip_serializing_if = "Option::is_none")]
79    pub max_total_debounces_amount: Option<i32>,
80    #[serde(rename = "visible_to_runner_only", skip_serializing_if = "Option::is_none")]
81    pub visible_to_runner_only: Option<bool>,
82    #[serde(rename = "auto_kind", skip_serializing_if = "Option::is_none")]
83    pub auto_kind: Option<String>,
84    #[serde(rename = "codebase", skip_serializing_if = "Option::is_none")]
85    pub codebase: Option<String>,
86    #[serde(rename = "has_preprocessor", skip_serializing_if = "Option::is_none")]
87    pub has_preprocessor: Option<bool>,
88    #[serde(rename = "on_behalf_of_email", skip_serializing_if = "Option::is_none")]
89    pub on_behalf_of_email: Option<String>,
90    /// Authorization identity to run as: u/{username}, g/{group}, or a bare email when the username is itself email-shaped. Supply this or on_behalf_of_email; when only the address is given it is resolved to the account it names, and an address naming nobody is rejected. A pair that disagrees is rejected.
91    #[serde(rename = "on_behalf_of", skip_serializing_if = "Option::is_none")]
92    pub on_behalf_of: Option<String>,
93    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original on_behalf_of_email / on_behalf_of pair instead of overwriting it with the caller's own identity.
94    #[serde(rename = "preserve_on_behalf_of", skip_serializing_if = "Option::is_none")]
95    pub preserve_on_behalf_of: Option<bool>,
96    #[serde(rename = "assets", skip_serializing_if = "Option::is_none")]
97    pub assets: Option<Vec<models::NewScriptAssetsInner>>,
98    /// Additional script modules keyed by relative file path
99    #[serde(rename = "modules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
100    pub modules: Option<Option<std::collections::HashMap<String, models::ScriptModule>>>,
101    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
102    pub labels: Option<Vec<String>>,
103    /// When true (set by the CLI / git sync), deploying this script does not delete an existing user draft at the same path.
104    #[serde(rename = "skip_draft_deletion", skip_serializing_if = "Option::is_none")]
105    pub skip_draft_deletion: Option<bool>,
106}
107
108impl NewScript {
109    pub fn new(path: String, summary: String, content: String, language: models::ScriptLang) -> NewScript {
110        NewScript {
111            path,
112            parent_hash: None,
113            auto_parent: None,
114            summary,
115            description: None,
116            content,
117            schema: None,
118            is_template: None,
119            lock: None,
120            language,
121            kind: None,
122            tag: None,
123            envs: None,
124            concurrent_limit: None,
125            concurrency_time_window_s: None,
126            cache_ttl: None,
127            cache_ignore_s3_path: None,
128            dedicated_worker: None,
129            ws_error_handler_muted: None,
130            priority: None,
131            restart_unless_cancelled: None,
132            timeout: None,
133            delete_after_secs: None,
134            deployment_message: None,
135            concurrency_key: None,
136            debounce_key: None,
137            debounce_delay_s: None,
138            debounce_args_to_accumulate: None,
139            max_total_debouncing_time: None,
140            max_total_debounces_amount: None,
141            visible_to_runner_only: None,
142            auto_kind: None,
143            codebase: None,
144            has_preprocessor: None,
145            on_behalf_of_email: None,
146            on_behalf_of: None,
147            preserve_on_behalf_of: None,
148            assets: None,
149            modules: None,
150            labels: None,
151            skip_draft_deletion: None,
152        }
153    }
154}
155/// 
156#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
157pub enum Kind {
158    #[serde(rename = "script")]
159    Script,
160    #[serde(rename = "failure")]
161    Failure,
162    #[serde(rename = "trigger")]
163    Trigger,
164    #[serde(rename = "command")]
165    Command,
166    #[serde(rename = "approval")]
167    Approval,
168    #[serde(rename = "preprocessor")]
169    Preprocessor,
170}
171
172impl Default for Kind {
173    fn default() -> Kind {
174        Self::Script
175    }
176}
177