netbox_openapi/models/
inventory_item_template.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/// InventoryItemTemplate : 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 InventoryItemTemplate {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<i32>,
17    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
18    pub url: Option<String>,
19    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
20    pub display: Option<String>,
21    #[serde(rename = "device_type")]
22    pub device_type: Box<crate::models::BriefDeviceType>,
23    #[serde(
24        rename = "parent",
25        default,
26        with = "::serde_with::rust::double_option",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub parent: Option<Option<i32>>,
30    /// {module} is accepted as a substitution for the module bay position when attached to a module type.
31    #[serde(rename = "name")]
32    pub name: String,
33    /// Physical label
34    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
35    pub label: Option<String>,
36    #[serde(
37        rename = "role",
38        default,
39        with = "::serde_with::rust::double_option",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub role: Option<Option<Box<crate::models::BriefInventoryItemRole>>>,
43    #[serde(
44        rename = "manufacturer",
45        default,
46        with = "::serde_with::rust::double_option",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub manufacturer: Option<Option<Box<crate::models::BriefManufacturer>>>,
50    /// Manufacturer-assigned part identifier
51    #[serde(rename = "part_id", skip_serializing_if = "Option::is_none")]
52    pub part_id: Option<String>,
53    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
54    pub description: Option<String>,
55    #[serde(
56        rename = "component_type",
57        default,
58        with = "::serde_with::rust::double_option",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub component_type: Option<Option<String>>,
62    #[serde(
63        rename = "component_id",
64        default,
65        with = "::serde_with::rust::double_option",
66        skip_serializing_if = "Option::is_none"
67    )]
68    pub component_id: Option<Option<i64>>,
69    #[serde(
70        rename = "component",
71        default,
72        with = "::serde_with::rust::double_option",
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub component: Option<Option<serde_json::Value>>,
76    #[serde(
77        rename = "created",
78        default,
79        with = "::serde_with::rust::double_option",
80        skip_serializing_if = "Option::is_none"
81    )]
82    pub created: Option<Option<String>>,
83    #[serde(
84        rename = "last_updated",
85        default,
86        with = "::serde_with::rust::double_option",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub last_updated: Option<Option<String>>,
90    #[serde(rename = "_depth", skip_serializing_if = "Option::is_none")]
91    pub _depth: Option<i32>,
92}
93
94impl InventoryItemTemplate {
95    /// 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>)
96    pub fn new(device_type: crate::models::BriefDeviceType, name: String) -> InventoryItemTemplate {
97        InventoryItemTemplate {
98            id: None,
99            url: None,
100            display: None,
101            device_type: Box::new(device_type),
102            parent: None,
103            name,
104            label: None,
105            role: None,
106            manufacturer: None,
107            part_id: None,
108            description: None,
109            component_type: None,
110            component_id: None,
111            component: None,
112            created: None,
113            last_updated: None,
114            _depth: None,
115        }
116    }
117}