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.889.1
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 /// 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.
23 #[serde(rename = "workspace_id", skip_serializing_if = "Option::is_none")]
24 pub workspace_id: Option<String>,
25 /// 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.
26 #[serde(rename = "read_only", skip_serializing_if = "Option::is_none")]
27 pub read_only: Option<bool>,
28 /// 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.
29 #[serde(rename = "super_admin", skip_serializing_if = "Option::is_none")]
30 pub super_admin: Option<bool>,
31 /// 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.
32 #[serde(rename = "admin", skip_serializing_if = "Option::is_none")]
33 pub admin: Option<bool>,
34 /// 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.
35 #[serde(rename = "allowed_ips", skip_serializing_if = "Option::is_none")]
36 pub allowed_ips: Option<Vec<String>>,
37}
38
39impl NewToken {
40 pub fn new() -> NewToken {
41 NewToken {
42 label: None,
43 expiration: None,
44 scopes: None,
45 workspace_id: None,
46 read_only: None,
47 super_admin: None,
48 admin: None,
49 allowed_ips: None,
50 }
51 }
52}
53