Skip to main content

doppler_rs/models/
create_service_token_request.rs

1/*
2 * Core
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0.0-oas3.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11/*
12 * Core
13 *
14 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
15 *
16 * The version of the OpenAPI document: 1.0.0-oas3.1
17 * 
18 * Generated by: https://openapi-generator.tech
19 */
20
21use crate::models;
22use serde::{Deserialize, Serialize};
23use chrono::{DateTime, NaiveDate, Utc};
24/// CreateServiceTokenRequest
25#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
26pub struct CreateServiceTokenRequest {
27    /// Unique identifier for the project object.
28    #[serde(rename = "project")]
29    pub project: String ,
30    /// Name of the config object.
31    #[serde(rename = "config")]
32    pub config: String ,
33    /// Name of the service token.
34    #[serde(rename = "name")]
35    pub name: String ,
36    /// Unix timestamp of when token should expire.
37    #[serde(rename = "expire_at", skip_serializing_if = "Option::is_none")]
38    pub expire_at: Option<chrono::DateTime<chrono::Utc> >,
39    /// Token's capabilities.
40    /// Token's capabilities.
41    /// Token's capabilities.
42    #[serde(rename = "access", skip_serializing_if = "Option::is_none")]
43    pub access: Option<String >,
44}
45
46impl CreateServiceTokenRequest {
47    pub fn new(project: String , config: String , name: String ) -> CreateServiceTokenRequest {
48        CreateServiceTokenRequest {
49            project: project,
50            config: config,
51            name: name,
52            expire_at: None,
53            access: Some("Read".to_string()),
54        }
55    }
56}
57/// Token's capabilities.
58#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
59pub enum Access {
60    #[serde(rename = "read")]
61    /// Token's capabilities.
62    Read,
63    #[serde(rename = "read/write")]
64    /// Token's capabilities.
65    ReadSlashWrite,
66}
67
68impl Default for Access {
69    fn default() -> Access {
70        Self::Read
71    }
72}
73