Skip to main content

netbox_openapi/models/
bulk_owner_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/// BulkOwnerRequest : 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 BulkOwnerRequest {
15    #[serde(rename = "id")]
16    pub id: i32,
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "group", deserialize_with = "Option::deserialize")]
20    pub group: Option<Box<crate::models::BulkOwnerRequestGroup>>,
21    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
22    pub description: Option<String>,
23    #[serde(rename = "user_groups", skip_serializing_if = "Option::is_none")]
24    pub user_groups: Option<Vec<i32>>,
25    #[serde(rename = "users", skip_serializing_if = "Option::is_none")]
26    pub users: Option<Vec<i32>>,
27}
28
29impl BulkOwnerRequest {
30    /// 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>)
31    pub fn new(
32        id: i32,
33        name: String,
34        group: Option<crate::models::BulkOwnerRequestGroup>,
35    ) -> BulkOwnerRequest {
36        BulkOwnerRequest {
37            id,
38            name,
39            group: if let Some(x) = group {
40                Some(Box::new(x))
41            } else {
42                None
43            },
44            description: None,
45            user_groups: None,
46            users: None,
47        }
48    }
49}