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.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/// 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.
18    #[serde(rename = "gcp_resource_path")]
19    pub gcp_resource_path: String,
20    #[serde(rename = "subscription_mode")]
21    pub subscription_mode: models::SubscriptionMode,
22    /// Google Cloud Pub/Sub topic ID to subscribe to.
23    #[serde(rename = "topic_id")]
24    pub topic_id: String,
25    /// Google Cloud Pub/Sub subscription ID.
26    #[serde(rename = "subscription_id", skip_serializing_if = "Option::is_none")]
27    pub subscription_id: Option<String>,
28    /// Base URL for push delivery endpoint.
29    #[serde(rename = "base_endpoint", skip_serializing_if = "Option::is_none")]
30    pub base_endpoint: Option<String>,
31    #[serde(rename = "delivery_type", skip_serializing_if = "Option::is_none")]
32    pub delivery_type: Option<models::DeliveryType>,
33    #[serde(rename = "delivery_config", skip_serializing_if = "Option::is_none")]
34    pub delivery_config: Option<Box<models::PushConfig>>,
35    /// The unique path identifier for this trigger.
36    #[serde(rename = "path")]
37    pub path: String,
38    /// Path to the script or flow to execute when a message is received.
39    #[serde(rename = "script_path")]
40    pub script_path: String,
41    /// True if script_path points to a flow, false if it points to a script.
42    #[serde(rename = "is_flow")]
43    pub is_flow: bool,
44    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
45    pub mode: Option<models::TriggerMode>,
46    /// If true, automatically acknowledge messages after processing.
47    #[serde(rename = "auto_acknowledge_msg", skip_serializing_if = "Option::is_none")]
48    pub auto_acknowledge_msg: Option<bool>,
49    /// Time in seconds within which the message must be acknowledged. If not provided, defaults to the subscription's acknowledgment deadline (600 seconds).
50    #[serde(rename = "ack_deadline", skip_serializing_if = "Option::is_none")]
51    pub ack_deadline: Option<i32>,
52    /// Path to a script or flow to run when the triggered job fails.
53    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
54    pub error_handler_path: Option<String>,
55    /// The arguments to pass to the script or flow
56    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
57    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
58    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
59    pub retry: Option<Box<models::Retry>>,
60}
61
62impl GcpTriggerData {
63    /// Data for creating or updating a Google Cloud Pub/Sub trigger.
64    pub fn new(gcp_resource_path: String, subscription_mode: models::SubscriptionMode, topic_id: String, path: String, script_path: String, is_flow: bool) -> GcpTriggerData {
65        GcpTriggerData {
66            gcp_resource_path,
67            subscription_mode,
68            topic_id,
69            subscription_id: None,
70            base_endpoint: None,
71            delivery_type: None,
72            delivery_config: None,
73            path,
74            script_path,
75            is_flow,
76            mode: None,
77            auto_acknowledge_msg: None,
78            ack_deadline: None,
79            error_handler_path: None,
80            error_handler_args: None,
81            retry: None,
82        }
83    }
84}
85