/*
* Fastly API
*
* 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/)
*
*/
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct AutomationToken {
/// The name of the token.
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// The primary role on the token. For tokens with multiple roles, this returns the highest-priority role for backwards compatibility.
#[serde(rename = "role", skip_serializing_if = "Option::is_none")]
pub role: Option<Role>,
/// All roles assigned to the token. Each role includes an `id` and `name`.
#[serde(rename = "roles", skip_serializing_if = "Option::is_none")]
pub roles: Option<Vec<crate::models::AutomationTokenRole>>,
/// 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.
#[serde(rename = "services", skip_serializing_if = "Option::is_none")]
pub services: Option<Vec<String>>,
/// When `true`, the token is restricted to only the services in the `services` array. When `false`, the token has access to all services.
#[serde(rename = "limit_services", skip_serializing_if = "Option::is_none")]
pub limit_services: Option<bool>,
/// 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.
#[serde(rename = "limit_workspaces", skip_serializing_if = "Option::is_none")]
pub limit_workspaces: Option<bool>,
/// The workspace IDs of the workspaces the token has access to. Returns an empty array for tokens without workspace access.
#[serde(rename = "workspaces", skip_serializing_if = "Option::is_none")]
pub workspaces: Option<Vec<String>>,
/// A space-delimited list of authorization scope.
#[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
pub scope: Option<Scope>,
/// A UTC timestamp of when the token expires.
#[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
pub expires_at: Option<String>,
}
impl AutomationToken {
pub fn new() -> AutomationToken {
AutomationToken {
name: None,
role: None,
roles: None,
services: None,
limit_services: None,
limit_workspaces: None,
workspaces: None,
scope: None,
expires_at: None,
}
}
}
/// The primary role on the token. For tokens with multiple roles, this returns the highest-priority role for backwards compatibility.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Role {
#[serde(rename = "billing")]
Billing,
#[serde(rename = "engineer")]
Engineer,
#[serde(rename = "user")]
User,
#[serde(rename = "ngwaf_user_imported")]
NgwafUserImported,
#[serde(rename = "ngwaf_admin_imported")]
NgwafAdminImported,
#[serde(rename = "ngwaf_owner_imported")]
NgwafOwnerImported,
#[serde(rename = "ngwaf_observer_imported")]
NgwafObserverImported,
#[serde(rename = "tls_admin")]
TlsAdmin,
#[serde(rename = "tls_viewer")]
TlsViewer,
}
impl Default for Role {
fn default() -> Role {
Self::Billing
}
}
/// A space-delimited list of authorization scope.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Scope {
#[serde(rename = "global")]
Global,
#[serde(rename = "purge_select")]
PurgeSelect,
#[serde(rename = "purge_all")]
PurgeAll,
#[serde(rename = "global:read")]
Globalread,
}
impl Default for Scope {
fn default() -> Scope {
Self::Global
}
}