Skip to main content

fastly_api/models/
automation_token_create_response.rs

1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console,  including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) 
5 *
6 */
7
8
9
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct AutomationTokenCreateResponse {
13    /// The name of the token.
14    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
15    pub name: Option<String>,
16    /// The primary role on the token. For tokens with multiple roles, this returns the highest-priority role for backwards compatibility.
17    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
18    pub role: Option<Role>,
19    /// All roles assigned to the token. Each role includes an `id` and `name`.
20    #[serde(rename = "roles", skip_serializing_if = "Option::is_none")]
21    pub roles: Option<Vec<crate::models::AutomationTokenRole>>,
22    /// The service IDs of the services the token has access to. Empty when `limit_services` is `false` (full access) or when the token has no service access.
23    #[serde(rename = "services", skip_serializing_if = "Option::is_none")]
24    pub services: Option<Vec<String>>,
25    /// When `true`, the token is restricted to only the services in the `services` array. When `false`, the token has access to all services.
26    #[serde(rename = "limit_services", skip_serializing_if = "Option::is_none")]
27    pub limit_services: Option<bool>,
28    /// When `true`, the token is restricted to only the workspaces in the `workspaces` array. When `false`, the token has access to all workspaces. Only applies to roles that support workspace access.
29    #[serde(rename = "limit_workspaces", skip_serializing_if = "Option::is_none")]
30    pub limit_workspaces: Option<bool>,
31    /// The workspace IDs of the workspaces the token has access to. Returns an empty array for tokens without workspace access.
32    #[serde(rename = "workspaces", skip_serializing_if = "Option::is_none")]
33    pub workspaces: Option<Vec<String>>,
34    /// A space-delimited list of authorization scope.
35    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
36    pub scope: Option<Scope>,
37    /// A UTC timestamp of when the token expires.
38    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
39    pub expires_at: Option<String>,
40    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
41    pub id: Option<Box<crate::models::ReadOnlyId>>,
42    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
43    pub user_id: Option<Box<crate::models::ReadOnlyUserId>>,
44    #[serde(rename = "customer_id", skip_serializing_if = "Option::is_none")]
45    pub customer_id: Option<Box<crate::models::ReadOnlyCustomerId>>,
46    /// A UTC timestamp of when the token was created. 
47    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
48    pub created_at: Option<String>,
49    #[serde(rename = "access_token", skip_serializing_if = "Option::is_none")]
50    pub access_token: Option<String>,
51    /// Indicates whether TLS access is enabled for the token.
52    #[serde(rename = "tls_access", skip_serializing_if = "Option::is_none")]
53    pub tls_access: Option<bool>,
54    /// A UTC timestamp of when the token was last used.
55    #[serde(rename = "last_used_at", skip_serializing_if = "Option::is_none")]
56    pub last_used_at: Option<String>,
57    /// The User-Agent header of the client that last used the token.
58    #[serde(rename = "user_agent", skip_serializing_if = "Option::is_none")]
59    pub user_agent: Option<String>,
60}
61
62impl AutomationTokenCreateResponse {
63    pub fn new() -> AutomationTokenCreateResponse {
64        AutomationTokenCreateResponse {
65            name: None,
66            role: None,
67            roles: None,
68            services: None,
69            limit_services: None,
70            limit_workspaces: None,
71            workspaces: None,
72            scope: None,
73            expires_at: None,
74            id: None,
75            user_id: None,
76            customer_id: None,
77            created_at: None,
78            access_token: None,
79            tls_access: None,
80            last_used_at: None,
81            user_agent: None,
82        }
83    }
84}
85
86/// The primary role on the token. For tokens with multiple roles, this returns the highest-priority role for backwards compatibility.
87#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
88pub enum Role {
89    #[serde(rename = "billing")]
90    Billing,
91    #[serde(rename = "engineer")]
92    Engineer,
93    #[serde(rename = "user")]
94    User,
95    #[serde(rename = "ngwaf_user_imported")]
96    NgwafUserImported,
97    #[serde(rename = "ngwaf_admin_imported")]
98    NgwafAdminImported,
99    #[serde(rename = "ngwaf_owner_imported")]
100    NgwafOwnerImported,
101    #[serde(rename = "ngwaf_observer_imported")]
102    NgwafObserverImported,
103    #[serde(rename = "tls_admin")]
104    TlsAdmin,
105    #[serde(rename = "tls_viewer")]
106    TlsViewer,
107}
108
109impl Default for Role {
110    fn default() -> Role {
111        Self::Billing
112    }
113}
114/// A space-delimited list of authorization scope.
115#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
116pub enum Scope {
117    #[serde(rename = "global")]
118    Global,
119    #[serde(rename = "purge_select")]
120    PurgeSelect,
121    #[serde(rename = "purge_all")]
122    PurgeAll,
123    #[serde(rename = "global:read")]
124    Globalread,
125}
126
127impl Default for Scope {
128    fn default() -> Scope {
129        Self::Global
130    }
131}
132