netbox_openapi/models/
writable_console_server_port_template_request.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/// WritableConsoleServerPortTemplateRequest : 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 WritableConsoleServerPortTemplateRequest {
15    #[serde(
16        rename = "device_type",
17        default,
18        with = "::serde_with::rust::double_option",
19        skip_serializing_if = "Option::is_none"
20    )]
21    pub device_type: Option<Option<Box<crate::models::ConsolePortTemplateRequestDeviceType>>>,
22    #[serde(
23        rename = "module_type",
24        default,
25        with = "::serde_with::rust::double_option",
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub module_type: Option<Option<Box<crate::models::ConsolePortTemplateRequestModuleType>>>,
29    /// {module} is accepted as a substitution for the module bay position when attached to a module type.
30    #[serde(rename = "name")]
31    pub name: String,
32    /// Physical label
33    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
34    pub label: Option<String>,
35    /// * `de-9` - DE-9 * `db-25` - DB-25 * `rj-11` - RJ-11 * `rj-12` - RJ-12 * `rj-45` - RJ-45 * `mini-din-8` - Mini-DIN 8 * `usb-a` - USB Type A * `usb-b` - USB Type B * `usb-c` - USB Type C * `usb-mini-a` - USB Mini A * `usb-mini-b` - USB Mini B * `usb-micro-a` - USB Micro A * `usb-micro-b` - USB Micro B * `usb-micro-ab` - USB Micro AB * `other` - Other
36    #[serde(
37        rename = "type",
38        default,
39        with = "::serde_with::rust::double_option",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub r#type: Option<Option<RHashType>>,
43    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
44    pub description: Option<String>,
45}
46
47impl WritableConsoleServerPortTemplateRequest {
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(name: String) -> WritableConsoleServerPortTemplateRequest {
50        WritableConsoleServerPortTemplateRequest {
51            device_type: None,
52            module_type: None,
53            name,
54            label: None,
55            r#type: None,
56            description: None,
57        }
58    }
59}
60
61/// * `de-9` - DE-9 * `db-25` - DB-25 * `rj-11` - RJ-11 * `rj-12` - RJ-12 * `rj-45` - RJ-45 * `mini-din-8` - Mini-DIN 8 * `usb-a` - USB Type A * `usb-b` - USB Type B * `usb-c` - USB Type C * `usb-mini-a` - USB Mini A * `usb-mini-b` - USB Mini B * `usb-micro-a` - USB Micro A * `usb-micro-b` - USB Micro B * `usb-micro-ab` - USB Micro AB * `other` - Other
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
63pub enum RHashType {
64    #[serde(rename = "de-9")]
65    De9,
66    #[serde(rename = "db-25")]
67    Db25,
68    #[serde(rename = "rj-11")]
69    Rj11,
70    #[serde(rename = "rj-12")]
71    Rj12,
72    #[serde(rename = "rj-45")]
73    Rj45,
74    #[serde(rename = "mini-din-8")]
75    MiniDin8,
76    #[serde(rename = "usb-a")]
77    UsbA,
78    #[serde(rename = "usb-b")]
79    UsbB,
80    #[serde(rename = "usb-c")]
81    UsbC,
82    #[serde(rename = "usb-mini-a")]
83    UsbMiniA,
84    #[serde(rename = "usb-mini-b")]
85    UsbMiniB,
86    #[serde(rename = "usb-micro-a")]
87    UsbMicroA,
88    #[serde(rename = "usb-micro-b")]
89    UsbMicroB,
90    #[serde(rename = "usb-micro-ab")]
91    UsbMicroAb,
92    #[serde(rename = "other")]
93    Other,
94    #[serde(rename = "")]
95    Empty,
96    #[serde(rename = "null")]
97    Null,
98}
99
100impl Default for RHashType {
101    fn default() -> RHashType {
102        Self::De9
103    }
104}