Skip to main content

netbox_openapi/models/
patched_token_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/// PatchedTokenRequest : 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 PatchedTokenRequest {
15    /// * `1` - v1 * `2` - v2
16    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
17    pub version: Option<i32>,
18    #[serde(rename = "user", skip_serializing_if = "Option::is_none")]
19    pub user: Option<Box<crate::models::BookmarkRequestUser>>,
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
21    pub description: Option<String>,
22    #[serde(
23        rename = "expires",
24        default,
25        with = "::serde_with::rust::double_option",
26        skip_serializing_if = "Option::is_none"
27    )]
28    pub expires: Option<Option<String>>,
29    #[serde(
30        rename = "last_used",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub last_used: Option<Option<String>>,
36    /// Disable to temporarily revoke this token without deleting it.
37    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
38    pub enabled: Option<bool>,
39    /// Permit create/update/delete operations using this token
40    #[serde(rename = "write_enabled", skip_serializing_if = "Option::is_none")]
41    pub write_enabled: Option<bool>,
42    /// ID of the cryptographic pepper used to hash the token (v2 only)
43    #[serde(
44        rename = "pepper_id",
45        default,
46        with = "::serde_with::rust::double_option",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub pepper_id: Option<Option<i32>>,
50    #[serde(rename = "token", skip_serializing_if = "Option::is_none")]
51    pub token: Option<String>,
52}
53
54impl PatchedTokenRequest {
55    /// 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>)
56    pub fn new() -> PatchedTokenRequest {
57        PatchedTokenRequest {
58            version: None,
59            user: None,
60            description: None,
61            expires: None,
62            last_used: None,
63            enabled: None,
64            write_enabled: None,
65            pepper_id: None,
66            token: None,
67        }
68    }
69}