Skip to main content

nautobot_openapi/models/
user.rs

1/*
2 * API Documentation
3 *
4 * Source of truth and network automation platform
5 *
6 * The version of the OpenAPI document: 3.1.0 (3.1)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// User : 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 User {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<uuid::Uuid>,
17    #[serde(rename = "object_type", skip_serializing_if = "Option::is_none")]
18    pub object_type: Option<String>,
19    /// Human friendly display value
20    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
21    pub display: Option<String>,
22    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
23    pub url: Option<String>,
24    #[serde(rename = "natural_slug", skip_serializing_if = "Option::is_none")]
25    pub natural_slug: Option<String>,
26    #[serde(
27        rename = "last_login",
28        default,
29        with = "::serde_with::rust::double_option",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub last_login: Option<Option<String>>,
33    /// Designates that this user has all permissions without explicitly assigning them.
34    #[serde(rename = "is_superuser", skip_serializing_if = "Option::is_none")]
35    pub is_superuser: Option<bool>,
36    /// Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
37    #[serde(rename = "username")]
38    pub username: String,
39    #[serde(rename = "first_name", skip_serializing_if = "Option::is_none")]
40    pub first_name: Option<String>,
41    #[serde(rename = "last_name", skip_serializing_if = "Option::is_none")]
42    pub last_name: Option<String>,
43    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
44    pub email: Option<String>,
45    /// Designates whether the user can log into this admin site.
46    #[serde(rename = "is_staff", skip_serializing_if = "Option::is_none")]
47    pub is_staff: Option<bool>,
48    /// Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
49    #[serde(rename = "is_active", skip_serializing_if = "Option::is_none")]
50    pub is_active: Option<bool>,
51    #[serde(rename = "date_joined", skip_serializing_if = "Option::is_none")]
52    pub date_joined: Option<String>,
53    #[serde(
54        rename = "config_data",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub config_data: Option<Option<serde_json::Value>>,
60}
61
62impl User {
63    /// 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>)
64    pub fn new(username: String) -> User {
65        User {
66            id: None,
67            object_type: None,
68            display: None,
69            url: None,
70            natural_slug: None,
71            last_login: None,
72            is_superuser: None,
73            username,
74            first_name: None,
75            last_name: None,
76            email: None,
77            is_staff: None,
78            is_active: None,
79            date_joined: None,
80            config_data: None,
81        }
82    }
83}