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