Skip to main content

windmill_api/models/
get_kafka_trigger_200_response.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.792.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 GetKafkaTrigger200Response {
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    /// Filters to match incoming messages (only matching messages trigger the script). Each entry is either a leaf `{key, value}` (top-level field) or `{path, value}` (dotted path into nested objects), or a group `{any_of: [...]}` / `{all_of: [...]}` / `{none_of: [...]}` nesting more entries. Entries at the top level are combined with `filter_logic`.
26    #[serde(rename = "filters")]
27    pub filters: Vec<models::TriggerFilter>,
28    /// Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic.
29    #[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
30    pub filter_logic: Option<FilterLogic>,
31    /// Initial offset behavior when consumer group has no committed offset. 'latest' starts from new messages only, 'earliest' starts from the beginning.
32    #[serde(rename = "auto_offset_reset", skip_serializing_if = "Option::is_none")]
33    pub auto_offset_reset: Option<AutoOffsetReset>,
34    /// When true (default), offsets are committed automatically after receiving each message. When false, you must manually commit offsets using the commit_offsets endpoint.
35    #[serde(rename = "auto_commit", skip_serializing_if = "Option::is_none")]
36    pub auto_commit: Option<bool>,
37    /// ID of the server currently handling this trigger (internal)
38    #[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
39    pub server_id: Option<String>,
40    /// Timestamp of last server heartbeat (internal)
41    #[serde(rename = "last_server_ping", skip_serializing_if = "Option::is_none")]
42    pub last_server_ping: Option<String>,
43    /// Last error message if the trigger failed
44    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
45    pub error: Option<String>,
46    /// Path to a script or flow to run when the triggered job fails
47    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
48    pub error_handler_path: Option<String>,
49    /// The arguments to pass to the script or flow
50    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
51    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
52    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
53    pub retry: Option<Box<models::Retry>>,
54    /// The unique Windmill path for this trigger. Must be of the form `u/<user>/<path>` or `f/<folder>/<path>`. This is the trigger object path, not the HTTP route path.
55    #[serde(rename = "path")]
56    pub path: String,
57    /// Path to the script or flow to execute when triggered
58    #[serde(rename = "script_path")]
59    pub script_path: String,
60    /// The user or group this trigger runs as (permissioned_as)
61    #[serde(rename = "permissioned_as")]
62    pub permissioned_as: String,
63    /// Additional permissions for this trigger
64    #[serde(rename = "extra_perms")]
65    pub extra_perms: std::collections::HashMap<String, bool>,
66    /// The workspace this trigger belongs to
67    #[serde(rename = "workspace_id")]
68    pub workspace_id: String,
69    /// Username of the last person who edited this trigger
70    #[serde(rename = "edited_by")]
71    pub edited_by: String,
72    /// Timestamp of the last edit
73    #[serde(rename = "edited_at")]
74    pub edited_at: String,
75    /// True if script_path points to a flow, false if it points to a script
76    #[serde(rename = "is_flow")]
77    pub is_flow: bool,
78    #[serde(rename = "mode")]
79    pub mode: models::TriggerMode,
80    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
81    pub labels: Option<Vec<String>>,
82    /// True when this row is a per-user draft with no deployed trigger at the same path. Set by list endpoints when `include_draft_only=true` synthesizes the row from the draft. Frontend renders a \"Draft\" badge. 
83    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
84    pub draft_only: Option<bool>,
85    #[serde(rename = "is_draft")]
86    pub is_draft: bool,
87    #[serde(rename = "draft_saved_at", skip_serializing_if = "Option::is_none")]
88    pub draft_saved_at: Option<String>,
89    #[serde(rename = "no_deployed", skip_serializing_if = "Option::is_none")]
90    pub no_deployed: Option<bool>,
91    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
92    pub draft: Option<std::collections::HashMap<String, serde_json::Value>>,
93    /// Other workspace users (and the legacy NULL-email row, if any) with a saved draft at the same path. Populated only on the authed user's \"get by path\" responses for kinds the editor surfaces a fork banner for (script, flow, app, raw_app). Empty / omitted for kinds without that UI. 
94    #[serde(rename = "other_drafts_users", skip_serializing_if = "Option::is_none")]
95    pub other_drafts_users: Option<Vec<models::UserDraftOverlayOtherDraftsUsersInner>>,
96}
97
98impl GetKafkaTrigger200Response {
99    pub fn new(kafka_resource_path: String, group_id: String, topics: Vec<String>, filters: Vec<models::TriggerFilter>, path: String, script_path: String, permissioned_as: String, extra_perms: std::collections::HashMap<String, bool>, workspace_id: String, edited_by: String, edited_at: String, is_flow: bool, mode: models::TriggerMode, is_draft: bool) -> GetKafkaTrigger200Response {
100        GetKafkaTrigger200Response {
101            kafka_resource_path,
102            group_id,
103            topics,
104            filters,
105            filter_logic: None,
106            auto_offset_reset: None,
107            auto_commit: None,
108            server_id: None,
109            last_server_ping: None,
110            error: None,
111            error_handler_path: None,
112            error_handler_args: None,
113            retry: None,
114            path,
115            script_path,
116            permissioned_as,
117            extra_perms,
118            workspace_id,
119            edited_by,
120            edited_at,
121            is_flow,
122            mode,
123            labels: None,
124            draft_only: None,
125            is_draft,
126            draft_saved_at: None,
127            no_deployed: None,
128            draft: None,
129            other_drafts_users: None,
130        }
131    }
132}
133/// Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic.
134#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
135pub enum FilterLogic {
136    #[serde(rename = "and")]
137    And,
138    #[serde(rename = "or")]
139    Or,
140}
141
142impl Default for FilterLogic {
143    fn default() -> FilterLogic {
144        Self::And
145    }
146}
147/// Initial offset behavior when consumer group has no committed offset. 'latest' starts from new messages only, 'earliest' starts from the beginning.
148#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
149pub enum AutoOffsetReset {
150    #[serde(rename = "latest")]
151    Latest,
152    #[serde(rename = "earliest")]
153    Earliest,
154}
155
156impl Default for AutoOffsetReset {
157    fn default() -> AutoOffsetReset {
158        Self::Latest
159    }
160}
161