Skip to main content

nautobot_openapi/models/
object_change.rs

1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// ObjectChange : This base serializer implements common fields and logic for all ModelSerializers.  Namely, it:  - defines the `display` field which exposes a human friendly value for the given object. - ensures that `id` field is always present on the serializer as well. - ensures that `created` and `last_updated` fields are always present if applicable to this model and serializer. - ensures that `object_type` field is always present on the serializer which represents the content-type of this   serializer's associated model (e.g. \"dcim.device\"). This is required as the OpenAPI schema, using the   PolymorphicProxySerializer class defined below, relies upon this field as a way to identify to the client   which of several possible serializers are in use for a given attribute. - supports `?depth` query parameter. It is passed in as `nested_depth` to the `build_nested_field()` function   to enable the dynamic generation of nested serializers.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct ObjectChange {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18    pub object_type: Option<String>,
19    /// Human friendly display value
20    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
21    pub display: Option<String>,
22    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
23    pub url: Option<String>,
24    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
25    pub natural_slug: Option<String>,
26    #[serde(rename = "action", skip_serializing_if = "Option::is_none")]
27    pub action: Option<Box<crate::models::ObjectChangeAction>>,
28    #[serde(
29        rename = "changed_object_type",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub changed_object_type: Option<String>,
33    #[serde(
34        rename = "related_object_type",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub related_object_type: Option<String>,
38    #[serde(
39        rename = "changed_object",
40        default,
41        with = "::serde_with::rust::double_option",
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub changed_object: Option<Option<Box<crate::models::ObjectChangeChangedObject>>>,
45    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
46    pub time: Option<String>,
47    #[serde(rename = "user_name", skip_serializing_if = "Option::is_none")]
48    pub user_name: Option<String>,
49    #[serde(rename = "request_id", skip_serializing_if = "Option::is_none")]
50    pub request_id: Option<uuid::Uuid>,
51    #[serde(rename = "changed_object_id")]
52    pub changed_object_id: uuid::Uuid,
53    #[serde(rename = "change_context", skip_serializing_if = "Option::is_none")]
54    pub change_context: Option<String>,
55    #[serde(
56        rename = "change_context_detail",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub change_context_detail: Option<String>,
60    #[serde(
61        rename = "related_object_id",
62        default,
63        with = "::serde_with::rust::double_option",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub related_object_id: Option<Option<uuid::Uuid>>,
67    #[serde(rename = "object_repr", skip_serializing_if = "Option::is_none")]
68    pub object_repr: Option<String>,
69    #[serde(
70        rename = "object_data",
71        default,
72        with = "::serde_with::rust::double_option",
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub object_data: Option<Option<serde_json::Value>>,
76    #[serde(
77        rename = "object_data_v2",
78        default,
79        with = "::serde_with::rust::double_option",
80        skip_serializing_if = "Option::is_none"
81    )]
82    pub object_data_v2: Option<Option<serde_json::Value>>,
83    #[serde(
84        rename = "user",
85        default,
86        with = "::serde_with::rust::double_option",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub user: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
90}
91
92impl ObjectChange {
93    /// This base serializer implements common fields and logic for all ModelSerializers.  Namely, it:  - defines the `display` field which exposes a human friendly value for the given object. - ensures that `id` field is always present on the serializer as well. - ensures that `created` and `last_updated` fields are always present if applicable to this model and serializer. - ensures that `object_type` field is always present on the serializer which represents the content-type of this   serializer's associated model (e.g. \"dcim.device\"). This is required as the OpenAPI schema, using the   PolymorphicProxySerializer class defined below, relies upon this field as a way to identify to the client   which of several possible serializers are in use for a given attribute. - supports `?depth` query parameter. It is passed in as `nested_depth` to the `build_nested_field()` function   to enable the dynamic generation of nested serializers.
94    pub fn new(changed_object_id: uuid::Uuid) -> ObjectChange {
95        ObjectChange {
96            id: None,
97            object_type: None,
98            display: None,
99            url: None,
100            natural_slug: None,
101            action: None,
102            changed_object_type: None,
103            related_object_type: None,
104            changed_object: None,
105            time: None,
106            user_name: None,
107            request_id: None,
108            changed_object_id,
109            change_context: None,
110            change_context_detail: None,
111            related_object_id: None,
112            object_repr: None,
113            object_data: None,
114            object_data_v2: None,
115            user: None,
116        }
117    }
118}