Skip to main content

netbox_openapi/models/
ipam_services_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 IpamServicesCreateRequest {
13    #[serde(rename = "parent_object_type")]
14    pub parent_object_type: String,
15    #[serde(rename = "parent_object_id")]
16    pub parent_object_id: i64,
17    #[serde(rename = "name")]
18    pub name: String,
19    /// * `tcp` - TCP * `udp` - UDP * `sctp` - SCTP
20    #[serde(rename = "protocol")]
21    pub protocol: Protocol,
22    #[serde(rename = "ports")]
23    pub ports: Vec<i32>,
24    #[serde(rename = "ipaddresses", skip_serializing_if = "Option::is_none")]
25    pub ipaddresses: Option<Vec<i32>>,
26    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
27    pub description: Option<String>,
28    #[serde(
29        rename = "owner",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
35    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
36    pub comments: Option<String>,
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 IpamServicesCreateRequest {
44    pub fn new(
45        parent_object_type: String,
46        parent_object_id: i64,
47        name: String,
48        protocol: Protocol,
49        ports: Vec<i32>,
50    ) -> IpamServicesCreateRequest {
51        IpamServicesCreateRequest {
52            parent_object_type,
53            parent_object_id,
54            name,
55            protocol,
56            ports,
57            ipaddresses: None,
58            description: None,
59            owner: None,
60            comments: None,
61            tags: None,
62            custom_fields: None,
63        }
64    }
65}
66
67/// * `tcp` - TCP * `udp` - UDP * `sctp` - SCTP
68#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
69pub enum Protocol {
70    #[serde(rename = "tcp")]
71    Tcp,
72    #[serde(rename = "udp")]
73    Udp,
74    #[serde(rename = "sctp")]
75    Sctp,
76}
77
78impl Default for Protocol {
79    fn default() -> Protocol {
80        Self::Tcp
81    }
82}