Skip to main content

fastly_api/models/
automation_token_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 AutomationTokenResponse {
13    /// The name of the token.
14    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
15    pub name: Option<String>,
16    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
17    pub role: Option<String>,
18    /// All roles assigned to the token. Each role includes an `id` and `name`.
19    #[serde(rename = "roles", skip_serializing_if = "Option::is_none")]
20    pub roles: Option<Vec<crate::models::AutomationTokenRole>>,
21    /// 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.
22    #[serde(rename = "services", skip_serializing_if = "Option::is_none")]
23    pub services: Option<Vec<String>>,
24    /// When `true`, the token is restricted to only the services in the `services` array. When `false`, the token has access to all services.
25    #[serde(rename = "limit_services", skip_serializing_if = "Option::is_none")]
26    pub limit_services: Option<bool>,
27    /// 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.
28    #[serde(rename = "limit_workspaces", skip_serializing_if = "Option::is_none")]
29    pub limit_workspaces: Option<bool>,
30    /// The workspace IDs of the workspaces the token has access to. Returns an empty array for tokens without workspace access.
31    #[serde(rename = "workspaces", skip_serializing_if = "Option::is_none")]
32    pub workspaces: Option<Vec<String>>,
33    /// A space-delimited list of authorization scope.
34    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
35    pub scope: Option<Scope>,
36    /// (optional) A UTC timestamp of when the token will expire.
37    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
38    pub expires_at: Option<String>,
39    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
40    pub id: Option<Box<crate::models::ReadOnlyId>>,
41    #[serde(rename = "customer_id", skip_serializing_if = "Option::is_none")]
42    pub customer_id: Option<Box<crate::models::ReadOnlyCustomerId>>,
43    /// The IP address of the client that last used the token.
44    #[serde(rename = "ip", skip_serializing_if = "Option::is_none")]
45    pub ip: Option<String>,
46    /// The User-Agent header of the client that last used the token.
47    #[serde(rename = "user_agent", skip_serializing_if = "Option::is_none")]
48    pub user_agent: Option<String>,
49    /// Indicates whether TLS access is enabled for the token.
50    #[serde(rename = "tls_access", skip_serializing_if = "Option::is_none")]
51    pub tls_access: Option<bool>,
52    /// A UTC timestamp of when the token was last used.
53    #[serde(rename = "last_used_at", skip_serializing_if = "Option::is_none")]
54    pub last_used_at: Option<String>,
55    /// A UTC timestamp of when the token was created.
56    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
57    pub created_at: Option<String>,
58}
59
60impl AutomationTokenResponse {
61    pub fn new() -> AutomationTokenResponse {
62        AutomationTokenResponse {
63            name: None,
64            role: None,
65            roles: None,
66            services: None,
67            limit_services: None,
68            limit_workspaces: None,
69            workspaces: None,
70            scope: None,
71            expires_at: None,
72            id: None,
73            customer_id: None,
74            ip: None,
75            user_agent: None,
76            tls_access: None,
77            last_used_at: None,
78            created_at: None,
79        }
80    }
81}
82
83/// A space-delimited list of authorization scope.
84#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
85pub enum Scope {
86    #[serde(rename = "global")]
87    Global,
88    #[serde(rename = "purge_select")]
89    PurgeSelect,
90    #[serde(rename = "purge_all")]
91    PurgeAll,
92    #[serde(rename = "global:read")]
93    Globalread,
94}
95
96impl Default for Scope {
97    fn default() -> Scope {
98        Self::Global
99    }
100}
101