Skip to main content

windmill_api/models/
trigger_history_entry.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.792.1
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 TriggerHistoryEntry {
16    #[serde(rename = "id")]
17    pub id: i64,
18    /// 'schedule' or a trigger type (http, kafka, ...)
19    #[serde(rename = "trigger_kind")]
20    pub trigger_kind: String,
21    #[serde(rename = "path")]
22    pub path: String,
23    #[serde(rename = "operation")]
24    pub operation: Operation,
25    /// The kind of client the change came from. `worker` means the server disabled the trigger on its own after a failure.
26    #[serde(rename = "source")]
27    pub source: Source,
28    /// Unset when the server acted on its own.
29    #[serde(rename = "username", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub username: Option<Option<String>>,
31    #[serde(rename = "created_at")]
32    pub created_at: String,
33    /// {field: {old, new}} for the fields that actually changed. Unset for a delete.
34    #[serde(rename = "changes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub changes: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
36}
37
38impl TriggerHistoryEntry {
39    pub fn new(id: i64, trigger_kind: String, path: String, operation: Operation, source: Source, created_at: String) -> TriggerHistoryEntry {
40        TriggerHistoryEntry {
41            id,
42            trigger_kind,
43            path,
44            operation,
45            source,
46            username: None,
47            created_at,
48            changes: None,
49        }
50    }
51}
52/// 
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum Operation {
55    #[serde(rename = "create")]
56    Create,
57    #[serde(rename = "update")]
58    Update,
59    #[serde(rename = "delete")]
60    Delete,
61    #[serde(rename = "enable")]
62    Enable,
63    #[serde(rename = "disable")]
64    Disable,
65    #[serde(rename = "suspend")]
66    Suspend,
67}
68
69impl Default for Operation {
70    fn default() -> Operation {
71        Self::Create
72    }
73}
74/// The kind of client the change came from. `worker` means the server disabled the trigger on its own after a failure.
75#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
76pub enum Source {
77    #[serde(rename = "ui")]
78    Ui,
79    #[serde(rename = "cli")]
80    Cli,
81    #[serde(rename = "api")]
82    Api,
83    #[serde(rename = "worker")]
84    Worker,
85}
86
87impl Default for Source {
88    fn default() -> Source {
89        Self::Ui
90    }
91}
92