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.795.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. Omit to authenticate with the instance's application default credentials.
18    #[serde(rename = "gcp_resource_path", skip_serializing_if = "Option::is_none")]
19    pub gcp_resource_path: Option<String>,
20    /// GCP project the client operates in. Defaults to the project of the credentials. Topics and subscriptions given as fully qualified names are reached whatever it is.
21    #[serde(rename = "project_id", skip_serializing_if = "Option::is_none")]
22    pub project_id: Option<String>,
23    /// Google Cloud Pub/Sub topic ID to subscribe to. Accepts a bare ID or a fully qualified name (projects/<project>/topics/<id>).
24    #[serde(rename = "topic_id")]
25    pub topic_id: String,
26    /// Google Cloud Pub/Sub subscription ID. Accepts a bare ID or a fully qualified name (projects/<project>/subscriptions/<id>).
27    #[serde(rename = "subscription_id")]
28    pub subscription_id: String,
29    /// ID of the server currently handling this trigger (internal use).
30    #[serde(rename = "server_id", skip_serializing_if = "Option::is_none")]
31    pub server_id: Option<String>,
32    #[serde(rename = "delivery_type")]
33    pub delivery_type: models::DeliveryType,
34    #[serde(rename = "delivery_config", skip_serializing_if = "Option::is_none")]
35    pub delivery_config: Option<Box<models::PushConfig>>,
36    #[serde(rename = "subscription_mode")]
37    pub subscription_mode: models::SubscriptionMode,
38    /// Timestamp of last server heartbeat (internal use).
39    #[serde(rename = "last_server_ping", skip_serializing_if = "Option::is_none")]
40    pub last_server_ping: Option<String>,
41    /// Last error message if the trigger failed.
42    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
43    pub error: Option<String>,
44    /// Path to a script or flow to run when the triggered job fails.
45    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
46    pub error_handler_path: Option<String>,
47    /// The arguments to pass to the script or flow
48    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
49    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
50    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
51    pub retry: Option<Box<models::Retry>>,
52    /// 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.
53    #[serde(rename = "path")]
54    pub path: String,
55    /// Path to the script or flow to execute when triggered
56    #[serde(rename = "script_path")]
57    pub script_path: String,
58    /// The user or group this trigger runs as (permissioned_as)
59    #[serde(rename = "permissioned_as")]
60    pub permissioned_as: String,
61    /// Additional permissions for this trigger
62    #[serde(rename = "extra_perms")]
63    pub extra_perms: std::collections::HashMap<String, bool>,
64    /// The workspace this trigger belongs to
65    #[serde(rename = "workspace_id")]
66    pub workspace_id: String,
67    /// Username of the last person who edited this trigger
68    #[serde(rename = "edited_by")]
69    pub edited_by: String,
70    /// Timestamp of the last edit
71    #[serde(rename = "edited_at")]
72    pub edited_at: String,
73    /// True if script_path points to a flow, false if it points to a script
74    #[serde(rename = "is_flow")]
75    pub is_flow: bool,
76    #[serde(rename = "mode")]
77    pub mode: models::TriggerMode,
78    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
79    pub labels: Option<Vec<String>>,
80    /// 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. 
81    #[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
82    pub draft_only: Option<bool>,
83    /// True when the authed user has a per-user draft at this path (over a deployed row or a synthesized draft-only row). Frontend appends a `*` to the displayed name. 
84    #[serde(rename = "is_draft", skip_serializing_if = "Option::is_none")]
85    pub is_draft: Option<bool>,
86}
87
88impl GcpTrigger {
89    /// A Google Cloud Pub/Sub trigger that executes a script or flow when messages are received.
90    pub fn new(topic_id: String, subscription_id: String, delivery_type: models::DeliveryType, subscription_mode: models::SubscriptionMode, 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) -> GcpTrigger {
91        GcpTrigger {
92            gcp_resource_path: None,
93            project_id: None,
94            topic_id,
95            subscription_id,
96            server_id: None,
97            delivery_type,
98            delivery_config: None,
99            subscription_mode,
100            last_server_ping: None,
101            error: None,
102            error_handler_path: None,
103            error_handler_args: None,
104            retry: None,
105            path,
106            script_path,
107            permissioned_as,
108            extra_perms,
109            workspace_id,
110            edited_by,
111            edited_at,
112            is_flow,
113            mode,
114            labels: None,
115            draft_only: None,
116            is_draft: None,
117        }
118    }
119}
120