fastly_api/models/
automation_token.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 AutomationToken {
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}
29
30impl AutomationToken {
31    pub fn new() -> AutomationToken {
32        AutomationToken {
33            name: None,
34            role: None,
35            services: None,
36            scope: None,
37            expires_at: None,
38        }
39    }
40}
41
42/// The role on the token.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum Role {
45    #[serde(rename = "billing")]
46    Billing,
47    #[serde(rename = "engineer")]
48    Engineer,
49    #[serde(rename = "user")]
50    User,
51}
52
53impl Default for Role {
54    fn default() -> Role {
55        Self::Billing
56    }
57}
58/// A space-delimited list of authorization scope.
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum Scope {
61    #[serde(rename = "global")]
62    Global,
63    #[serde(rename = "purge_select")]
64    PurgeSelect,
65    #[serde(rename = "purge_all")]
66    PurgeAll,
67    #[serde(rename = "global:read")]
68    Globalread,
69}
70
71impl Default for Scope {
72    fn default() -> Scope {
73        Self::Global
74    }
75}
76