windmill_api/models/
preview.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.539.1
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 Preview {
16    /// The code to run
17    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
18    pub content: Option<String>,
19    /// The path to the script
20    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
21    pub path: Option<String>,
22    /// The hash of the script
23    #[serde(rename = "script_hash", skip_serializing_if = "Option::is_none")]
24    pub script_hash: Option<String>,
25    /// The arguments to pass to the script or flow
26    #[serde(rename = "args")]
27    pub args: std::collections::HashMap<String, serde_json::Value>,
28    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
29    pub language: Option<models::ScriptLang>,
30    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
31    pub tag: Option<String>,
32    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
33    pub kind: Option<Kind>,
34    #[serde(rename = "dedicated_worker", skip_serializing_if = "Option::is_none")]
35    pub dedicated_worker: Option<bool>,
36    #[serde(rename = "lock", skip_serializing_if = "Option::is_none")]
37    pub lock: Option<String>,
38}
39
40impl Preview {
41    pub fn new(args: std::collections::HashMap<String, serde_json::Value>) -> Preview {
42        Preview {
43            content: None,
44            path: None,
45            script_hash: None,
46            args,
47            language: None,
48            tag: None,
49            kind: None,
50            dedicated_worker: None,
51            lock: None,
52        }
53    }
54}
55/// 
56#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
57pub enum Kind {
58    #[serde(rename = "code")]
59    Code,
60    #[serde(rename = "identity")]
61    Identity,
62    #[serde(rename = "http")]
63    Http,
64}
65
66impl Default for Kind {
67    fn default() -> Kind {
68        Self::Code
69    }
70}
71