Skip to main content

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