netbox_openapi/models/
patched_writable_event_rule_request.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// PatchedWritableEventRuleRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PatchedWritableEventRuleRequest {
15    #[serde(rename = "object_types", skip_serializing_if = "Option::is_none")]
16    pub object_types: Option<Vec<String>>,
17    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
18    pub name: Option<String>,
19    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
20    pub enabled: Option<bool>,
21    /// The types of event which will trigger this rule.
22    #[serde(rename = "event_types", skip_serializing_if = "Option::is_none")]
23    pub event_types: Option<Vec<EventTypes>>,
24    /// A set of conditions which determine whether the event will be generated.
25    #[serde(
26        rename = "conditions",
27        default,
28        with = "::serde_with::rust::double_option",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub conditions: Option<Option<serde_json::Value>>,
32    /// * `webhook` - Webhook * `script` - Script * `notification` - Notification
33    #[serde(rename = "action_type", skip_serializing_if = "Option::is_none")]
34    pub action_type: Option<ActionType>,
35    #[serde(rename = "action_object_type", skip_serializing_if = "Option::is_none")]
36    pub action_object_type: Option<String>,
37    #[serde(
38        rename = "action_object_id",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub action_object_id: Option<Option<i64>>,
44    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
45    pub description: Option<String>,
46    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
47    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
48    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
49    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
50}
51
52impl PatchedWritableEventRuleRequest {
53    /// Adds support for custom fields and tags.
54    pub fn new() -> PatchedWritableEventRuleRequest {
55        PatchedWritableEventRuleRequest {
56            object_types: None,
57            name: None,
58            enabled: None,
59            event_types: None,
60            conditions: None,
61            action_type: None,
62            action_object_type: None,
63            action_object_id: None,
64            description: None,
65            custom_fields: None,
66            tags: None,
67        }
68    }
69}
70
71/// The types of event which will trigger this rule.
72#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
73pub enum EventTypes {
74    #[serde(rename = "object_created")]
75    ObjectCreated,
76    #[serde(rename = "object_updated")]
77    ObjectUpdated,
78    #[serde(rename = "object_deleted")]
79    ObjectDeleted,
80    #[serde(rename = "job_started")]
81    JobStarted,
82    #[serde(rename = "job_completed")]
83    JobCompleted,
84    #[serde(rename = "job_failed")]
85    JobFailed,
86    #[serde(rename = "job_errored")]
87    JobErrored,
88    #[serde(rename = "branch_provisioned")]
89    BranchProvisioned,
90    #[serde(rename = "branch_deprovisioned")]
91    BranchDeprovisioned,
92    #[serde(rename = "branch_synced")]
93    BranchSynced,
94    #[serde(rename = "branch_merged")]
95    BranchMerged,
96    #[serde(rename = "branch_reverted")]
97    BranchReverted,
98}
99
100impl Default for EventTypes {
101    fn default() -> EventTypes {
102        Self::ObjectCreated
103    }
104}
105/// * `webhook` - Webhook * `script` - Script * `notification` - Notification
106#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
107pub enum ActionType {
108    #[serde(rename = "webhook")]
109    Webhook,
110    #[serde(rename = "script")]
111    Script,
112    #[serde(rename = "notification")]
113    Notification,
114}
115
116impl Default for ActionType {
117    fn default() -> ActionType {
118        Self::Webhook
119    }
120}