Skip to main content

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