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.848.2
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    /// Path of the connection the trigger acts through. Honoured on create only; an update keeps the trigger's connection. When omitted on create, the caller's only usable connection for the service is used.
33    #[serde(rename = "connection_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub connection_path: Option<Option<String>>,
35}
36
37impl NativeTriggerData {
38    /// Data for creating or updating a native trigger
39    pub fn new(script_path: String, is_flow: bool, service_config: std::collections::HashMap<String, serde_json::Value>) -> NativeTriggerData {
40        NativeTriggerData {
41            script_path,
42            is_flow,
43            service_config,
44            summary: None,
45            enabled: None,
46            connection_path: None,
47        }
48    }
49}
50