Skip to main content

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