Skip to main content

netbox_openapi/models/
patched_bulk_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.6.8 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// PatchedBulkEventRuleRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PatchedBulkEventRuleRequest {
15    #[serde(rename = "id")]
16    pub id: i32,
17    #[serde(rename = "object_types", skip_serializing_if = "Option::is_none")]
18    pub object_types: Option<Vec<String>>,
19    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
20    pub name: Option<String>,
21    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
22    pub enabled: Option<bool>,
23    /// The types of event which will trigger this rule.
24    #[serde(rename = "event_types", skip_serializing_if = "Option::is_none")]
25    pub event_types: Option<Vec<EventTypes>>,
26    /// A set of conditions which determine whether the event will be generated.
27    #[serde(
28        rename = "conditions",
29        default,
30        with = "::serde_with::rust::double_option",
31        skip_serializing_if = "Option::is_none"
32    )]
33    pub conditions: Option<Option<serde_json::Value>>,
34    /// * `webhook` - Webhook * `script` - Script * `notification` - Notification
35    #[serde(rename = "action_type", skip_serializing_if = "Option::is_none")]
36    pub action_type: Option<ActionType>,
37    #[serde(rename = "action_object_type", skip_serializing_if = "Option::is_none")]
38    pub action_object_type: Option<String>,
39    #[serde(
40        rename = "action_object_id",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub action_object_id: Option<Option<i64>>,
46    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
47    pub description: Option<String>,
48    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
49    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
50    #[serde(
51        rename = "owner",
52        default,
53        with = "::serde_with::rust::double_option",
54        skip_serializing_if = "Option::is_none"
55    )]
56    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
57    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
58    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
59}
60
61impl PatchedBulkEventRuleRequest {
62    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
63    pub fn new(id: i32) -> PatchedBulkEventRuleRequest {
64        PatchedBulkEventRuleRequest {
65            id,
66            object_types: None,
67            name: None,
68            enabled: None,
69            event_types: None,
70            conditions: None,
71            action_type: None,
72            action_object_type: None,
73            action_object_id: None,
74            description: None,
75            custom_fields: None,
76            owner: None,
77            tags: None,
78        }
79    }
80}
81
82/// The types of event which will trigger this rule.
83#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
84pub enum EventTypes {
85    #[serde(rename = "object_created")]
86    ObjectCreated,
87    #[serde(rename = "object_updated")]
88    ObjectUpdated,
89    #[serde(rename = "object_deleted")]
90    ObjectDeleted,
91    #[serde(rename = "job_started")]
92    JobStarted,
93    #[serde(rename = "job_completed")]
94    JobCompleted,
95    #[serde(rename = "job_failed")]
96    JobFailed,
97    #[serde(rename = "job_errored")]
98    JobErrored,
99}
100
101impl Default for EventTypes {
102    fn default() -> EventTypes {
103        Self::ObjectCreated
104    }
105}
106/// * `webhook` - Webhook * `script` - Script * `notification` - Notification
107#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
108pub enum ActionType {
109    #[serde(rename = "webhook")]
110    Webhook,
111    #[serde(rename = "script")]
112    Script,
113    #[serde(rename = "notification")]
114    Notification,
115}
116
117impl Default for ActionType {
118    fn default() -> ActionType {
119        Self::Webhook
120    }
121}