fastly_api/models/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 Token {
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}
23
24impl Token {
25 pub fn new() -> Token {
26 Token {
27 services: None,
28 name: None,
29 scope: None,
30 }
31 }
32}
33
34/// Space-delimited list of authorization scope.
35#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
36pub enum Scope {
37 #[serde(rename = "global")]
38 Global,
39 #[serde(rename = "purge_select")]
40 PurgeSelect,
41 #[serde(rename = "purge_all")]
42 PurgeAll,
43 #[serde(rename = "global:read")]
44 Globalread,
45}
46
47impl Default for Scope {
48 fn default() -> Scope {
49 Self::Global
50 }
51}
52