fastly_api/models/waf_simulate_signal.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/// WafSimulateSignal : A signal detected during WAF simulation. The `type`, `detector`, `detector_scope`, and `redaction` fields are always present. The `location`, `name`, and `value` fields are present only when applicable to the signal category.
9
10
11
12#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
13pub struct WafSimulateSignal {
14 /// The type of signal detected (e.g., `SQLI`, `XSS`, `CMDEXE`, `TRAVERSAL`, `BACKDOOR`, `LOG4J-JNDI`, `BLOCKED`).
15 #[serde(rename = "type")]
16 pub _type: String,
17 /// The detector engine that identified the signal (e.g., `SQLI`, `LIBINJECTIONV5`, `LIBINJECTIONJS`, or a rule ID).
18 #[serde(rename = "detector")]
19 pub detector: String,
20 /// The scope of the detector that identified the signal. Derived from the signal type and detection type at simulation time. `system` — built-in WAF rule (e.g., `SQLI`, `XSS`). `workspace` — workspace-level custom rule or signal (e.g., `site.*` prefix). `account` — account-level custom signal (e.g., `corp.*` prefix). `unknown` — scope could not be determined (e.g., tags fetch failed or unrecognized type).
21 #[serde(rename = "detector_scope")]
22 pub detector_scope: DetectorScope,
23 /// The redaction level applied to the detected value. Clients should handle unexpected string values gracefully, as new redaction types may be added.
24 #[serde(rename = "redaction")]
25 pub redaction: Redaction,
26 /// Where in the request the signal was detected (e.g., `QUERYSTRING`, `POSTBODY`, `HEADER`, `HEADEROUT`, `POSTARG`). Present for detection signals; absent for custom and action signals.
27 #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
28 pub location: Option<String>,
29 /// The parameter or header name that triggered detection. Present when the WAF engine identifies a specific parameter or header.
30 #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
31 pub name: Option<String>,
32 /// The matched payload value that triggered signal detection. For detection signals, contains the matched content. For `BLOCKED` signals, carries the WAF response code as a string. Absent for custom signals.
33 #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
34 pub value: Option<String>,
35}
36
37impl WafSimulateSignal {
38 /// A signal detected during WAF simulation. The `type`, `detector`, `detector_scope`, and `redaction` fields are always present. The `location`, `name`, and `value` fields are present only when applicable to the signal category.
39 pub fn new(_type: String, detector: String, detector_scope: DetectorScope, redaction: Redaction) -> WafSimulateSignal {
40 WafSimulateSignal {
41 _type,
42 detector,
43 detector_scope,
44 redaction,
45 location: None,
46 name: None,
47 value: None,
48 }
49 }
50}
51
52/// The scope of the detector that identified the signal. Derived from the signal type and detection type at simulation time. `system` — built-in WAF rule (e.g., `SQLI`, `XSS`). `workspace` — workspace-level custom rule or signal (e.g., `site.*` prefix). `account` — account-level custom signal (e.g., `corp.*` prefix). `unknown` — scope could not be determined (e.g., tags fetch failed or unrecognized type).
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
54pub enum DetectorScope {
55 #[serde(rename = "system")]
56 System,
57 #[serde(rename = "workspace")]
58 Workspace,
59 #[serde(rename = "account")]
60 Account,
61 #[serde(rename = "unknown")]
62 Unknown,
63}
64
65impl Default for DetectorScope {
66 fn default() -> DetectorScope {
67 Self::System
68 }
69}
70/// The redaction level applied to the detected value. Clients should handle unexpected string values gracefully, as new redaction types may be added.
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum Redaction {
73 #[serde(rename = "none")]
74 None,
75 #[serde(rename = "param")]
76 Param,
77 #[serde(rename = "credit_card")]
78 CreditCard,
79 #[serde(rename = "ssn")]
80 Ssn,
81 #[serde(rename = "guid")]
82 Guid,
83 #[serde(rename = "iban")]
84 Iban,
85 #[serde(rename = "request_header")]
86 RequestHeader,
87 #[serde(rename = "response_header")]
88 ResponseHeader,
89 #[serde(rename = "custom_param")]
90 CustomParam,
91 #[serde(rename = "custom_request_header")]
92 CustomRequestHeader,
93 #[serde(rename = "custom_response_header")]
94 CustomResponseHeader,
95 #[serde(rename = "jsession_id")]
96 JsessionId,
97 #[serde(rename = "unknown")]
98 Unknown,
99}
100
101impl Default for Redaction {
102 fn default() -> Redaction {
103 Self::None
104 }
105}
106