Skip to main content

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