Skip to main content

netbox_openapi/models/
bulk_table_config_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/// BulkTableConfigRequest : Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct BulkTableConfigRequest {
15    #[serde(rename = "id")]
16    pub id: i32,
17    #[serde(rename = "object_type")]
18    pub object_type: String,
19    #[serde(rename = "table")]
20    pub table: String,
21    #[serde(rename = "name")]
22    pub name: String,
23    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
24    pub description: Option<String>,
25    #[serde(
26        rename = "user",
27        default,
28        with = "::serde_with::rust::double_option",
29        skip_serializing_if = "Option::is_none"
30    )]
31    pub user: Option<Option<i32>>,
32    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
33    pub weight: Option<i32>,
34    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
35    pub enabled: Option<bool>,
36    #[serde(rename = "shared", skip_serializing_if = "Option::is_none")]
37    pub shared: Option<bool>,
38    #[serde(rename = "columns")]
39    pub columns: Vec<String>,
40    #[serde(
41        rename = "ordering",
42        default,
43        with = "::serde_with::rust::double_option",
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub ordering: Option<Option<Vec<String>>>,
47}
48
49impl BulkTableConfigRequest {
50    /// Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during validation. (DRF does not do this by default; see <https://github.com/encode/django-rest-framework/issues/3144>)
51    pub fn new(
52        id: i32,
53        object_type: String,
54        table: String,
55        name: String,
56        columns: Vec<String>,
57    ) -> BulkTableConfigRequest {
58        BulkTableConfigRequest {
59            id,
60            object_type,
61            table,
62            name,
63            description: None,
64            user: None,
65            weight: None,
66            enabled: None,
67            shared: None,
68            columns,
69            ordering: None,
70        }
71    }
72}