Skip to main content

windmill_api/models/
mqtt_trigger.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.626.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 MqttTrigger {
16    /// Path to the MQTT resource containing broker connection configuration
17    #[serde(rename = "mqtt_resource_path")]
18    pub mqtt_resource_path: String,
19    /// Array of MQTT topics to subscribe to, each with topic name and QoS level
20    #[serde(rename = "subscribe_topics")]
21    pub subscribe_topics: Vec<models::MqttSubscribeTopic>,
22    #[serde(rename = "v3_config", skip_serializing_if = "Option::is_none")]
23    pub v3_config: Option<Box<models::MqttV3Config>>,
24    #[serde(rename = "v5_config", skip_serializing_if = "Option::is_none")]
25    pub v5_config: Option<Box<models::MqttV5Config>>,
26    /// MQTT client ID for this connection
27    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
28    pub client_id: Option<String>,
29    #[serde(rename = "client_version", skip_serializing_if = "Option::is_none")]
30    pub client_version: Option<models::MqttClientVersion>,
31    /// ID of the server currently handling this trigger (internal)
32    #[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
33    pub server_id: Option<String>,
34    /// Timestamp of last server heartbeat (internal)
35    #[serde(rename = "last_server_ping", skip_serializing_if = "Option::is_none")]
36    pub last_server_ping: Option<String>,
37    /// Last error message if the trigger failed
38    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
39    pub error: Option<String>,
40    /// Path to a script or flow to run when the triggered job fails
41    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
42    pub error_handler_path: Option<String>,
43    /// The arguments to pass to the script or flow
44    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
45    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
46    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
47    pub retry: Option<Box<models::Retry>>,
48    /// The unique path identifier for this trigger
49    #[serde(rename = "path")]
50    pub path: String,
51    /// Path to the script or flow to execute when triggered
52    #[serde(rename = "script_path")]
53    pub script_path: String,
54    /// Email of the user who owns this trigger, used for permissioned_as
55    #[serde(rename = "email")]
56    pub email: String,
57    /// Additional permissions for this trigger
58    #[serde(rename = "extra_perms")]
59    pub extra_perms: std::collections::HashMap<String, bool>,
60    /// The workspace this trigger belongs to
61    #[serde(rename = "workspace_id")]
62    pub workspace_id: String,
63    /// Username of the last person who edited this trigger
64    #[serde(rename = "edited_by")]
65    pub edited_by: String,
66    /// Timestamp of the last edit
67    #[serde(rename = "edited_at")]
68    pub edited_at: String,
69    /// True if script_path points to a flow, false if it points to a script
70    #[serde(rename = "is_flow")]
71    pub is_flow: bool,
72    #[serde(rename = "mode")]
73    pub mode: models::TriggerMode,
74}
75
76impl MqttTrigger {
77    pub fn new(mqtt_resource_path: String, subscribe_topics: Vec<models::MqttSubscribeTopic>, path: String, script_path: String, email: String, extra_perms: std::collections::HashMap<String, bool>, workspace_id: String, edited_by: String, edited_at: String, is_flow: bool, mode: models::TriggerMode) -> MqttTrigger {
78        MqttTrigger {
79            mqtt_resource_path,
80            subscribe_topics,
81            v3_config: None,
82            v5_config: None,
83            client_id: None,
84            client_version: None,
85            server_id: None,
86            last_server_ping: None,
87            error: None,
88            error_handler_path: None,
89            error_handler_args: None,
90            retry: None,
91            path,
92            script_path,
93            email,
94            extra_perms,
95            workspace_id,
96            edited_by,
97            edited_at,
98            is_flow,
99            mode,
100        }
101    }
102}
103