Skip to main content

windmill_api/models/
new_nats_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 NewNatsTrigger {
16    /// The unique path identifier for this trigger
17    #[serde(rename = "path")]
18    pub path: String,
19    /// Path to the script or flow to execute when a message is received
20    #[serde(rename = "script_path")]
21    pub script_path: String,
22    /// True if script_path points to a flow, false if it points to a script
23    #[serde(rename = "is_flow")]
24    pub is_flow: bool,
25    /// Path to the NATS resource containing connection configuration
26    #[serde(rename = "nats_resource_path")]
27    pub nats_resource_path: String,
28    /// If true, uses NATS JetStream for durable message delivery
29    #[serde(rename = "use_jetstream")]
30    pub use_jetstream: bool,
31    /// JetStream stream name (required when use_jetstream is true)
32    #[serde(rename = "stream_name", skip_serializing_if = "Option::is_none")]
33    pub stream_name: Option<String>,
34    /// JetStream consumer name (required when use_jetstream is true)
35    #[serde(rename = "consumer_name", skip_serializing_if = "Option::is_none")]
36    pub consumer_name: Option<String>,
37    /// Array of NATS subjects to subscribe to
38    #[serde(rename = "subjects")]
39    pub subjects: Vec<String>,
40    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
41    pub mode: Option<models::TriggerMode>,
42    /// Path to a script or flow to run when the triggered job fails
43    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
44    pub error_handler_path: Option<String>,
45    /// The arguments to pass to the script or flow
46    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
47    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
48    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
49    pub retry: Option<Box<models::Retry>>,
50}
51
52impl NewNatsTrigger {
53    pub fn new(path: String, script_path: String, is_flow: bool, nats_resource_path: String, use_jetstream: bool, subjects: Vec<String>) -> NewNatsTrigger {
54        NewNatsTrigger {
55            path,
56            script_path,
57            is_flow,
58            nats_resource_path,
59            use_jetstream,
60            stream_name: None,
61            consumer_name: None,
62            subjects,
63            mode: None,
64            error_handler_path: None,
65            error_handler_args: None,
66            retry: None,
67        }
68    }
69}
70