fastly_api/models/network_protect_rule.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/// NetworkProtectRule : One ordered firewall rule. All match fields are optional, but at least one must be provided. The action is required. Rules have no public ID; replacing the list preserves timestamps only when logical fields, comment, and position are unchanged.
9
10
11
12#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
13pub struct NetworkProtectRule {
14 /// Optional rule metadata of 1 to 100 Unicode code points. It does not participate in traffic matching. Omit it to leave a rule without a comment; replacing rules with an item that omits it clears the stored comment. Omitting rules on PATCH preserves existing comments. Empty strings and null are rejected.
15 #[serde(rename = "comment", skip_serializing_if = "Option::is_none")]
16 pub comment: Option<String>,
17 #[serde(rename = "ip_protocol")]
18 pub ip_protocol: crate::models::NetworkProtectRuleIpProtocol,
19 /// Match traffic whose source appears in this prefix list.
20 #[serde(rename = "source_prefix_list_id")]
21 pub source_prefix_list_id: String,
22 /// Match traffic sent to this address; omit for any destination. An address outside a Network using this Rule Set never matches and still consumes one of the 64 rules. The API does not enforce containment in a network prefix; attached Rule Sets require a compatible IP family.
23 #[serde(rename = "destination_ip_address")]
24 pub destination_ip_address: String,
25 #[serde(rename = "source_ports")]
26 pub source_ports: Box<crate::models::NetworkProtectRuleSourcePorts>,
27 #[serde(rename = "destination_ports")]
28 pub destination_ports: Box<crate::models::NetworkProtectRuleDestinationPorts>,
29 #[serde(rename = "action")]
30 pub action: crate::models::NetworkProtectRuleAction,
31}
32
33impl NetworkProtectRule {
34 /// One ordered firewall rule. All match fields are optional, but at least one must be provided. The action is required. Rules have no public ID; replacing the list preserves timestamps only when logical fields, comment, and position are unchanged.
35 pub fn new(action: crate::models::NetworkProtectRuleAction, ip_protocol: crate::models::NetworkProtectRuleIpProtocol, source_prefix_list_id: String, destination_ip_address: String, source_ports: crate::models::NetworkProtectRuleSourcePorts, destination_ports: crate::models::NetworkProtectRuleDestinationPorts) -> NetworkProtectRule {
36 NetworkProtectRule {
37 comment: None,
38 ip_protocol,
39 source_prefix_list_id,
40 destination_ip_address,
41 source_ports: Box::new(source_ports),
42 destination_ports: Box::new(destination_ports),
43 action,
44 }
45 }
46}
47
48