Skip to main content

windmill_api/models/
gcp_trigger_data.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.794.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// GcpTriggerData : Data for creating or updating a Google Cloud Pub/Sub trigger.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct GcpTriggerData {
17    /// Path to the GCP resource containing service account credentials for authentication. Omit to authenticate with the instance's application default credentials, which only workspace admins may select.
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    #[serde(rename = "subscription_mode")]
24    pub subscription_mode: models::SubscriptionMode,
25    /// Google Cloud Pub/Sub topic ID to subscribe to. Accepts a bare ID or a fully qualified name (projects/<project>/topics/<id>).
26    #[serde(rename = "topic_id")]
27    pub topic_id: String,
28    /// Google Cloud Pub/Sub subscription ID. Accepts a bare ID or a fully qualified name (projects/<project>/subscriptions/<id>).
29    #[serde(rename = "subscription_id", skip_serializing_if = "Option::is_none")]
30    pub subscription_id: Option<String>,
31    /// Base URL for push delivery endpoint.
32    #[serde(rename = "base_endpoint", skip_serializing_if = "Option::is_none")]
33    pub base_endpoint: Option<String>,
34    #[serde(rename = "delivery_type", skip_serializing_if = "Option::is_none")]
35    pub delivery_type: Option<models::DeliveryType>,
36    #[serde(rename = "delivery_config", skip_serializing_if = "Option::is_none")]
37    pub delivery_config: Option<Box<models::PushConfig>>,
38    /// 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.
39    #[serde(rename = "path")]
40    pub path: String,
41    /// Path to the script or flow to execute when a message is received.
42    #[serde(rename = "script_path")]
43    pub script_path: String,
44    /// True if script_path points to a flow, false if it points to a script.
45    #[serde(rename = "is_flow")]
46    pub is_flow: bool,
47    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
48    pub mode: Option<models::TriggerMode>,
49    /// If true, automatically acknowledge messages after processing.
50    #[serde(rename = "auto_acknowledge_msg", skip_serializing_if = "Option::is_none")]
51    pub auto_acknowledge_msg: Option<bool>,
52    /// Time in seconds within which the message must be acknowledged. If not provided, defaults to the subscription's acknowledgment deadline (600 seconds).
53    #[serde(rename = "ack_deadline", skip_serializing_if = "Option::is_none")]
54    pub ack_deadline: Option<i32>,
55    /// Path to a script or flow to run when the triggered job fails.
56    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
57    pub error_handler_path: Option<String>,
58    /// The arguments to pass to the script or flow
59    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
60    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
61    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
62    pub retry: Option<Box<models::Retry>>,
63    /// The user or group this trigger runs as. Used during deployment to preserve the original trigger owner.
64    #[serde(rename = "permissioned_as", skip_serializing_if = "Option::is_none")]
65    pub permissioned_as: Option<String>,
66    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
67    #[serde(rename = "preserve_permissioned_as", skip_serializing_if = "Option::is_none")]
68    pub preserve_permissioned_as: Option<bool>,
69    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
70    pub labels: Option<Vec<String>>,
71}
72
73impl GcpTriggerData {
74    /// Data for creating or updating a Google Cloud Pub/Sub trigger.
75    pub fn new(subscription_mode: models::SubscriptionMode, topic_id: String, path: String, script_path: String, is_flow: bool) -> GcpTriggerData {
76        GcpTriggerData {
77            gcp_resource_path: None,
78            project_id: None,
79            subscription_mode,
80            topic_id,
81            subscription_id: None,
82            base_endpoint: None,
83            delivery_type: None,
84            delivery_config: None,
85            path,
86            script_path,
87            is_flow,
88            mode: None,
89            auto_acknowledge_msg: None,
90            ack_deadline: None,
91            error_handler_path: None,
92            error_handler_args: None,
93            retry: None,
94            permissioned_as: None,
95            preserve_permissioned_as: None,
96            labels: None,
97        }
98    }
99}
100