Skip to main content

windmill_api/models/
new_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.817.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 NewHttpTrigger {
16    /// 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.
17    #[serde(rename = "path")]
18    pub path: String,
19    /// Path to the script or flow to execute when triggered
20    #[serde(rename = "script_path")]
21    pub script_path: String,
22    /// The URL route path that will trigger this endpoint (e.g., 'api/myendpoint'). Must NOT start with a /.
23    #[serde(rename = "route_path")]
24    pub route_path: String,
25    /// If true, the route includes the workspace ID in the path
26    #[serde(rename = "workspaced_route", skip_serializing_if = "Option::is_none")]
27    pub workspaced_route: Option<bool>,
28    /// Short summary describing the purpose of this trigger
29    #[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub summary: Option<Option<String>>,
31    /// Detailed description of what this trigger does
32    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub description: Option<Option<String>>,
34    #[serde(rename = "static_asset_config", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub static_asset_config: Option<Option<Box<models::NewHttpTriggerStaticAssetConfig>>>,
36    /// True if script_path points to a flow, false if it points to a script
37    #[serde(rename = "is_flow")]
38    pub is_flow: bool,
39    #[serde(rename = "http_method")]
40    pub http_method: models::HttpMethod,
41    /// Path to the resource containing authentication configuration (for api_key, basic_http, custom_script, signature methods)
42    #[serde(rename = "authentication_resource_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub authentication_resource_path: Option<Option<String>>,
44    /// Deprecated, use request_type instead
45    #[serde(rename = "is_async", skip_serializing_if = "Option::is_none")]
46    pub is_async: Option<bool>,
47    #[serde(rename = "request_type", skip_serializing_if = "Option::is_none")]
48    pub request_type: Option<models::HttpRequestType>,
49    #[serde(rename = "authentication_method")]
50    pub authentication_method: models::AuthenticationMethod,
51    /// If true, serves static files from S3/storage instead of running a script
52    #[serde(rename = "is_static_website")]
53    pub is_static_website: bool,
54    /// If true, wraps the request body in a 'body' parameter
55    #[serde(rename = "wrap_body", skip_serializing_if = "Option::is_none")]
56    pub wrap_body: Option<bool>,
57    #[serde(rename = "mode", skip_serializing_if = "Option::is_none")]
58    pub mode: Option<models::TriggerMode>,
59    /// If true, passes the request body as a raw string instead of parsing as JSON
60    #[serde(rename = "raw_string", skip_serializing_if = "Option::is_none")]
61    pub raw_string: Option<bool>,
62    /// Origins allowed to call this route cross-origin, matched against the request's Origin header (ignoring case) and echoed back on a match. When set, the list governs both the preflight and the response, overriding any Access-Control-Allow-Origin the runnable returns via wm_headers. Use ['*'] to opt out of any restriction, including the http_route_default_allowed_origins instance setting. An empty list is not a configuration and resolves exactly as null does. When null, the instance setting applies, or Access-Control-Allow-Origin: * if it is unset. Ignored on a static website, which has no authentication of its own and so hands out public files: restricting which browsers may read them protects nothing while breaking cross-origin webfonts and fetches. A single-file static asset is not exempt, since it can carry an authentication_method.
63    #[serde(rename = "allowed_origins", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
64    pub allowed_origins: Option<Option<Vec<String>>>,
65    /// Path to a script to run when the triggered job fails. A bare path, without the script/ or flow/ prefix a schedule error handler takes; it cannot be a flow.
66    #[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
67    pub error_handler_path: Option<String>,
68    /// The arguments to pass to the script or flow
69    #[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
70    pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
71    #[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
72    pub retry: Option<Box<models::Retry>>,
73    /// The user or group this trigger runs as. Used during deployment to preserve the original trigger owner.
74    #[serde(rename = "permissioned_as", skip_serializing_if = "Option::is_none")]
75    pub permissioned_as: Option<String>,
76    /// When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
77    #[serde(rename = "preserve_permissioned_as", skip_serializing_if = "Option::is_none")]
78    pub preserve_permissioned_as: Option<bool>,
79    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
80    pub labels: Option<Vec<String>>,
81}
82
83impl NewHttpTrigger {
84    pub fn new(path: String, script_path: String, route_path: String, is_flow: bool, http_method: models::HttpMethod, authentication_method: models::AuthenticationMethod, is_static_website: bool) -> NewHttpTrigger {
85        NewHttpTrigger {
86            path,
87            script_path,
88            route_path,
89            workspaced_route: None,
90            summary: None,
91            description: None,
92            static_asset_config: None,
93            is_flow,
94            http_method,
95            authentication_resource_path: None,
96            is_async: None,
97            request_type: None,
98            authentication_method,
99            is_static_website,
100            wrap_body: None,
101            mode: None,
102            raw_string: None,
103            allowed_origins: None,
104            error_handler_path: None,
105            error_handler_args: None,
106            retry: None,
107            permissioned_as: None,
108            preserve_permissioned_as: None,
109            labels: None,
110        }
111    }
112}
113