Skip to main content

netbox_openapi/models/
writable_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/// WritableCustomFieldChoiceSetRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableCustomFieldChoiceSetRequest {
15    #[serde(rename = "name")]
16    pub name: String,
17    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
18    pub description: Option<String>,
19    /// Base set of predefined choices (optional)  * `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    /// 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 WritableCustomFieldChoiceSetRequest {
45    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
46    pub fn new(
47        name: String,
48        extra_choices: Vec<Vec<serde_json::Value>>,
49    ) -> WritableCustomFieldChoiceSetRequest {
50        WritableCustomFieldChoiceSetRequest {
51            name,
52            description: None,
53            base_choices: None,
54            extra_choices,
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}