Skip to main content

windmill_api/models/
edit_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.662.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 EditKafkaTrigger {
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<models::NewWebsocketTriggerFiltersInner>,
27    /// Initial offset behavior when consumer group has no committed offset.
28    #[serde(rename = "auto_offset_reset", skip_serializing_if = "Option::is_none")]
29    pub auto_offset_reset: Option<AutoOffsetReset>,
30    /// When true (default), offsets are committed automatically after receiving each message. When false, you must manually commit offsets using the commit_offsets endpoint.
31    #[serde(rename = "auto_commit", skip_serializing_if = "Option::is_none")]
32    pub auto_commit: Option<bool>,
33    /// The unique path identifier for this trigger
34    #[serde(rename = "path")]
35    pub path: String,
36    /// Path to the script or flow to execute when a message is received
37    #[serde(rename = "script_path")]
38    pub script_path: String,
39    /// True if script_path points to a flow, false if it points to a script
40    #[serde(rename = "is_flow")]
41    pub is_flow: bool,
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    /// The user or group this trigger runs as. Used during deployment to preserve the original trigger owner.
51    #[serde(rename = "permissioned_as", skip_serializing_if = "Option::is_none")]
52    pub permissioned_as: Option<String>,
53    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
54    #[serde(rename = "preserve_permissioned_as", skip_serializing_if = "Option::is_none")]
55    pub preserve_permissioned_as: Option<bool>,
56}
57
58impl EditKafkaTrigger {
59    pub fn new(kafka_resource_path: String, group_id: String, topics: Vec<String>, filters: Vec<models::NewWebsocketTriggerFiltersInner>, path: String, script_path: String, is_flow: bool) -> EditKafkaTrigger {
60        EditKafkaTrigger {
61            kafka_resource_path,
62            group_id,
63            topics,
64            filters,
65            auto_offset_reset: None,
66            auto_commit: None,
67            path,
68            script_path,
69            is_flow,
70            error_handler_path: None,
71            error_handler_args: None,
72            retry: None,
73            permissioned_as: None,
74            preserve_permissioned_as: None,
75        }
76    }
77}
78/// Initial offset behavior when consumer group has no committed offset.
79#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
80pub enum AutoOffsetReset {
81    #[serde(rename = "latest")]
82    Latest,
83    #[serde(rename = "earliest")]
84    Earliest,
85}
86
87impl Default for AutoOffsetReset {
88    fn default() -> AutoOffsetReset {
89        Self::Latest
90    }
91}
92