Skip to main content

nautobot_openapi/models/
object_metadata.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/// ObjectMetadata : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct ObjectMetadata {
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 = "assigned_object_type")]
27    pub assigned_object_type: String,
28    #[serde(
29        rename = "assigned_object",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub assigned_object: Option<Option<Box<crate::models::ObjectMetadataAssignedObject>>>,
35    #[serde(
36        rename = "value",
37        default,
38        with = "::serde_with::rust::double_option",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub value: Option<Option<serde_json::Value>>,
42    /// List of scoped fields, only direct fields on the model
43    #[serde(
44        rename = "scoped_fields",
45        default,
46        with = "::serde_with::rust::double_option",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub scoped_fields: Option<Option<serde_json::Value>>,
50    #[serde(rename = "assigned_object_id")]
51    pub assigned_object_id: uuid::Uuid,
52    #[serde(rename = "metadata_type")]
53    pub metadata_type: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
54    #[serde(
55        rename = "contact",
56        default,
57        with = "::serde_with::rust::double_option",
58        skip_serializing_if = "Option::is_none"
59    )]
60    pub contact: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
61    #[serde(
62        rename = "team",
63        default,
64        with = "::serde_with::rust::double_option",
65        skip_serializing_if = "Option::is_none"
66    )]
67    pub team: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
68    #[serde(
69        rename = "created",
70        default,
71        with = "::serde_with::rust::double_option",
72        skip_serializing_if = "Option::is_none"
73    )]
74    pub created: Option<Option<String>>,
75    #[serde(
76        rename = "last_updated",
77        default,
78        with = "::serde_with::rust::double_option",
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub last_updated: Option<Option<String>>,
82}
83
84impl ObjectMetadata {
85    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
86    pub fn new(
87        assigned_object_type: String,
88        assigned_object_id: uuid::Uuid,
89        metadata_type: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
90    ) -> ObjectMetadata {
91        ObjectMetadata {
92            id: None,
93            object_type: None,
94            display: None,
95            url: None,
96            natural_slug: None,
97            assigned_object_type,
98            assigned_object: None,
99            value: None,
100            scoped_fields: None,
101            assigned_object_id,
102            metadata_type: Box::new(metadata_type),
103            contact: None,
104            team: None,
105            created: None,
106            last_updated: None,
107        }
108    }
109}