Skip to main content

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.6.2 (4.6)
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 = "enabled", skip_serializing_if = "Option::is_none")]
30    pub enabled: Option<bool>,
31    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
32    pub description: Option<String>,
33    #[serde(
34        rename = "created",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub created: Option<Option<String>>,
40    #[serde(
41        rename = "last_updated",
42        default,
43        with = "::serde_with::rust::double_option",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub last_updated: Option<Option<String>>,
47}
48
49impl DeviceBayTemplate {
50    /// 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>)
51    pub fn new(device_type: crate::models::BriefDeviceType, name: String) -> DeviceBayTemplate {
52        DeviceBayTemplate {
53            id: None,
54            url: None,
55            display: None,
56            device_type: Box::new(device_type),
57            name,
58            label: None,
59            enabled: None,
60            description: None,
61            created: None,
62            last_updated: None,
63        }
64    }
65}