Skip to main content

netbox_openapi/models/
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/// ServiceRequest : Base serializer class for models inheriting from PrimaryModel.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct ServiceRequest {
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", skip_serializing_if = "Option::is_none")]
23    pub protocol: Option<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 ServiceRequest {
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        ports: Vec<i32>,
52    ) -> ServiceRequest {
53        ServiceRequest {
54            parent_object_type,
55            parent_object_id,
56            name,
57            protocol: None,
58            ports,
59            ipaddresses: None,
60            description: None,
61            owner: None,
62            comments: None,
63            tags: None,
64            custom_fields: None,
65        }
66    }
67}
68
69/// * `tcp` - TCP * `udp` - UDP * `sctp` - SCTP
70#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
71pub enum Protocol {
72    #[serde(rename = "tcp")]
73    Tcp,
74    #[serde(rename = "udp")]
75    Udp,
76    #[serde(rename = "sctp")]
77    Sctp,
78}
79
80impl Default for Protocol {
81    fn default() -> Protocol {
82        Self::Tcp
83    }
84}