windmill_api/models/
raw_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.592.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// RawScript : Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RawScript {
17    /// Map of parameter names to their values (static or JavaScript expressions). These become the script's input arguments
18    #[serde(rename = "input_transforms")]
19    pub input_transforms: std::collections::HashMap<String, models::InputTransform>,
20    /// The script source code. Should export a 'main' function
21    #[serde(rename = "content")]
22    pub content: String,
23    /// Programming language for this script
24    #[serde(rename = "language")]
25    pub language: Language,
26    /// Optional path for saving this script
27    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
28    pub path: Option<String>,
29    /// Lock file content for dependencies
30    #[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
31    pub lock: Option<String>,
32    #[serde(rename = "type")]
33    pub r#type: Type,
34    /// Worker group tag for execution routing
35    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
36    pub tag: Option<String>,
37    /// Maximum concurrent executions of this script
38    #[serde(rename = "concurrent_limit", skip_serializing_if = "Option::is_none")]
39    pub concurrent_limit: Option<f64>,
40    /// Time window for concurrent_limit
41    #[serde(rename = "concurrency_time_window_s", skip_serializing_if = "Option::is_none")]
42    pub concurrency_time_window_s: Option<f64>,
43    /// Custom key for grouping concurrent executions
44    #[serde(rename = "custom_concurrency_key", skip_serializing_if = "Option::is_none")]
45    pub custom_concurrency_key: Option<String>,
46    /// If true, this script is a trigger that can start the flow
47    #[serde(rename = "is_trigger", skip_serializing_if = "Option::is_none")]
48    pub is_trigger: Option<bool>,
49    /// External resources this script accesses (S3 objects, resources, etc.)
50    #[serde(rename = "assets", skip_serializing_if = "Option::is_none")]
51    pub assets: Option<Vec<models::RawScriptAssetsInner>>,
52}
53
54impl RawScript {
55    /// Inline script with code defined directly in the flow. Use 'bun' as default language if unspecified. The script receives arguments from input_transforms
56    pub fn new(input_transforms: std::collections::HashMap<String, models::InputTransform>, content: String, language: Language, r#type: Type) -> RawScript {
57        RawScript {
58            input_transforms,
59            content,
60            language,
61            path: None,
62            lock: None,
63            r#type,
64            tag: None,
65            concurrent_limit: None,
66            concurrency_time_window_s: None,
67            custom_concurrency_key: None,
68            is_trigger: None,
69            assets: None,
70        }
71    }
72}
73/// Programming language for this script
74#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
75pub enum Language {
76    #[serde(rename = "deno")]
77    Deno,
78    #[serde(rename = "bun")]
79    Bun,
80    #[serde(rename = "python3")]
81    Python3,
82    #[serde(rename = "go")]
83    Go,
84    #[serde(rename = "bash")]
85    Bash,
86    #[serde(rename = "powershell")]
87    Powershell,
88    #[serde(rename = "postgresql")]
89    Postgresql,
90    #[serde(rename = "mysql")]
91    Mysql,
92    #[serde(rename = "bigquery")]
93    Bigquery,
94    #[serde(rename = "snowflake")]
95    Snowflake,
96    #[serde(rename = "mssql")]
97    Mssql,
98    #[serde(rename = "oracledb")]
99    Oracledb,
100    #[serde(rename = "graphql")]
101    Graphql,
102    #[serde(rename = "nativets")]
103    Nativets,
104    #[serde(rename = "php")]
105    Php,
106}
107
108impl Default for Language {
109    fn default() -> Language {
110        Self::Deno
111    }
112}
113/// 
114#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
115pub enum Type {
116    #[serde(rename = "rawscript")]
117    Rawscript,
118}
119
120impl Default for Type {
121    fn default() -> Type {
122        Self::Rawscript
123    }
124}
125