netbox_openapi/models/
device_bay_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/// DeviceBayTemplate : 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 DeviceBayTemplate {
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    /// {module} is accepted as a substitution for the module bay position when attached to a module type.
24    #[serde(rename = "name")]
25    pub name: String,
26    /// Physical label
27    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
28    pub label: Option<String>,
29    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
30    pub description: Option<String>,
31    #[serde(
32        rename = "created",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub created: Option<Option<String>>,
38    #[serde(
39        rename = "last_updated",
40        default,
41        with = "::serde_with::rust::double_option",
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub last_updated: Option<Option<String>>,
45}
46
47impl DeviceBayTemplate {
48    /// 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>)
49    pub fn new(device_type: crate::models::BriefDeviceType, name: String) -> DeviceBayTemplate {
50        DeviceBayTemplate {
51            id: None,
52            url: None,
53            display: None,
54            device_type: Box::new(device_type),
55            name,
56            label: None,
57            description: None,
58            created: None,
59            last_updated: None,
60        }
61    }
62}