Skip to main content

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