netbox-openapi 0.6.0

low level netbox bindings (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * NetBox REST API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 4.6.2 (4.6)
 *
 * Generated by: https://openapi-generator.tech
 */

/// ServiceRequest : Base serializer class for models inheriting from PrimaryModel.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ServiceRequest {
    #[serde(rename = "parent_object_type")]
    pub parent_object_type: String,
    #[serde(rename = "parent_object_id")]
    pub parent_object_id: i64,
    #[serde(rename = "name")]
    pub name: String,
    /// * `tcp` - TCP * `udp` - UDP * `sctp` - SCTP
    #[serde(rename = "protocol", skip_serializing_if = "Option::is_none")]
    pub protocol: Option<Protocol>,
    #[serde(rename = "ports")]
    pub ports: Vec<i32>,
    #[serde(rename = "ipaddresses", skip_serializing_if = "Option::is_none")]
    pub ipaddresses: Option<Vec<i32>>,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(
        rename = "owner",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
    pub comments: Option<String>,
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
}

impl ServiceRequest {
    /// Base serializer class for models inheriting from PrimaryModel.
    pub fn new(
        parent_object_type: String,
        parent_object_id: i64,
        name: String,
        ports: Vec<i32>,
    ) -> ServiceRequest {
        ServiceRequest {
            parent_object_type,
            parent_object_id,
            name,
            protocol: None,
            ports,
            ipaddresses: None,
            description: None,
            owner: None,
            comments: None,
            tags: None,
            custom_fields: None,
        }
    }
}

/// * `tcp` - TCP * `udp` - UDP * `sctp` - SCTP
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Protocol {
    #[serde(rename = "tcp")]
    Tcp,
    #[serde(rename = "udp")]
    Udp,
    #[serde(rename = "sctp")]
    Sctp,
}

impl Default for Protocol {
    fn default() -> Protocol {
        Self::Tcp
    }
}