Skip to main content

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