Skip to main content

netbox_openapi/models/
bulk_custom_field_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.8 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// BulkCustomFieldRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct BulkCustomFieldRequest {
15    #[serde(rename = "id")]
16    pub id: i32,
17    #[serde(rename = "object_types")]
18    pub object_types: Vec<String>,
19    /// * `text` - Text * `longtext` - Text (long) * `integer` - Integer * `decimal` - Decimal * `boolean` - Boolean (true/false) * `date` - Date * `datetime` - Date & time * `url` - URL * `json` - JSON * `select` - Selection * `multiselect` - Multiple selection * `object` - Object * `multiobject` - Multiple objects
20    #[serde(rename = "type")]
21    pub r#type: RHashType,
22    #[serde(
23        rename = "related_object_type",
24        default,
25        with = "::serde_with::rust::double_option",
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub related_object_type: Option<Option<String>>,
29    /// Internal field name
30    #[serde(rename = "name")]
31    pub name: String,
32    /// Name of the field as displayed to users (if not provided, 'the field's name will be used)
33    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
34    pub label: Option<String>,
35    /// Custom fields within the same group will be displayed together
36    #[serde(rename = "group_name", skip_serializing_if = "Option::is_none")]
37    pub group_name: Option<String>,
38    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
39    pub description: Option<String>,
40    /// This field is required when creating new objects or editing an existing object.
41    #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
42    pub required: Option<bool>,
43    /// The value of this field must be unique for the assigned object
44    #[serde(rename = "unique", skip_serializing_if = "Option::is_none")]
45    pub unique: Option<bool>,
46    /// Weighting for search. Lower values are considered more important. Fields with a search weight of zero will be ignored.
47    #[serde(rename = "search_weight", skip_serializing_if = "Option::is_none")]
48    pub search_weight: Option<i32>,
49    /// * `disabled` - Disabled * `loose` - Loose * `exact` - Exact
50    #[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
51    pub filter_logic: Option<FilterLogic>,
52    /// * `always` - Always * `if-set` - If set * `hidden` - Hidden
53    #[serde(rename = "ui_visible", skip_serializing_if = "Option::is_none")]
54    pub ui_visible: Option<UiVisible>,
55    /// * `yes` - Yes * `no` - No * `hidden` - Hidden
56    #[serde(rename = "ui_editable", skip_serializing_if = "Option::is_none")]
57    pub ui_editable: Option<UiEditable>,
58    /// Replicate this value when cloning objects
59    #[serde(rename = "is_cloneable", skip_serializing_if = "Option::is_none")]
60    pub is_cloneable: Option<bool>,
61    /// Default value for the field (must be a JSON value). Encapsulate strings with double quotes (e.g. \"Foo\").
62    #[serde(
63        rename = "default",
64        default,
65        with = "::serde_with::rust::double_option",
66        skip_serializing_if = "Option::is_none"
67    )]
68    pub default: Option<Option<serde_json::Value>>,
69    /// Filter the object selection choices using a query_params dict (must be a JSON value).Encapsulate strings with double quotes (e.g. \"Foo\").
70    #[serde(
71        rename = "related_object_filter",
72        default,
73        with = "::serde_with::rust::double_option",
74        skip_serializing_if = "Option::is_none"
75    )]
76    pub related_object_filter: Option<Option<serde_json::Value>>,
77    /// Fields with higher weights appear lower in a form.
78    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
79    pub weight: Option<i32>,
80    /// Minimum allowed value (for numeric fields)
81    #[serde(
82        rename = "validation_minimum",
83        default,
84        with = "::serde_with::rust::double_option",
85        skip_serializing_if = "Option::is_none"
86    )]
87    pub validation_minimum: Option<Option<f64>>,
88    /// Maximum allowed value (for numeric fields)
89    #[serde(
90        rename = "validation_maximum",
91        default,
92        with = "::serde_with::rust::double_option",
93        skip_serializing_if = "Option::is_none"
94    )]
95    pub validation_maximum: Option<Option<f64>>,
96    /// Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. For example, <code>^[A-Z]{3}$</code> will limit values to exactly three uppercase letters.
97    #[serde(rename = "validation_regex", skip_serializing_if = "Option::is_none")]
98    pub validation_regex: Option<String>,
99    /// A JSON schema definition for validating the custom field value
100    #[serde(
101        rename = "validation_schema",
102        default,
103        with = "::serde_with::rust::double_option",
104        skip_serializing_if = "Option::is_none"
105    )]
106    pub validation_schema: Option<Option<serde_json::Value>>,
107    #[serde(
108        rename = "choice_set",
109        default,
110        with = "::serde_with::rust::double_option",
111        skip_serializing_if = "Option::is_none"
112    )]
113    pub choice_set: Option<Option<Box<crate::models::BulkCustomFieldRequestChoiceSet>>>,
114    #[serde(
115        rename = "owner",
116        default,
117        with = "::serde_with::rust::double_option",
118        skip_serializing_if = "Option::is_none"
119    )]
120    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
121    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
122    pub comments: Option<String>,
123}
124
125impl BulkCustomFieldRequest {
126    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
127    pub fn new(
128        id: i32,
129        object_types: Vec<String>,
130        r#type: RHashType,
131        name: String,
132    ) -> BulkCustomFieldRequest {
133        BulkCustomFieldRequest {
134            id,
135            object_types,
136            r#type,
137            related_object_type: None,
138            name,
139            label: None,
140            group_name: None,
141            description: None,
142            required: None,
143            unique: None,
144            search_weight: None,
145            filter_logic: None,
146            ui_visible: None,
147            ui_editable: None,
148            is_cloneable: None,
149            default: None,
150            related_object_filter: None,
151            weight: None,
152            validation_minimum: None,
153            validation_maximum: None,
154            validation_regex: None,
155            validation_schema: None,
156            choice_set: None,
157            owner: None,
158            comments: None,
159        }
160    }
161}
162
163/// * `text` - Text * `longtext` - Text (long) * `integer` - Integer * `decimal` - Decimal * `boolean` - Boolean (true/false) * `date` - Date * `datetime` - Date & time * `url` - URL * `json` - JSON * `select` - Selection * `multiselect` - Multiple selection * `object` - Object * `multiobject` - Multiple objects
164#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
165pub enum RHashType {
166    #[serde(rename = "text")]
167    Text,
168    #[serde(rename = "longtext")]
169    Longtext,
170    #[serde(rename = "integer")]
171    Integer,
172    #[serde(rename = "decimal")]
173    Decimal,
174    #[serde(rename = "boolean")]
175    Boolean,
176    #[serde(rename = "date")]
177    Date,
178    #[serde(rename = "datetime")]
179    Datetime,
180    #[serde(rename = "url")]
181    Url,
182    #[serde(rename = "json")]
183    Json,
184    #[serde(rename = "select")]
185    Select,
186    #[serde(rename = "multiselect")]
187    Multiselect,
188    #[serde(rename = "object")]
189    Object,
190    #[serde(rename = "multiobject")]
191    Multiobject,
192}
193
194impl Default for RHashType {
195    fn default() -> RHashType {
196        Self::Text
197    }
198}
199/// * `disabled` - Disabled * `loose` - Loose * `exact` - Exact
200#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
201pub enum FilterLogic {
202    #[serde(rename = "disabled")]
203    Disabled,
204    #[serde(rename = "loose")]
205    Loose,
206    #[serde(rename = "exact")]
207    Exact,
208}
209
210impl Default for FilterLogic {
211    fn default() -> FilterLogic {
212        Self::Disabled
213    }
214}
215/// * `always` - Always * `if-set` - If set * `hidden` - Hidden
216#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
217pub enum UiVisible {
218    #[serde(rename = "always")]
219    Always,
220    #[serde(rename = "if-set")]
221    IfSet,
222    #[serde(rename = "hidden")]
223    Hidden,
224}
225
226impl Default for UiVisible {
227    fn default() -> UiVisible {
228        Self::Always
229    }
230}
231/// * `yes` - Yes * `no` - No * `hidden` - Hidden
232#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
233pub enum UiEditable {
234    #[serde(rename = "yes")]
235    Yes,
236    #[serde(rename = "no")]
237    No,
238    #[serde(rename = "hidden")]
239    Hidden,
240}
241
242impl Default for UiEditable {
243    fn default() -> UiEditable {
244        Self::Yes
245    }
246}