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.6.8 (4.6)
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    #[serde(
16        rename = "virtual_machine_type",
17        default,
18        with = "::serde_with::rust::double_option",
19        skip_serializing_if = "Option::is_none"
20    )]
21    pub virtual_machine_type: Option<
22        Option<Box<crate::models::BulkVirtualMachineWithConfigContextRequestVirtualMachineType>>,
23    >,
24    #[serde(
25        rename = "role",
26        default,
27        with = "::serde_with::rust::double_option",
28        skip_serializing_if = "Option::is_none"
29    )]
30    pub role: Option<Option<Box<crate::models::BulkVirtualMachineWithConfigContextRequestRole>>>,
31    /// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `decommissioning` - Decommissioning * `paused` - Paused
32    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
33    pub status: Option<Status>,
34    /// * `on` - On * `off` - Off * `laststate` - Last State
35    #[serde(rename = "start_on_boot", skip_serializing_if = "Option::is_none")]
36    pub start_on_boot: Option<StartOnBoot>,
37    #[serde(
38        rename = "site",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub site: Option<Option<Box<crate::models::BulkVlanRequestSite>>>,
44    #[serde(
45        rename = "cluster",
46        default,
47        with = "::serde_with::rust::double_option",
48        skip_serializing_if = "Option::is_none"
49    )]
50    pub cluster: Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestCluster>>>,
51    #[serde(
52        rename = "device",
53        default,
54        with = "::serde_with::rust::double_option",
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub device: Option<Option<Box<crate::models::BulkDeviceBayRequestInstalledDevice>>>,
58    #[serde(
59        rename = "platform",
60        default,
61        with = "::serde_with::rust::double_option",
62        skip_serializing_if = "Option::is_none"
63    )]
64    pub platform: Option<Option<Box<crate::models::BulkDeviceTypeRequestDefaultPlatform>>>,
65    #[serde(
66        rename = "primary_ip4",
67        default,
68        with = "::serde_with::rust::double_option",
69        skip_serializing_if = "Option::is_none"
70    )]
71    pub primary_ip4:
72        Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestPrimaryIp4>>>,
73    #[serde(
74        rename = "primary_ip6",
75        default,
76        with = "::serde_with::rust::double_option",
77        skip_serializing_if = "Option::is_none"
78    )]
79    pub primary_ip6:
80        Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestPrimaryIp4>>>,
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(rename = "serial", skip_serializing_if = "Option::is_none")]
105    pub serial: Option<String>,
106    #[serde(
107        rename = "tenant",
108        default,
109        with = "::serde_with::rust::double_option",
110        skip_serializing_if = "Option::is_none"
111    )]
112    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
113    #[serde(
114        rename = "owner",
115        default,
116        with = "::serde_with::rust::double_option",
117        skip_serializing_if = "Option::is_none"
118    )]
119    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
120    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
121    pub comments: Option<String>,
122    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
123    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
124    /// Local config context data takes precedence over source contexts in the final rendered config context
125    #[serde(
126        rename = "local_context_data",
127        default,
128        with = "::serde_with::rust::double_option",
129        skip_serializing_if = "Option::is_none"
130    )]
131    pub local_context_data: Option<Option<serde_json::Value>>,
132    #[serde(
133        rename = "config_template",
134        default,
135        with = "::serde_with::rust::double_option",
136        skip_serializing_if = "Option::is_none"
137    )]
138    pub config_template: Option<Option<Box<crate::models::BulkDeviceRoleRequestConfigTemplate>>>,
139    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
140    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
141}
142
143impl VirtualizationVirtualMachinesCreateRequest {
144    pub fn new(name: String) -> VirtualizationVirtualMachinesCreateRequest {
145        VirtualizationVirtualMachinesCreateRequest {
146            name,
147            virtual_machine_type: None,
148            role: None,
149            status: None,
150            start_on_boot: None,
151            site: None,
152            cluster: None,
153            device: None,
154            platform: None,
155            primary_ip4: None,
156            primary_ip6: None,
157            vcpus: None,
158            memory: None,
159            disk: None,
160            description: None,
161            serial: None,
162            tenant: None,
163            owner: None,
164            comments: None,
165            tags: None,
166            local_context_data: None,
167            config_template: None,
168            custom_fields: None,
169        }
170    }
171}
172
173/// * `offline` - Offline * `active` - Active * `planned` - Planned * `staged` - Staged * `failed` - Failed * `decommissioning` - Decommissioning * `paused` - Paused
174#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
175pub enum Status {
176    #[serde(rename = "offline")]
177    Offline,
178    #[serde(rename = "active")]
179    Active,
180    #[serde(rename = "planned")]
181    Planned,
182    #[serde(rename = "staged")]
183    Staged,
184    #[serde(rename = "failed")]
185    Failed,
186    #[serde(rename = "decommissioning")]
187    Decommissioning,
188    #[serde(rename = "paused")]
189    Paused,
190}
191
192impl Default for Status {
193    fn default() -> Status {
194        Self::Offline
195    }
196}
197/// * `on` - On * `off` - Off * `laststate` - Last State
198#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
199pub enum StartOnBoot {
200    #[serde(rename = "on")]
201    On,
202    #[serde(rename = "off")]
203    Off,
204    #[serde(rename = "laststate")]
205    Laststate,
206}
207
208impl Default for StartOnBoot {
209    fn default() -> StartOnBoot {
210        Self::On
211    }
212}