Skip to main content

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