Skip to main content

windmill_api/models/
gcp_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/// GcpTrigger : A Google Cloud Pub/Sub trigger that executes a script or flow when messages are received.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct GcpTrigger {
17    /// Path to the GCP resource containing service account credentials for authentication.
18    #[serde(rename = "gcp_resource_path")]
19    pub gcp_resource_path: String,
20    /// Google Cloud Pub/Sub topic ID to subscribe to.
21    #[serde(rename = "topic_id")]
22    pub topic_id: String,
23    /// Google Cloud Pub/Sub subscription ID.
24    #[serde(rename = "subscription_id")]
25    pub subscription_id: String,
26    /// ID of the server currently handling this trigger (internal use).
27    #[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
28    pub server_id: Option<String>,
29    #[serde(rename = "delivery_type")]
30    pub delivery_type: models::DeliveryType,
31    #[serde(rename = "delivery_config", skip_serializing_if = "Option::is_none")]
32    pub delivery_config: Option<Box<models::PushConfig>>,
33    #[serde(rename = "subscription_mode")]
34    pub subscription_mode: models::SubscriptionMode,
35    /// Timestamp of last server heartbeat (internal use).
36    #[serde(rename = "last_server_ping", skip_serializing_if = "Option::is_none")]
37    pub last_server_ping: Option<String>,
38    /// Last error message if the trigger failed.
39    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
40    pub error: Option<String>,
41    /// Path to a script or flow to run when the triggered job fails.
42    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
43    pub error_handler_path: Option<String>,
44    /// The arguments to pass to the script or flow
45    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
46    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
47    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
48    pub retry: Option<Box<models::Retry>>,
49    /// The unique path identifier for this trigger
50    #[serde(rename = "path")]
51    pub path: String,
52    /// Path to the script or flow to execute when triggered
53    #[serde(rename = "script_path")]
54    pub script_path: String,
55    /// Email of the user who owns this trigger, used for permissioned_as
56    #[serde(rename = "email")]
57    pub email: String,
58    /// Additional permissions for this trigger
59    #[serde(rename = "extra_perms")]
60    pub extra_perms: std::collections::HashMap<String, bool>,
61    /// The workspace this trigger belongs to
62    #[serde(rename = "workspace_id")]
63    pub workspace_id: String,
64    /// Username of the last person who edited this trigger
65    #[serde(rename = "edited_by")]
66    pub edited_by: String,
67    /// Timestamp of the last edit
68    #[serde(rename = "edited_at")]
69    pub edited_at: String,
70    /// True if script_path points to a flow, false if it points to a script
71    #[serde(rename = "is_flow")]
72    pub is_flow: bool,
73    #[serde(rename = "mode")]
74    pub mode: models::TriggerMode,
75}
76
77impl GcpTrigger {
78    /// A Google Cloud Pub/Sub trigger that executes a script or flow when messages are received.
79    pub fn new(gcp_resource_path: String, topic_id: String, subscription_id: String, delivery_type: models::DeliveryType, subscription_mode: models::SubscriptionMode, 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) -> GcpTrigger {
80        GcpTrigger {
81            gcp_resource_path,
82            topic_id,
83            subscription_id,
84            server_id: None,
85            delivery_type,
86            delivery_config: None,
87            subscription_mode,
88            last_server_ping: None,
89            error: None,
90            error_handler_path: None,
91            error_handler_args: None,
92            retry: None,
93            path,
94            script_path,
95            email,
96            extra_perms,
97            workspace_id,
98            edited_by,
99            edited_at,
100            is_flow,
101            mode,
102        }
103    }
104}
105