Skip to main content

netbox_openapi/models/
virtualization_virtual_machines_create_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.5.9-Docker-4.0.2 (4.5)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct VirtualizationVirtualMachinesCreateRequest {
13    #[serde(rename = "name")]
14    pub name: String,
15    /// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `decommissioning` - Decommissioning * `paused` - Paused
16    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
17    pub status: Option<Status>,
18    /// * `on` - On * `off` - Off * `laststate` - Last State
19    #[serde(rename = "start_on_boot", skip_serializing_if = "Option::is_none")]
20    pub start_on_boot: Option<StartOnBoot>,
21    #[serde(
22        rename = "site",
23        default,
24        with = "::serde_with::rust::double_option",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub site: Option<Option<Box<crate::models::CreateAvailableVlanRequestSite>>>,
28    #[serde(
29        rename = "cluster",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub cluster: Option<Option<Box<crate::models::DeviceWithConfigContextRequestCluster>>>,
35    #[serde(
36        rename = "device",
37        default,
38        with = "::serde_with::rust::double_option",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub device: Option<Option<Box<crate::models::DeviceBayRequestInstalledDevice>>>,
42    #[serde(rename = "serial", skip_serializing_if = "Option::is_none")]
43    pub serial: Option<String>,
44    #[serde(
45        rename = "role",
46        default,
47        with = "::serde_with::rust::double_option",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub role: Option<
51        Option<Box<crate::models::PatchedWritableVirtualMachineWithConfigContextRequestRole>>,
52    >,
53    #[serde(
54        rename = "tenant",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
60    #[serde(
61        rename = "platform",
62        default,
63        with = "::serde_with::rust::double_option",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub platform: Option<Option<Box<crate::models::DeviceTypeRequestDefaultPlatform>>>,
67    #[serde(
68        rename = "primary_ip4",
69        default,
70        with = "::serde_with::rust::double_option",
71        skip_serializing_if = "Option::is_none"
72    )]
73    pub primary_ip4: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
74    #[serde(
75        rename = "primary_ip6",
76        default,
77        with = "::serde_with::rust::double_option",
78        skip_serializing_if = "Option::is_none"
79    )]
80    pub primary_ip6: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
81    #[serde(
82        rename = "vcpus",
83        default,
84        with = "::serde_with::rust::double_option",
85        skip_serializing_if = "Option::is_none"
86    )]
87    pub vcpus: Option<Option<f64>>,
88    #[serde(
89        rename = "memory",
90        default,
91        with = "::serde_with::rust::double_option",
92        skip_serializing_if = "Option::is_none"
93    )]
94    pub memory: Option<Option<i32>>,
95    #[serde(
96        rename = "disk",
97        default,
98        with = "::serde_with::rust::double_option",
99        skip_serializing_if = "Option::is_none"
100    )]
101    pub disk: Option<Option<i32>>,
102    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
103    pub description: Option<String>,
104    #[serde(
105        rename = "owner",
106        default,
107        with = "::serde_with::rust::double_option",
108        skip_serializing_if = "Option::is_none"
109    )]
110    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
111    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
112    pub comments: Option<String>,
113    #[serde(
114        rename = "config_template",
115        default,
116        with = "::serde_with::rust::double_option",
117        skip_serializing_if = "Option::is_none"
118    )]
119    pub config_template: Option<Option<Box<crate::models::DeviceRoleRequestConfigTemplate>>>,
120    /// Local config context data takes precedence over source contexts in the final rendered config context
121    #[serde(
122        rename = "local_context_data",
123        default,
124        with = "::serde_with::rust::double_option",
125        skip_serializing_if = "Option::is_none"
126    )]
127    pub local_context_data: Option<Option<serde_json::Value>>,
128    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
129    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
130    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
131    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
132}
133
134impl VirtualizationVirtualMachinesCreateRequest {
135    pub fn new(name: String) -> VirtualizationVirtualMachinesCreateRequest {
136        VirtualizationVirtualMachinesCreateRequest {
137            name,
138            status: None,
139            start_on_boot: None,
140            site: None,
141            cluster: None,
142            device: None,
143            serial: None,
144            role: None,
145            tenant: None,
146            platform: None,
147            primary_ip4: None,
148            primary_ip6: None,
149            vcpus: None,
150            memory: None,
151            disk: None,
152            description: None,
153            owner: None,
154            comments: None,
155            config_template: None,
156            local_context_data: None,
157            tags: None,
158            custom_fields: None,
159        }
160    }
161}
162
163/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `decommissioning` - Decommissioning * `paused` - Paused
164#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
165pub enum Status {
166    #[serde(rename = "offline")]
167    Offline,
168    #[serde(rename = "active")]
169    Active,
170    #[serde(rename = "planned")]
171    Planned,
172    #[serde(rename = "staged")]
173    Staged,
174    #[serde(rename = "failed")]
175    Failed,
176    #[serde(rename = "decommissioning")]
177    Decommissioning,
178    #[serde(rename = "paused")]
179    Paused,
180}
181
182impl Default for Status {
183    fn default() -> Status {
184        Self::Offline
185    }
186}
187/// * `on` - On * `off` - Off * `laststate` - Last State
188#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
189pub enum StartOnBoot {
190    #[serde(rename = "on")]
191    On,
192    #[serde(rename = "off")]
193    Off,
194    #[serde(rename = "laststate")]
195    Laststate,
196}
197
198impl Default for StartOnBoot {
199    fn default() -> StartOnBoot {
200        Self::On
201    }
202}