Skip to main content

netbox_openapi/models/
custom_field_choice_set_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.6.8 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// CustomFieldChoiceSetRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct CustomFieldChoiceSetRequest {
15    #[serde(rename = "name")]
16    pub name: String,
17    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
18    pub description: Option<String>,
19    /// * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
20    #[serde(
21        rename = "base_choices",
22        default,
23        with = "::serde_with::rust::double_option",
24        skip_serializing_if = "Option::is_none"
25    )]
26    pub base_choices: Option<Option<BaseChoices>>,
27    #[serde(rename = "extra_choices")]
28    pub extra_choices: Vec<Vec<serde_json::Value>>,
29    #[serde(rename = "choice_colors", skip_serializing_if = "Option::is_none")]
30    pub choice_colors: Option<ChoiceColors>,
31    /// Choices are automatically ordered alphabetically
32    #[serde(
33        rename = "order_alphabetically",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub order_alphabetically: Option<bool>,
37    #[serde(
38        rename = "owner",
39        default,
40        with = "::serde_with::rust::double_option",
41        skip_serializing_if = "Option::is_none"
42    )]
43    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
44}
45
46impl CustomFieldChoiceSetRequest {
47    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
48    pub fn new(
49        name: String,
50        extra_choices: Vec<Vec<serde_json::Value>>,
51    ) -> CustomFieldChoiceSetRequest {
52        CustomFieldChoiceSetRequest {
53            name,
54            description: None,
55            base_choices: None,
56            extra_choices,
57            choice_colors: None,
58            order_alphabetically: None,
59            owner: None,
60        }
61    }
62}
63
64/// * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum BaseChoices {
67    #[serde(rename = "IATA")]
68    Iata,
69    #[serde(rename = "ISO_3166")]
70    Iso3166,
71    #[serde(rename = "UN_LOCODE")]
72    UnLocode,
73    #[serde(rename = "null")]
74    Null,
75}
76
77impl Default for BaseChoices {
78    fn default() -> BaseChoices {
79        Self::Iata
80    }
81}
82///
83#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
84pub enum ChoiceColors {
85    #[serde(rename = "blue")]
86    Blue,
87    #[serde(rename = "indigo")]
88    Indigo,
89    #[serde(rename = "purple")]
90    Purple,
91    #[serde(rename = "pink")]
92    Pink,
93    #[serde(rename = "red")]
94    Red,
95    #[serde(rename = "orange")]
96    Orange,
97    #[serde(rename = "yellow")]
98    Yellow,
99    #[serde(rename = "green")]
100    Green,
101    #[serde(rename = "teal")]
102    Teal,
103    #[serde(rename = "cyan")]
104    Cyan,
105    #[serde(rename = "gray")]
106    Gray,
107    #[serde(rename = "black")]
108    Black,
109    #[serde(rename = "white")]
110    White,
111}
112
113impl Default for ChoiceColors {
114    fn default() -> ChoiceColors {
115        Self::Blue
116    }
117}