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 role on the token.
17    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
18    pub role: Option<Role>,
19    /// (Optional) The service IDs of the services the token will have access to. Separate service IDs with a space. If no services are specified, the token will have access to all services on the account. 
20    #[serde(rename = "services", skip_serializing_if = "Option::is_none")]
21    pub services: Option<Vec<String>>,
22    /// A space-delimited list of authorization scope.
23    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
24    pub scope: Option<Scope>,
25    /// A UTC timestamp of when the token expires.
26    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
27    pub expires_at: Option<String>,
28    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
29    pub id: Option<Box<crate::models::ReadOnlyId>>,
30    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
31    pub user_id: Option<Box<crate::models::ReadOnlyUserId>>,
32    #[serde(rename = "customer_id", skip_serializing_if = "Option::is_none")]
33    pub customer_id: Option<Box<crate::models::ReadOnlyCustomerId>>,
34    /// A UTC timestamp of when the token was created. 
35    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
36    pub created_at: Option<String>,
37    #[serde(rename = "access_token", skip_serializing_if = "Option::is_none")]
38    pub access_token: Option<String>,
39    /// Indicates whether TLS access is enabled for the token.
40    #[serde(rename = "tls_access", skip_serializing_if = "Option::is_none")]
41    pub tls_access: Option<bool>,
42    /// A UTC timestamp of when the token was last used.
43    #[serde(rename = "last_used_at", skip_serializing_if = "Option::is_none")]
44    pub last_used_at: Option<String>,
45    /// The User-Agent header of the client that last used the token.
46    #[serde(rename = "user_agent", skip_serializing_if = "Option::is_none")]
47    pub user_agent: Option<String>,
48}
49
50impl AutomationTokenCreateResponse {
51    pub fn new() -> AutomationTokenCreateResponse {
52        AutomationTokenCreateResponse {
53            name: None,
54            role: None,
55            services: None,
56            scope: None,
57            expires_at: None,
58            id: None,
59            user_id: None,
60            customer_id: None,
61            created_at: None,
62            access_token: None,
63            tls_access: None,
64            last_used_at: None,
65            user_agent: None,
66        }
67    }
68}
69
70/// The role on the token.
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum Role {
73    #[serde(rename = "billing")]
74    Billing,
75    #[serde(rename = "engineer")]
76    Engineer,
77    #[serde(rename = "user")]
78    User,
79}
80
81impl Default for Role {
82    fn default() -> Role {
83        Self::Billing
84    }
85}
86/// A space-delimited list of authorization scope.
87#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
88pub enum Scope {
89    #[serde(rename = "global")]
90    Global,
91    #[serde(rename = "purge_select")]
92    PurgeSelect,
93    #[serde(rename = "purge_all")]
94    PurgeAll,
95    #[serde(rename = "global:read")]
96    Globalread,
97}
98
99impl Default for Scope {
100    fn default() -> Scope {
101        Self::Global
102    }
103}
104