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.4.2-Docker-3.4.1 (4.4)
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::PatchedWritableTunnelTerminationRequestTunnel>,
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: Option<Option<Box<crate::models::DeviceWithConfigContextRequestPrimaryIp4>>>,
36    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
37    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
38    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
39    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
40}
41
42impl TunnelTerminationRequest {
43    /// Adds support for custom fields and tags.
44    pub fn new(
45        tunnel: crate::models::PatchedWritableTunnelTerminationRequestTunnel,
46        role: Role,
47        termination_type: String,
48    ) -> TunnelTerminationRequest {
49        TunnelTerminationRequest {
50            tunnel: Box::new(tunnel),
51            role,
52            termination_type,
53            termination_id: None,
54            outside_ip: None,
55            tags: None,
56            custom_fields: None,
57        }
58    }
59}
60
61/// * `peer` - Peer * `hub` - Hub * `spoke` - Spoke
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
63pub enum Role {
64    #[serde(rename = "peer")]
65    Peer,
66    #[serde(rename = "hub")]
67    Hub,
68    #[serde(rename = "spoke")]
69    Spoke,
70}
71
72impl Default for Role {
73    fn default() -> Role {
74        Self::Peer
75    }
76}