netbox_openapi/models/
writable_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/// WritableContactAssignmentRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableContactAssignmentRequest {
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(
30        rename = "priority",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub priority: Option<Option<Priority>>,
36    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
37    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
38    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
39    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
40}
41
42impl WritableContactAssignmentRequest {
43    /// Adds support for custom fields and tags.
44    pub fn new(
45        object_type: String,
46        object_id: i64,
47        contact: crate::models::ContactAssignmentRequestContact,
48    ) -> WritableContactAssignmentRequest {
49        WritableContactAssignmentRequest {
50            object_type,
51            object_id,
52            contact: Box::new(contact),
53            role: None,
54            priority: None,
55            tags: None,
56            custom_fields: None,
57        }
58    }
59}
60
61/// * `primary` - Primary * `secondary` - Secondary * `tertiary` - Tertiary * `inactive` - Inactive
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
63pub enum Priority {
64    #[serde(rename = "primary")]
65    Primary,
66    #[serde(rename = "secondary")]
67    Secondary,
68    #[serde(rename = "tertiary")]
69    Tertiary,
70    #[serde(rename = "inactive")]
71    Inactive,
72    #[serde(rename = "")]
73    Empty,
74    #[serde(rename = "null")]
75    Null,
76}
77
78impl Default for Priority {
79    fn default() -> Priority {
80        Self::Primary
81    }
82}