Skip to main content

netbox_openapi/models/
token_provision_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.2 (4.6)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// TokenProvisionRequest : 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 TokenProvisionRequest {
15    /// * `1` - v1 * `2` - v2
16    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
17    pub version: Option<i32>,
18    #[serde(
19        rename = "expires",
20        default,
21        with = "::serde_with::rust::double_option",
22        skip_serializing_if = "Option::is_none"
23    )]
24    pub expires: Option<Option<String>>,
25    /// Disable to temporarily revoke this token without deleting it.
26    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
27    pub enabled: Option<bool>,
28    /// Permit create/update/delete operations using this token
29    #[serde(rename = "write_enabled", skip_serializing_if = "Option::is_none")]
30    pub write_enabled: Option<bool>,
31    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
32    pub description: Option<String>,
33    #[serde(rename = "username")]
34    pub username: String,
35    #[serde(rename = "password")]
36    pub password: String,
37    #[serde(rename = "token", skip_serializing_if = "Option::is_none")]
38    pub token: Option<String>,
39}
40
41impl TokenProvisionRequest {
42    /// 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>)
43    pub fn new(username: String, password: String) -> TokenProvisionRequest {
44        TokenProvisionRequest {
45            version: None,
46            expires: None,
47            enabled: None,
48            write_enabled: None,
49            description: None,
50            username,
51            password,
52            token: None,
53        }
54    }
55}