netbox_openapi/models/
patched_writable_event_rule_request.rs1#[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 #[serde(rename = "event_types", skip_serializing_if = "Option::is_none")]
23 pub event_types: Option<Vec<EventTypes>>,
24 #[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 #[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 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#[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#[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}