Skip to main content

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