Skip to main content

windmill_api/models/
http_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 HttpTrigger {
16    /// The URL route path that will trigger this endpoint (e.g., 'api/myendpoint'). Must NOT start with a /.
17    #[serde(rename = "route_path")]
18    pub route_path: String,
19    /// Configuration for serving static assets (s3 bucket, storage path, filename)
20    #[serde(rename = "static_asset_config", skip_serializing_if = "Option::is_none")]
21    pub static_asset_config: Option<Box<serde_json::Value>>,
22    #[serde(rename = "http_method")]
23    pub http_method: models::HttpMethod,
24    /// Path to the resource containing authentication configuration (for api_key, basic_http, custom_script, signature methods)
25    #[serde(rename = "authentication_resource_path", skip_serializing_if = "Option::is_none")]
26    pub authentication_resource_path: Option<String>,
27    /// Short summary describing the purpose of this trigger
28    #[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
29    pub summary: Option<String>,
30    /// Detailed description of what this trigger does
31    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
32    pub description: Option<String>,
33    #[serde(rename = "request_type")]
34    pub request_type: models::HttpRequestType,
35    #[serde(rename = "authentication_method")]
36    pub authentication_method: models::AuthenticationMethod,
37    /// If true, serves static files from S3/storage instead of running a script
38    #[serde(rename = "is_static_website")]
39    pub is_static_website: bool,
40    /// If true, the route includes the workspace ID in the path
41    #[serde(rename = "workspaced_route")]
42    pub workspaced_route: bool,
43    /// If true, wraps the request body in a 'body' parameter
44    #[serde(rename = "wrap_body")]
45    pub wrap_body: bool,
46    /// If true, passes the request body as a raw string instead of parsing as JSON
47    #[serde(rename = "raw_string")]
48    pub raw_string: bool,
49    /// Path to a script or flow to run when the triggered job fails
50    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
51    pub error_handler_path: Option<String>,
52    /// The arguments to pass to the script or flow
53    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
54    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
55    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
56    pub retry: Option<Box<models::Retry>>,
57    /// The unique path identifier for this trigger
58    #[serde(rename = "path")]
59    pub path: String,
60    /// Path to the script or flow to execute when triggered
61    #[serde(rename = "script_path")]
62    pub script_path: String,
63    /// Email of the user who owns this trigger, used for permissioned_as
64    #[serde(rename = "email")]
65    pub email: String,
66    /// Additional permissions for this trigger
67    #[serde(rename = "extra_perms")]
68    pub extra_perms: std::collections::HashMap<String, bool>,
69    /// The workspace this trigger belongs to
70    #[serde(rename = "workspace_id")]
71    pub workspace_id: String,
72    /// Username of the last person who edited this trigger
73    #[serde(rename = "edited_by")]
74    pub edited_by: String,
75    /// Timestamp of the last edit
76    #[serde(rename = "edited_at")]
77    pub edited_at: String,
78    /// True if script_path points to a flow, false if it points to a script
79    #[serde(rename = "is_flow")]
80    pub is_flow: bool,
81    #[serde(rename = "mode")]
82    pub mode: models::TriggerMode,
83}
84
85impl HttpTrigger {
86    pub fn new(route_path: String, http_method: models::HttpMethod, request_type: models::HttpRequestType, authentication_method: models::AuthenticationMethod, is_static_website: bool, workspaced_route: bool, wrap_body: bool, raw_string: bool, 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) -> HttpTrigger {
87        HttpTrigger {
88            route_path,
89            static_asset_config: None,
90            http_method,
91            authentication_resource_path: None,
92            summary: None,
93            description: None,
94            request_type,
95            authentication_method,
96            is_static_website,
97            workspaced_route,
98            wrap_body,
99            raw_string,
100            error_handler_path: None,
101            error_handler_args: None,
102            retry: None,
103            path,
104            script_path,
105            email,
106            extra_perms,
107            workspace_id,
108            edited_by,
109            edited_at,
110            is_flow,
111            mode,
112        }
113    }
114}
115