netbox_openapi/models/
writable_prefix_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/// WritablePrefixRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritablePrefixRequest {
15    #[serde(rename = "prefix")]
16    pub prefix: String,
17    #[serde(
18        rename = "vrf",
19        default,
20        with = "::serde_with::rust::double_option",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub vrf: Option<Option<Box<crate::models::IpAddressRequestVrf>>>,
24    #[serde(
25        rename = "scope_type",
26        default,
27        with = "::serde_with::rust::double_option",
28        skip_serializing_if = "Option::is_none"
29    )]
30    pub scope_type: Option<Option<String>>,
31    #[serde(
32        rename = "scope_id",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub scope_id: Option<Option<i32>>,
38    #[serde(
39        rename = "tenant",
40        default,
41        with = "::serde_with::rust::double_option",
42        skip_serializing_if = "Option::is_none"
43    )]
44    pub tenant: Option<Option<Box<crate::models::AsnRangeRequestTenant>>>,
45    #[serde(
46        rename = "vlan",
47        default,
48        with = "::serde_with::rust::double_option",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub vlan: Option<Option<Box<crate::models::InterfaceRequestUntaggedVlan>>>,
52    /// Operational status of this prefix  * `container` - Container * `active` - Active * `reserved` - Reserved * `deprecated` - Deprecated
53    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
54    pub status: Option<Status>,
55    #[serde(
56        rename = "role",
57        default,
58        with = "::serde_with::rust::double_option",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub role: Option<Option<Box<crate::models::IpRangeRequestRole>>>,
62    /// All IP addresses within this prefix are considered usable
63    #[serde(rename = "is_pool", skip_serializing_if = "Option::is_none")]
64    pub is_pool: Option<bool>,
65    /// Treat as fully utilized
66    #[serde(rename = "mark_utilized", skip_serializing_if = "Option::is_none")]
67    pub mark_utilized: Option<bool>,
68    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
69    pub description: Option<String>,
70    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
71    pub comments: Option<String>,
72    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
73    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
74    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
75    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
76}
77
78impl WritablePrefixRequest {
79    /// Adds support for custom fields and tags.
80    pub fn new(prefix: String) -> WritablePrefixRequest {
81        WritablePrefixRequest {
82            prefix,
83            vrf: None,
84            scope_type: None,
85            scope_id: None,
86            tenant: None,
87            vlan: None,
88            status: None,
89            role: None,
90            is_pool: None,
91            mark_utilized: None,
92            description: None,
93            comments: None,
94            tags: None,
95            custom_fields: None,
96        }
97    }
98}
99
100/// Operational status of this prefix  * `container` - Container * `active` - Active * `reserved` - Reserved * `deprecated` - Deprecated
101#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
102pub enum Status {
103    #[serde(rename = "container")]
104    Container,
105    #[serde(rename = "active")]
106    Active,
107    #[serde(rename = "reserved")]
108    Reserved,
109    #[serde(rename = "deprecated")]
110    Deprecated,
111}
112
113impl Default for Status {
114    fn default() -> Status {
115        Self::Container
116    }
117}