Skip to main content

nautobot_openapi/models/
prefix.rs

1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Prefix : Base class to use for serializers based on OrganizationalModel or PrimaryModel.  Can also be used for models derived from BaseModel, so long as they support custom fields, notes, and relationships.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct Prefix {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18    pub object_type: Option<String>,
19    /// Human friendly display value
20    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
21    pub display: Option<String>,
22    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
23    pub url: Option<String>,
24    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
25    pub natural_slug: Option<String>,
26    #[serde(rename = "prefix")]
27    pub prefix: String,
28    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
29    pub r#type: Option<Box<crate::models::PrefixType>>,
30    /// IPv4 or IPv6 network address
31    #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
32    pub network: Option<String>,
33    /// IPv4 or IPv6 broadcast address
34    #[serde(rename = "broadcast", skip_serializing_if = "Option::is_none")]
35    pub broadcast: Option<String>,
36    /// Length of the Network prefix, in bits.
37    #[serde(rename = "prefix_length", skip_serializing_if = "Option::is_none")]
38    pub prefix_length: Option<i32>,
39    #[serde(rename = "ip_version", skip_serializing_if = "Option::is_none")]
40    pub ip_version: Option<i32>,
41    /// Date this prefix was allocated to an RIR, reserved in IPAM, etc.
42    #[serde(
43        rename = "date_allocated",
44        default,
45        with = "::serde_with::rust::double_option",
46        skip_serializing_if = "Option::is_none"
47    )]
48    pub date_allocated: Option<Option<String>>,
49    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
50    pub description: Option<String>,
51    #[serde(rename = "status")]
52    pub status: Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>,
53    #[serde(
54        rename = "role",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub role: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
60    #[serde(
61        rename = "parent",
62        default,
63        with = "::serde_with::rust::double_option",
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub parent: Option<Option<Box<crate::models::BulkWritablePrefixRequestParent>>>,
67    #[serde(rename = "namespace", skip_serializing_if = "Option::is_none")]
68    pub namespace: Option<Box<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>>,
69    #[serde(
70        rename = "tenant",
71        default,
72        with = "::serde_with::rust::double_option",
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub tenant: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
76    #[serde(
77        rename = "vlan",
78        default,
79        with = "::serde_with::rust::double_option",
80        skip_serializing_if = "Option::is_none"
81    )]
82    pub vlan: Option<Option<Box<crate::models::ApprovalWorkflowUser>>>,
83    #[serde(
84        rename = "rir",
85        default,
86        with = "::serde_with::rust::double_option",
87        skip_serializing_if = "Option::is_none"
88    )]
89    pub rir: Option<Option<Box<crate::models::BulkWritablePrefixRequestRir>>>,
90    #[serde(
91        rename = "created",
92        default,
93        with = "::serde_with::rust::double_option",
94        skip_serializing_if = "Option::is_none"
95    )]
96    pub created: Option<Option<String>>,
97    #[serde(
98        rename = "last_updated",
99        default,
100        with = "::serde_with::rust::double_option",
101        skip_serializing_if = "Option::is_none"
102    )]
103    pub last_updated: Option<Option<String>>,
104    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
105    pub tags: Option<Vec<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>>,
106    #[serde(rename = "notes_url", skip_serializing_if = "Option::is_none")]
107    pub notes_url: Option<String>,
108    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
109    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
110}
111
112impl Prefix {
113    /// Base class to use for serializers based on OrganizationalModel or PrimaryModel.  Can also be used for models derived from BaseModel, so long as they support custom fields, notes, and relationships.
114    pub fn new(
115        prefix: String,
116        status: crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage,
117    ) -> Prefix {
118        Prefix {
119            id: None,
120            object_type: None,
121            display: None,
122            url: None,
123            natural_slug: None,
124            prefix,
125            r#type: None,
126            network: None,
127            broadcast: None,
128            prefix_length: None,
129            ip_version: None,
130            date_allocated: None,
131            description: None,
132            status: Box::new(status),
133            role: None,
134            parent: None,
135            namespace: None,
136            tenant: None,
137            vlan: None,
138            rir: None,
139            created: None,
140            last_updated: None,
141            tags: None,
142            notes_url: None,
143            custom_fields: None,
144        }
145    }
146}