Skip to main content

windmill_api/models/
new_token.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.886.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct NewToken {
16    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
17    pub label: Option<String>,
18    #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")]
19    pub expiration: Option<String>,
20    #[serde(rename = "scopes", skip_serializing_if = "Option::is_none")]
21    pub scopes: Option<Vec<String>>,
22    #[serde(rename = "workspace_id", skip_serializing_if = "Option::is_none")]
23    pub workspace_id: Option<String>,
24    /// If true, the token is restricted to read-only HTTP methods (GET/HEAD/OPTIONS). Mutating endpoints and job-run actions are rejected with 403, regardless of the scopes attached. 
25    #[serde(rename = "read_only", skip_serializing_if = "Option::is_none")]
26    pub read_only: Option<bool>,
27    /// For an MCP token (an `mcp:` scope) owned by a superadmin: carry the owner's superadmin rights, reaching every workspace rather than only their memberships. Ignored for other tokens, which always carry them. 
28    #[serde(rename = "super_admin", skip_serializing_if = "Option::is_none")]
29    pub super_admin: Option<bool>,
30    /// IPs or CIDRs (IPv4 or IPv6) the token may be used from; omit to allow any. A request from elsewhere is refused as unauthenticated. A token that is itself restricted can only create tokens within its own networks, and creates one restricted to them when this is omitted. 
31    #[serde(rename = "allowed_ips", skip_serializing_if = "Option::is_none")]
32    pub allowed_ips: Option<Vec<String>>,
33}
34
35impl NewToken {
36    pub fn new() -> NewToken {
37        NewToken {
38            label: None,
39            expiration: None,
40            scopes: None,
41            workspace_id: None,
42            read_only: None,
43            super_admin: None,
44            allowed_ips: None,
45        }
46    }
47}
48