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.670.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    /// Logic to apply when evaluating filters. 'and' requires all filters to match, 'or' requires any filter to match.
28    #[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
29    pub filter_logic: Option<FilterLogic>,
30    /// Initial offset behavior when consumer group has no committed offset.
31    #[serde(rename = "auto_offset_reset", skip_serializing_if = "Option::is_none")]
32    pub auto_offset_reset: Option<AutoOffsetReset>,
33    /// When true (default), offsets are committed automatically after receiving each message. When false, you must manually commit offsets using the commit_offsets endpoint.
34    #[serde(rename = "auto_commit", skip_serializing_if = "Option::is_none")]
35    pub auto_commit: Option<bool>,
36    /// The unique path identifier for this trigger
37    #[serde(rename = "path")]
38    pub path: String,
39    /// Path to the script or flow to execute when a message is received
40    #[serde(rename = "script_path")]
41    pub script_path: String,
42    /// True if script_path points to a flow, false if it points to a script
43    #[serde(rename = "is_flow")]
44    pub is_flow: bool,
45    /// Path to a script or flow to run when the triggered job fails
46    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
47    pub error_handler_path: Option<String>,
48    /// The arguments to pass to the script or flow
49    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
50    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
51    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
52    pub retry: Option<Box<models::Retry>>,
53    /// The user or group this trigger runs as. Used during deployment to preserve the original trigger owner.
54    #[serde(rename = "permissioned_as", skip_serializing_if = "Option::is_none")]
55    pub permissioned_as: Option<String>,
56    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
57    #[serde(rename = "preserve_permissioned_as", skip_serializing_if = "Option::is_none")]
58    pub preserve_permissioned_as: Option<bool>,
59}
60
61impl EditKafkaTrigger {
62    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 {
63        EditKafkaTrigger {
64            kafka_resource_path,
65            group_id,
66            topics,
67            filters,
68            filter_logic: None,
69            auto_offset_reset: None,
70            auto_commit: None,
71            path,
72            script_path,
73            is_flow,
74            error_handler_path: None,
75            error_handler_args: None,
76            retry: None,
77            permissioned_as: None,
78            preserve_permissioned_as: None,
79        }
80    }
81}
82/// Logic to apply when evaluating filters. 'and' requires all filters to match, 'or' requires any filter to match.
83#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
84pub enum FilterLogic {
85    #[serde(rename = "and")]
86    And,
87    #[serde(rename = "or")]
88    Or,
89}
90
91impl Default for FilterLogic {
92    fn default() -> FilterLogic {
93        Self::And
94    }
95}
96/// Initial offset behavior when consumer group has no committed offset.
97#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
98pub enum AutoOffsetReset {
99    #[serde(rename = "latest")]
100    Latest,
101    #[serde(rename = "earliest")]
102    Earliest,
103}
104
105impl Default for AutoOffsetReset {
106    fn default() -> AutoOffsetReset {
107        Self::Latest
108    }
109}
110