netbox_openapi/models/
writable_service_request.rs1#[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 #[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(rename = "comments", skip_serializing_if = "Option::is_none")]
31 pub comments: Option<String>,
32 #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
33 pub tags: Option<Vec<crate::models::NestedTagRequest>>,
34 #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
35 pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
36}
37
38impl WritableServiceRequest {
39 pub fn new(
41 parent_object_type: String,
42 parent_object_id: i64,
43 name: String,
44 protocol: Protocol,
45 ports: Vec<i32>,
46 ) -> WritableServiceRequest {
47 WritableServiceRequest {
48 parent_object_type,
49 parent_object_id,
50 name,
51 protocol,
52 ports,
53 ipaddresses: None,
54 description: None,
55 comments: None,
56 tags: None,
57 custom_fields: None,
58 }
59 }
60}
61
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum Protocol {
65 #[serde(rename = "tcp")]
66 Tcp,
67 #[serde(rename = "udp")]
68 Udp,
69 #[serde(rename = "sctp")]
70 Sctp,
71}
72
73impl Default for Protocol {
74 fn default() -> Protocol {
75 Self::Tcp
76 }
77}