netbox_openapi/models/
contact_assignment_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.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// ContactAssignmentRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct ContactAssignmentRequest {
15    #[serde(rename = "object_type")]
16    pub object_type: String,
17    #[serde(rename = "object_id")]
18    pub object_id: i64,
19    #[serde(rename = "contact")]
20    pub contact: Box<crate::models::ContactAssignmentRequestContact>,
21    #[serde(
22        rename = "role",
23        default,
24        with = "::serde_with::rust::double_option",
25        skip_serializing_if = "Option::is_none"
26    )]
27    pub role: Option<Option<Box<crate::models::ContactAssignmentRequestRole>>>,
28    /// * `primary` - Primary * `secondary` - Secondary * `tertiary` - Tertiary * `inactive` - Inactive
29    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
30    pub priority: Option<Priority>,
31    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
32    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
33    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
34    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
35}
36
37impl ContactAssignmentRequest {
38    /// Adds support for custom fields and tags.
39    pub fn new(
40        object_type: String,
41        object_id: i64,
42        contact: crate::models::ContactAssignmentRequestContact,
43    ) -> ContactAssignmentRequest {
44        ContactAssignmentRequest {
45            object_type,
46            object_id,
47            contact: Box::new(contact),
48            role: None,
49            priority: None,
50            tags: None,
51            custom_fields: None,
52        }
53    }
54}
55
56/// * `primary` - Primary * `secondary` - Secondary * `tertiary` - Tertiary * `inactive` - Inactive
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Priority {
59    #[serde(rename = "primary")]
60    Primary,
61    #[serde(rename = "secondary")]
62    Secondary,
63    #[serde(rename = "tertiary")]
64    Tertiary,
65    #[serde(rename = "inactive")]
66    Inactive,
67    #[serde(rename = "")]
68    Empty,
69}
70
71impl Default for Priority {
72    fn default() -> Priority {
73        Self::Primary
74    }
75}