Skip to main content

nautobot_openapi/models/
bulk_writable_token_request.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/// BulkWritableTokenRequest : 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 BulkWritableTokenRequest {
15    #[serde(rename = "id")]
16    pub id: uuid::Uuid,
17    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
18    pub key: Option<String>,
19    #[serde(
20        rename = "expires",
21        default,
22        with = "::serde_with::rust::double_option",
23        skip_serializing_if = "Option::is_none"
24    )]
25    pub expires: Option<Option<String>>,
26    /// Permit create/update/delete operations using this key
27    #[serde(rename = "write_enabled", skip_serializing_if = "Option::is_none")]
28    pub write_enabled: Option<bool>,
29    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
30    pub description: Option<String>,
31}
32
33impl BulkWritableTokenRequest {
34    /// 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>)
35    pub fn new(id: uuid::Uuid) -> BulkWritableTokenRequest {
36        BulkWritableTokenRequest {
37            id,
38            key: None,
39            expires: None,
40            write_enabled: None,
41            description: None,
42        }
43    }
44}