Skip to main content

netbox_openapi/models/
tunnel_termination_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/// TunnelTerminationRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct TunnelTerminationRequest {
15    #[serde(rename = "tunnel")]
16    pub tunnel: Box<crate::models::BulkTunnelTerminationRequestTunnel>,
17    /// * `peer` - Peer * `hub` - Hub * `spoke` - Spoke
18    #[serde(rename = "role")]
19    pub role: Role,
20    #[serde(rename = "termination_type")]
21    pub termination_type: String,
22    #[serde(
23        rename = "termination_id",
24        default,
25        with = "::serde_with::rust::double_option",
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub termination_id: Option<Option<i64>>,
29    #[serde(
30        rename = "outside_ip",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub outside_ip:
36        Option<Option<Box<crate::models::BulkDeviceWithConfigContextRequestPrimaryIp4>>>,
37    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
38    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
39    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
40    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
41}
42
43impl TunnelTerminationRequest {
44    /// Adds support for custom fields and tags.
45    pub fn new(
46        tunnel: crate::models::BulkTunnelTerminationRequestTunnel,
47        role: Role,
48        termination_type: String,
49    ) -> TunnelTerminationRequest {
50        TunnelTerminationRequest {
51            tunnel: Box::new(tunnel),
52            role,
53            termination_type,
54            termination_id: None,
55            outside_ip: None,
56            tags: None,
57            custom_fields: None,
58        }
59    }
60}
61
62/// * `peer` - Peer * `hub` - Hub * `spoke` - Spoke
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum Role {
65    #[serde(rename = "peer")]
66    Peer,
67    #[serde(rename = "hub")]
68    Hub,
69    #[serde(rename = "spoke")]
70    Spoke,
71}
72
73impl Default for Role {
74    fn default() -> Role {
75        Self::Peer
76    }
77}