Skip to main content

netbox_openapi/models/
bulk_user_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/// BulkUserRequest : 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 BulkUserRequest {
15    #[serde(rename = "id")]
16    pub id: i32,
17    /// Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
18    #[serde(rename = "username")]
19    pub username: String,
20    #[serde(rename = "password")]
21    pub password: String,
22    #[serde(rename = "first_name", skip_serializing_if = "Option::is_none")]
23    pub first_name: Option<String>,
24    #[serde(rename = "last_name", skip_serializing_if = "Option::is_none")]
25    pub last_name: Option<String>,
26    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
27    pub email: Option<Box<crate::models::EmailAddress>>,
28    /// Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
29    #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
30    pub is_active: Option<bool>,
31    #[serde(rename = "date_joined", skip_serializing_if = "Option::is_none")]
32    pub date_joined: Option<String>,
33    #[serde(
34        rename = "last_login",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub last_login: Option<Option<String>>,
40    #[serde(rename = "groups", skip_serializing_if = "Option::is_none")]
41    pub groups: Option<Vec<i32>>,
42    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
43    pub permissions: Option<Vec<i32>>,
44}
45
46impl BulkUserRequest {
47    /// 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>)
48    pub fn new(id: i32, username: String, password: String) -> BulkUserRequest {
49        BulkUserRequest {
50            id,
51            username,
52            password,
53            first_name: None,
54            last_name: None,
55            email: None,
56            is_active: None,
57            date_joined: None,
58            last_login: None,
59            groups: None,
60            permissions: None,
61        }
62    }
63}