/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.813.0
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct HttpTrigger {
/// The URL route path that will trigger this endpoint (e.g., 'api/myendpoint'). Must NOT start with a /.
#[serde(rename = "route_path")]
pub route_path: String,
/// Configuration for serving static assets (s3 bucket, storage path, filename)
#[serde(rename = "static_asset_config", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub static_asset_config: Option<Option<Box<serde_json::Value>>>,
#[serde(rename = "http_method")]
pub http_method: models::HttpMethod,
/// Path to the resource containing authentication configuration (for api_key, basic_http, custom_script, signature methods)
#[serde(rename = "authentication_resource_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub authentication_resource_path: Option<Option<String>>,
/// Short summary describing the purpose of this trigger
#[serde(rename = "summary", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub summary: Option<Option<String>>,
/// Detailed description of what this trigger does
#[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub description: Option<Option<String>>,
#[serde(rename = "request_type")]
pub request_type: models::HttpRequestType,
#[serde(rename = "authentication_method")]
pub authentication_method: models::AuthenticationMethod,
/// If true, serves static files from S3/storage instead of running a script
#[serde(rename = "is_static_website")]
pub is_static_website: bool,
/// If true, the route includes the workspace ID in the path
#[serde(rename = "workspaced_route")]
pub workspaced_route: bool,
/// If true, wraps the request body in a 'body' parameter
#[serde(rename = "wrap_body")]
pub wrap_body: bool,
/// If true, passes the request body as a raw string instead of parsing as JSON
#[serde(rename = "raw_string")]
pub raw_string: bool,
/// 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.
#[serde(rename = "allowed_origins", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub allowed_origins: Option<Option<Vec<String>>>,
/// 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.
#[serde(rename = "error_handler_path", skip_serializing_if = "Option::is_none")]
pub error_handler_path: Option<String>,
/// The arguments to pass to the script or flow
#[serde(rename = "error_handler_args", skip_serializing_if = "Option::is_none")]
pub error_handler_args: Option<std::collections::HashMap<String, serde_json::Value>>,
#[serde(rename = "retry", skip_serializing_if = "Option::is_none")]
pub retry: Option<Box<models::Retry>>,
/// 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.
#[serde(rename = "path")]
pub path: String,
/// Path to the script or flow to execute when triggered
#[serde(rename = "script_path")]
pub script_path: String,
/// The user or group this trigger runs as (permissioned_as)
#[serde(rename = "permissioned_as")]
pub permissioned_as: String,
/// Additional permissions for this trigger
#[serde(rename = "extra_perms")]
pub extra_perms: std::collections::HashMap<String, bool>,
/// The workspace this trigger belongs to
#[serde(rename = "workspace_id")]
pub workspace_id: String,
/// Username of the last person who edited this trigger
#[serde(rename = "edited_by")]
pub edited_by: String,
/// Timestamp of the last edit
#[serde(rename = "edited_at")]
pub edited_at: String,
/// True if script_path points to a flow, false if it points to a script
#[serde(rename = "is_flow")]
pub is_flow: bool,
#[serde(rename = "mode")]
pub mode: models::TriggerMode,
#[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
pub labels: Option<Vec<String>>,
/// 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.
#[serde(rename = "draft_only", skip_serializing_if = "Option::is_none")]
pub draft_only: Option<bool>,
/// 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.
#[serde(rename = "is_draft", skip_serializing_if = "Option::is_none")]
pub is_draft: Option<bool>,
}
impl HttpTrigger {
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, 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) -> HttpTrigger {
HttpTrigger {
route_path,
static_asset_config: None,
http_method,
authentication_resource_path: None,
summary: None,
description: None,
request_type,
authentication_method,
is_static_website,
workspaced_route,
wrap_body,
raw_string,
allowed_origins: None,
error_handler_path: None,
error_handler_args: None,
retry: None,
path,
script_path,
permissioned_as,
extra_perms,
workspace_id,
edited_by,
edited_at,
is_flow,
mode,
labels: None,
draft_only: None,
is_draft: None,
}
}
}