netbox_openapi/models/
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/// ConsoleServerPortTemplateRequest : 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 ConsoleServerPortTemplateRequest {
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(rename = "type", skip_serializing_if = "Option::is_none")]
37    pub r#type: Option<RHashType>,
38    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
39    pub description: Option<String>,
40}
41
42impl ConsoleServerPortTemplateRequest {
43    /// 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>)
44    pub fn new(name: String) -> ConsoleServerPortTemplateRequest {
45        ConsoleServerPortTemplateRequest {
46            device_type: None,
47            module_type: None,
48            name,
49            label: None,
50            r#type: None,
51            description: None,
52        }
53    }
54}
55
56/// * `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
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum RHashType {
59    #[serde(rename = "de-9")]
60    De9,
61    #[serde(rename = "db-25")]
62    Db25,
63    #[serde(rename = "rj-11")]
64    Rj11,
65    #[serde(rename = "rj-12")]
66    Rj12,
67    #[serde(rename = "rj-45")]
68    Rj45,
69    #[serde(rename = "mini-din-8")]
70    MiniDin8,
71    #[serde(rename = "usb-a")]
72    UsbA,
73    #[serde(rename = "usb-b")]
74    UsbB,
75    #[serde(rename = "usb-c")]
76    UsbC,
77    #[serde(rename = "usb-mini-a")]
78    UsbMiniA,
79    #[serde(rename = "usb-mini-b")]
80    UsbMiniB,
81    #[serde(rename = "usb-micro-a")]
82    UsbMicroA,
83    #[serde(rename = "usb-micro-b")]
84    UsbMicroB,
85    #[serde(rename = "usb-micro-ab")]
86    UsbMicroAb,
87    #[serde(rename = "other")]
88    Other,
89    #[serde(rename = "")]
90    Empty,
91}
92
93impl Default for RHashType {
94    fn default() -> RHashType {
95        Self::De9
96    }
97}