Skip to main content

netbox_openapi/models/
dcim_locations_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.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct DcimLocationsCreateRequest {
13    #[serde(rename = "name")]
14    pub name: String,
15    #[serde(rename = "slug")]
16    pub slug: String,
17    #[serde(rename = "site")]
18    pub site: Box<crate::models::DeviceWithConfigContextRequestSite>,
19    #[serde(
20        rename = "parent",
21        default,
22        with = "::serde_with::rust::double_option",
23        skip_serializing_if = "Option::is_none"
24    )]
25    pub parent: Option<Option<i32>>,
26    /// * `planned` - Planned * `staging` - Staging * `active` - Active * `decommissioning` - Decommissioning * `retired` - Retired
27    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
28    pub status: Option<Status>,
29    #[serde(
30        rename = "tenant",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
36    /// Local facility ID or description
37    #[serde(rename = "facility", skip_serializing_if = "Option::is_none")]
38    pub facility: Option<String>,
39    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
40    pub description: Option<String>,
41    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
42    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
43    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
44    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
45    #[serde(
46        rename = "owner",
47        default,
48        with = "::serde_with::rust::double_option",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
52    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
53    pub comments: Option<String>,
54}
55
56impl DcimLocationsCreateRequest {
57    pub fn new(
58        name: String,
59        slug: String,
60        site: crate::models::DeviceWithConfigContextRequestSite,
61    ) -> DcimLocationsCreateRequest {
62        DcimLocationsCreateRequest {
63            name,
64            slug,
65            site: Box::new(site),
66            parent: None,
67            status: None,
68            tenant: None,
69            facility: None,
70            description: None,
71            tags: None,
72            custom_fields: None,
73            owner: None,
74            comments: None,
75        }
76    }
77}
78
79/// * `planned` - Planned * `staging` - Staging * `active` - Active * `decommissioning` - Decommissioning * `retired` - Retired
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum Status {
82    #[serde(rename = "planned")]
83    Planned,
84    #[serde(rename = "staging")]
85    Staging,
86    #[serde(rename = "active")]
87    Active,
88    #[serde(rename = "decommissioning")]
89    Decommissioning,
90    #[serde(rename = "retired")]
91    Retired,
92}
93
94impl Default for Status {
95    fn default() -> Status {
96        Self::Planned
97    }
98}