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.4.2-Docker-3.4.1 (4.4)
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 #[serde(
16 rename = "expires",
17 default,
18 with = "::serde_with::rust::double_option",
19 skip_serializing_if = "Option::is_none"
20 )]
21 pub expires: Option<Option<String>>,
22 /// Permit create/update/delete operations using this key
23 #[serde(rename = "write_enabled", skip_serializing_if = "Option::is_none")]
24 pub write_enabled: Option<bool>,
25 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
26 pub description: Option<String>,
27 #[serde(rename = "username")]
28 pub username: String,
29 #[serde(rename = "password")]
30 pub password: String,
31}
32
33impl TokenProvisionRequest {
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(username: String, password: String) -> TokenProvisionRequest {
36 TokenProvisionRequest {
37 expires: None,
38 write_enabled: None,
39 description: None,
40 username,
41 password,
42 }
43 }
44}