Skip to main content

fastly_api/models/
arc_virtual_key.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/// ArcVirtualKey : A virtual key used to authenticate requests through the AI Runtime Control gateway.
9
10
11
12#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
13pub struct ArcVirtualKey {
14    /// A display name for the virtual key.
15    #[serde(rename = "name")]
16    pub name: String,
17    /// The date and time the key expires, in RFC 3339 format. Omit for a key that doesn't expire.
18    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
19    pub expires_at: Option<String>,
20    /// Whether AI Firewall security is enabled for requests made with this key.
21    #[serde(rename = "security_enabled", skip_serializing_if = "Option::is_none")]
22    pub security_enabled: Option<bool>,
23    /// The action AI Firewall takes when it detects a violation on a request made with this key. Only meaningful when `security_enabled` is `true`.
24    #[serde(rename = "security_action", skip_serializing_if = "Option::is_none")]
25    pub security_action: Option<SecurityAction>,
26    /// The requests-per-minute limit for this key. Omit for no limit.
27    #[serde(rename = "rpm_limit", skip_serializing_if = "Option::is_none")]
28    pub rpm_limit: Option<i32>,
29    /// The tokens-per-minute limit for this key. Omit for no limit.
30    #[serde(rename = "tpm_limit", skip_serializing_if = "Option::is_none")]
31    pub tpm_limit: Option<i32>,
32}
33
34impl ArcVirtualKey {
35    /// A virtual key used to authenticate requests through the AI Runtime Control gateway.
36    pub fn new(name: String) -> ArcVirtualKey {
37        ArcVirtualKey {
38            name,
39            expires_at: None,
40            security_enabled: None,
41            security_action: None,
42            rpm_limit: None,
43            tpm_limit: None,
44        }
45    }
46}
47
48/// The action AI Firewall takes when it detects a violation on a request made with this key. Only meaningful when `security_enabled` is `true`.
49#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
50pub enum SecurityAction {
51    #[serde(rename = "log")]
52    Log,
53    #[serde(rename = "block")]
54    Block,
55    #[serde(rename = "replace")]
56    Replace,
57}
58
59impl Default for SecurityAction {
60    fn default() -> SecurityAction {
61        Self::Log
62    }
63}
64