windmill-api 1.889.1

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * Windmill API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.889.1
 * Contact: contact@windmill.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TruncatedToken {
    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")]
    pub expiration: Option<String>,
    #[serde(rename = "token_prefix")]
    pub token_prefix: String,
    #[serde(rename = "created_at")]
    pub created_at: String,
    #[serde(rename = "last_used_at")]
    pub last_used_at: String,
    #[serde(rename = "scopes", skip_serializing_if = "Option::is_none")]
    pub scopes: Option<Vec<String>>,
    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    #[serde(rename = "workspace_id", skip_serializing_if = "Option::is_none")]
    pub workspace_id: Option<String>,
    #[serde(rename = "read_only")]
    pub read_only: bool,
    /// IPs or CIDRs the token may be used from; absent when it may be used from anywhere.
    #[serde(rename = "allowed_ips", skip_serializing_if = "Option::is_none")]
    pub allowed_ips: Option<Vec<String>>,
    /// The token carries workspace admin rights: it was minted with them and its owner is an admin of the workspace it is bound to (any workspace when unbound). Set by /users/tokens/list. 
    #[serde(rename = "admin", skip_serializing_if = "Option::is_none")]
    pub admin: Option<bool>,
    /// The token carries superadmin rights: it was minted with them (a session always is) and its owner is a superadmin. Set by /users/tokens/list. 
    #[serde(rename = "super_admin", skip_serializing_if = "Option::is_none")]
    pub super_admin: Option<bool>,
    /// what a token review flags on this token; empty for a token the server manages on its own
    #[serde(rename = "risks")]
    pub risks: Vec<models::TokenRisk>,
}

impl TruncatedToken {
    pub fn new(token_prefix: String, created_at: String, last_used_at: String, read_only: bool, risks: Vec<models::TokenRisk>) -> TruncatedToken {
        TruncatedToken {
            label: None,
            expiration: None,
            token_prefix,
            created_at,
            last_used_at,
            scopes: None,
            email: None,
            workspace_id: None,
            read_only,
            allowed_ips: None,
            admin: None,
            super_admin: None,
            risks,
        }
    }
}