Skip to main content

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