Skip to main content

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.6.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// PatchedWritableEventRuleRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
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(
49        rename = "owner",
50        default,
51        with = "::serde_with::rust::double_option",
52        skip_serializing_if = "Option::is_none"
53    )]
54    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
55    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
56    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
57}
58
59impl PatchedWritableEventRuleRequest {
60    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
61    pub fn new() -> PatchedWritableEventRuleRequest {
62        PatchedWritableEventRuleRequest {
63            object_types: None,
64            name: None,
65            enabled: None,
66            event_types: None,
67            conditions: None,
68            action_type: None,
69            action_object_type: None,
70            action_object_id: None,
71            description: None,
72            custom_fields: None,
73            owner: None,
74            tags: None,
75        }
76    }
77}
78
79/// The types of event which will trigger this rule.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum EventTypes {
82    #[serde(rename = "object_created")]
83    ObjectCreated,
84    #[serde(rename = "object_updated")]
85    ObjectUpdated,
86    #[serde(rename = "object_deleted")]
87    ObjectDeleted,
88    #[serde(rename = "job_started")]
89    JobStarted,
90    #[serde(rename = "job_completed")]
91    JobCompleted,
92    #[serde(rename = "job_failed")]
93    JobFailed,
94    #[serde(rename = "job_errored")]
95    JobErrored,
96}
97
98impl Default for EventTypes {
99    fn default() -> EventTypes {
100        Self::ObjectCreated
101    }
102}
103/// * `webhook` - Webhook * `script` - Script * `notification` - Notification
104#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
105pub enum ActionType {
106    #[serde(rename = "webhook")]
107    Webhook,
108    #[serde(rename = "script")]
109    Script,
110    #[serde(rename = "notification")]
111    Notification,
112}
113
114impl Default for ActionType {
115    fn default() -> ActionType {
116        Self::Webhook
117    }
118}