netbox_openapi/models/
writable_service_template_request.rs1#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableServiceTemplateRequest {
15 #[serde(rename = "name")]
16 pub name: String,
17 #[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(rename = "comments", skip_serializing_if = "Option::is_none")]
25 pub comments: Option<String>,
26 #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
27 pub tags: Option<Vec<crate::models::NestedTagRequest>>,
28 #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
29 pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
30}
31
32impl WritableServiceTemplateRequest {
33 pub fn new(
35 name: String,
36 protocol: Protocol,
37 ports: Vec<i32>,
38 ) -> WritableServiceTemplateRequest {
39 WritableServiceTemplateRequest {
40 name,
41 protocol,
42 ports,
43 description: None,
44 comments: None,
45 tags: None,
46 custom_fields: None,
47 }
48 }
49}
50
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
53pub enum Protocol {
54 #[serde(rename = "tcp")]
55 Tcp,
56 #[serde(rename = "udp")]
57 Udp,
58 #[serde(rename = "sctp")]
59 Sctp,
60}
61
62impl Default for Protocol {
63 fn default() -> Protocol {
64 Self::Tcp
65 }
66}