Skip to main content

netbox_openapi/models/
patched_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/// PatchedBulkCustomFieldRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct PatchedBulkCustomFieldRequest {
15    #[serde(rename = "id")]
16    pub id: i32,
17    #[serde(rename = "object_types", skip_serializing_if = "Option::is_none")]
18    pub object_types: Option<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", skip_serializing_if = "Option::is_none")]
21    pub r#type: Option<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", skip_serializing_if = "Option::is_none")]
31    pub name: Option<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 PatchedBulkCustomFieldRequest {
126    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
127    pub fn new(id: i32) -> PatchedBulkCustomFieldRequest {
128        PatchedBulkCustomFieldRequest {
129            id,
130            object_types: None,
131            r#type: None,
132            related_object_type: None,
133            name: None,
134            label: None,
135            group_name: None,
136            description: None,
137            required: None,
138            unique: None,
139            search_weight: None,
140            filter_logic: None,
141            ui_visible: None,
142            ui_editable: None,
143            is_cloneable: None,
144            default: None,
145            related_object_filter: None,
146            weight: None,
147            validation_minimum: None,
148            validation_maximum: None,
149            validation_regex: None,
150            validation_schema: None,
151            choice_set: None,
152            owner: None,
153            comments: None,
154        }
155    }
156}
157
158/// * `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
159#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
160pub enum RHashType {
161    #[serde(rename = "text")]
162    Text,
163    #[serde(rename = "longtext")]
164    Longtext,
165    #[serde(rename = "integer")]
166    Integer,
167    #[serde(rename = "decimal")]
168    Decimal,
169    #[serde(rename = "boolean")]
170    Boolean,
171    #[serde(rename = "date")]
172    Date,
173    #[serde(rename = "datetime")]
174    Datetime,
175    #[serde(rename = "url")]
176    Url,
177    #[serde(rename = "json")]
178    Json,
179    #[serde(rename = "select")]
180    Select,
181    #[serde(rename = "multiselect")]
182    Multiselect,
183    #[serde(rename = "object")]
184    Object,
185    #[serde(rename = "multiobject")]
186    Multiobject,
187}
188
189impl Default for RHashType {
190    fn default() -> RHashType {
191        Self::Text
192    }
193}
194/// * `disabled` - Disabled * `loose` - Loose * `exact` - Exact
195#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
196pub enum FilterLogic {
197    #[serde(rename = "disabled")]
198    Disabled,
199    #[serde(rename = "loose")]
200    Loose,
201    #[serde(rename = "exact")]
202    Exact,
203}
204
205impl Default for FilterLogic {
206    fn default() -> FilterLogic {
207        Self::Disabled
208    }
209}
210/// * `always` - Always * `if-set` - If set * `hidden` - Hidden
211#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
212pub enum UiVisible {
213    #[serde(rename = "always")]
214    Always,
215    #[serde(rename = "if-set")]
216    IfSet,
217    #[serde(rename = "hidden")]
218    Hidden,
219}
220
221impl Default for UiVisible {
222    fn default() -> UiVisible {
223        Self::Always
224    }
225}
226/// * `yes` - Yes * `no` - No * `hidden` - Hidden
227#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
228pub enum UiEditable {
229    #[serde(rename = "yes")]
230    Yes,
231    #[serde(rename = "no")]
232    No,
233    #[serde(rename = "hidden")]
234    Hidden,
235}
236
237impl Default for UiEditable {
238    fn default() -> UiEditable {
239        Self::Yes
240    }
241}