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.678.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    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
60    pub labels: Option<Vec<String>>,
61}
62
63impl EditKafkaTrigger {
64    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 {
65        EditKafkaTrigger {
66            kafka_resource_path,
67            group_id,
68            topics,
69            filters,
70            filter_logic: None,
71            auto_offset_reset: None,
72            auto_commit: None,
73            path,
74            script_path,
75            is_flow,
76            error_handler_path: None,
77            error_handler_args: None,
78            retry: None,
79            permissioned_as: None,
80            preserve_permissioned_as: None,
81            labels: None,
82        }
83    }
84}
85/// Logic to apply when evaluating filters. 'and' requires all filters to match, 'or' requires any filter to match.
86#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
87pub enum FilterLogic {
88    #[serde(rename = "and")]
89    And,
90    #[serde(rename = "or")]
91    Or,
92}
93
94impl Default for FilterLogic {
95    fn default() -> FilterLogic {
96        Self::And
97    }
98}
99/// Initial offset behavior when consumer group has no committed offset.
100#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
101pub enum AutoOffsetReset {
102    #[serde(rename = "latest")]
103    Latest,
104    #[serde(rename = "earliest")]
105    Earliest,
106}
107
108impl Default for AutoOffsetReset {
109    fn default() -> AutoOffsetReset {
110        Self::Latest
111    }
112}
113