netbox_openapi/models/
journal_entry_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/// JournalEntryRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct JournalEntryRequest {
15    #[serde(rename = "assigned_object_type")]
16    pub assigned_object_type: String,
17    #[serde(rename = "assigned_object_id")]
18    pub assigned_object_id: i64,
19    #[serde(
20        rename = "created_by",
21        default,
22        with = "::serde_with::rust::double_option",
23        skip_serializing_if = "Option::is_none"
24    )]
25    pub created_by: Option<Option<i32>>,
26    /// * `info` - Info * `success` - Success * `warning` - Warning * `danger` - Danger
27    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
28    pub kind: Option<Kind>,
29    #[serde(rename = "comments")]
30    pub comments: String,
31    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
32    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
33    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
34    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
35}
36
37impl JournalEntryRequest {
38    /// Adds support for custom fields and tags.
39    pub fn new(
40        assigned_object_type: String,
41        assigned_object_id: i64,
42        comments: String,
43    ) -> JournalEntryRequest {
44        JournalEntryRequest {
45            assigned_object_type,
46            assigned_object_id,
47            created_by: None,
48            kind: None,
49            comments,
50            tags: None,
51            custom_fields: None,
52        }
53    }
54}
55
56/// * `info` - Info * `success` - Success * `warning` - Warning * `danger` - Danger
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Kind {
59    #[serde(rename = "info")]
60    Info,
61    #[serde(rename = "success")]
62    Success,
63    #[serde(rename = "warning")]
64    Warning,
65    #[serde(rename = "danger")]
66    Danger,
67}
68
69impl Default for Kind {
70    fn default() -> Kind {
71        Self::Info
72    }
73}