1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.894.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 NewToken {
#[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 = "scopes", skip_serializing_if = "Option::is_none")]
pub scopes: Option<Vec<String>>,
/// Bind the token to this workspace: it is then refused on every other workspace and on instance-level endpoints. Omit for a token that reaches every workspace.
#[serde(rename = "workspace_id", skip_serializing_if = "Option::is_none")]
pub workspace_id: Option<String>,
/// 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.
#[serde(rename = "read_only", skip_serializing_if = "Option::is_none")]
pub read_only: Option<bool>,
/// Carry the owner's superadmin rights: admin in every workspace, including ones they are not a member of, and the superadmin endpoints. Defaults to false, and is ignored when the owner or the calling token does not hold them.
#[serde(rename = "super_admin", skip_serializing_if = "Option::is_none")]
pub super_admin: Option<bool>,
/// Carry the owner's workspace admin rights in the workspaces the token reaches. Defaults to false: the token then acts as a regular member. Ignored when the calling token does not hold them.
#[serde(rename = "admin", skip_serializing_if = "Option::is_none")]
pub admin: Option<bool>,
/// 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.
#[serde(rename = "allowed_ips", skip_serializing_if = "Option::is_none")]
pub allowed_ips: Option<Vec<String>>,
}
impl NewToken {
pub fn new() -> NewToken {
NewToken {
label: None,
expiration: None,
scopes: None,
workspace_id: None,
read_only: None,
super_admin: None,
admin: None,
allowed_ips: None,
}
}
}