Skip to main content

windmill_api/models/
native_trigger_data.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.813.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// NativeTriggerData : Data for creating or updating a native trigger
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct NativeTriggerData {
17    /// The path to the script or flow that will be triggered
18    #[serde(rename = "script_path")]
19    pub script_path: String,
20    /// Whether the trigger targets a flow (true) or a script (false)
21    #[serde(rename = "is_flow")]
22    pub is_flow: bool,
23    /// Service-specific configuration (e.g., event types, filters)
24    #[serde(rename = "service_config")]
25    pub service_config: std::collections::HashMap<String, serde_json::Value>,
26    /// Short summary to be displayed when listed
27    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub summary: Option<Option<String>>,
29    /// Whether the trigger starts a job when it fires. Honoured on create only, so a trigger can be registered already paused; an update ignores it and setenabled is the only way to change an existing trigger's state. Defaults to true.
30    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
31    pub enabled: Option<bool>,
32}
33
34impl NativeTriggerData {
35    /// Data for creating or updating a native trigger
36    pub fn new(script_path: String, is_flow: bool, service_config: std::collections::HashMap<String, serde_json::Value>) -> NativeTriggerData {
37        NativeTriggerData {
38            script_path,
39            is_flow,
40            service_config,
41            summary: None,
42            enabled: None,
43        }
44    }
45}
46