fastly_api/models/
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 TokenResponse {
13    /// List of alphanumeric strings identifying services (optional). If no services are specified, the token will have access to all services on the account. 
14    #[serde(rename = "services", skip_serializing_if = "Option::is_none")]
15    pub services: Option<Vec<String>>,
16    /// Name of the token.
17    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
18    pub name: Option<String>,
19    /// Space-delimited list of authorization scope.
20    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
21    pub scope: Option<Scope>,
22    /// Time-stamp (UTC) of when the token was created.
23    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
24    pub created_at: Option<String>,
25    /// Date and time in ISO 8601 format.
26    #[serde(rename = "deleted_at", skip_serializing_if = "Option::is_none")]
27    pub deleted_at: Option<String>,
28    /// Date and time in ISO 8601 format.
29    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
30    pub updated_at: Option<String>,
31    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
32    pub id: Option<Box<String>>,
33    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
34    pub user_id: Option<Box<String>>,
35    /// Time-stamp (UTC) of when the token was last used.
36    #[serde(rename = "last_used_at", skip_serializing_if = "Option::is_none")]
37    pub last_used_at: Option<String>,
38    /// Time-stamp (UTC) of when the token will expire (optional).
39    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
40    pub expires_at: Option<String>,
41    /// IP Address of the client that last used the token.
42    #[serde(rename = "ip", skip_serializing_if = "Option::is_none")]
43    pub ip: Option<String>,
44    /// User-Agent header of the client that last used the token.
45    #[serde(rename = "user_agent", skip_serializing_if = "Option::is_none")]
46    pub user_agent: Option<String>,
47}
48
49impl TokenResponse {
50    pub fn new() -> TokenResponse {
51        TokenResponse {
52            services: None,
53            name: None,
54            scope: None,
55            created_at: None,
56            deleted_at: None,
57            updated_at: None,
58            id: None,
59            user_id: None,
60            last_used_at: None,
61            expires_at: None,
62            ip: None,
63            user_agent: None,
64        }
65    }
66}
67
68/// Space-delimited list of authorization scope.
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
70pub enum Scope {
71    #[serde(rename = "global")]
72    Global,
73    #[serde(rename = "purge_select")]
74    PurgeSelect,
75    #[serde(rename = "purge_all")]
76    PurgeAll,
77    #[serde(rename = "global:read")]
78    Globalread,
79}
80
81impl Default for Scope {
82    fn default() -> Scope {
83        Self::Global
84    }
85}
86