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.5.9-Docker-4.0.2 (4.5)
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    /// Choices are automatically ordered alphabetically
28    #[serde(
29        rename = "order_alphabetically",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub order_alphabetically: Option<bool>,
33    #[serde(
34        rename = "owner",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
40}
41
42impl ExtrasCustomFieldChoiceSetsCreateRequest {
43    pub fn new(
44        name: String,
45        extra_choices: Vec<Vec<serde_json::Value>>,
46    ) -> ExtrasCustomFieldChoiceSetsCreateRequest {
47        ExtrasCustomFieldChoiceSetsCreateRequest {
48            name,
49            description: None,
50            base_choices: None,
51            extra_choices,
52            order_alphabetically: None,
53            owner: None,
54        }
55    }
56}
57
58/// Base set of predefined choices (optional)  * `IATA` - IATA (Airport codes) * `ISO_3166` - ISO 3166 (Country codes) * `UN_LOCODE` - UN/LOCODE (Location codes)
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum BaseChoices {
61    #[serde(rename = "IATA")]
62    Iata,
63    #[serde(rename = "ISO_3166")]
64    Iso3166,
65    #[serde(rename = "UN_LOCODE")]
66    UnLocode,
67    #[serde(rename = "")]
68    Empty,
69    #[serde(rename = "null")]
70    Null,
71}
72
73impl Default for BaseChoices {
74    fn default() -> BaseChoices {
75        Self::Iata
76    }
77}