aws_sdk_networkfirewall/types/_stateless_rule.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A single stateless rule. This is used in <code>StatelessRulesAndCustomActions</code>.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct StatelessRule {
7 /// <p>Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.</p>
8 pub rule_definition: ::std::option::Option<crate::types::RuleDefinition>,
9 /// <p>Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.</p>
10 /// <p>Each stateless rule group uses exactly one <code>StatelessRulesAndCustomActions</code> object, and each <code>StatelessRulesAndCustomActions</code> contains exactly one <code>StatelessRules</code> object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any single <code>StatelessRules</code> object.</p>
11 /// <p>You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there's a wide range in between, for example use 100, 200, and so on.</p>
12 pub priority: i32,
13}
14impl StatelessRule {
15 /// <p>Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.</p>
16 pub fn rule_definition(&self) -> ::std::option::Option<&crate::types::RuleDefinition> {
17 self.rule_definition.as_ref()
18 }
19 /// <p>Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.</p>
20 /// <p>Each stateless rule group uses exactly one <code>StatelessRulesAndCustomActions</code> object, and each <code>StatelessRulesAndCustomActions</code> contains exactly one <code>StatelessRules</code> object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any single <code>StatelessRules</code> object.</p>
21 /// <p>You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there's a wide range in between, for example use 100, 200, and so on.</p>
22 pub fn priority(&self) -> i32 {
23 self.priority
24 }
25}
26impl StatelessRule {
27 /// Creates a new builder-style object to manufacture [`StatelessRule`](crate::types::StatelessRule).
28 pub fn builder() -> crate::types::builders::StatelessRuleBuilder {
29 crate::types::builders::StatelessRuleBuilder::default()
30 }
31}
32
33/// A builder for [`StatelessRule`](crate::types::StatelessRule).
34#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
35#[non_exhaustive]
36pub struct StatelessRuleBuilder {
37 pub(crate) rule_definition: ::std::option::Option<crate::types::RuleDefinition>,
38 pub(crate) priority: ::std::option::Option<i32>,
39}
40impl StatelessRuleBuilder {
41 /// <p>Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.</p>
42 /// This field is required.
43 pub fn rule_definition(mut self, input: crate::types::RuleDefinition) -> Self {
44 self.rule_definition = ::std::option::Option::Some(input);
45 self
46 }
47 /// <p>Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.</p>
48 pub fn set_rule_definition(mut self, input: ::std::option::Option<crate::types::RuleDefinition>) -> Self {
49 self.rule_definition = input;
50 self
51 }
52 /// <p>Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.</p>
53 pub fn get_rule_definition(&self) -> &::std::option::Option<crate::types::RuleDefinition> {
54 &self.rule_definition
55 }
56 /// <p>Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.</p>
57 /// <p>Each stateless rule group uses exactly one <code>StatelessRulesAndCustomActions</code> object, and each <code>StatelessRulesAndCustomActions</code> contains exactly one <code>StatelessRules</code> object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any single <code>StatelessRules</code> object.</p>
58 /// <p>You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there's a wide range in between, for example use 100, 200, and so on.</p>
59 /// This field is required.
60 pub fn priority(mut self, input: i32) -> Self {
61 self.priority = ::std::option::Option::Some(input);
62 self
63 }
64 /// <p>Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.</p>
65 /// <p>Each stateless rule group uses exactly one <code>StatelessRulesAndCustomActions</code> object, and each <code>StatelessRulesAndCustomActions</code> contains exactly one <code>StatelessRules</code> object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any single <code>StatelessRules</code> object.</p>
66 /// <p>You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there's a wide range in between, for example use 100, 200, and so on.</p>
67 pub fn set_priority(mut self, input: ::std::option::Option<i32>) -> Self {
68 self.priority = input;
69 self
70 }
71 /// <p>Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.</p>
72 /// <p>Each stateless rule group uses exactly one <code>StatelessRulesAndCustomActions</code> object, and each <code>StatelessRulesAndCustomActions</code> contains exactly one <code>StatelessRules</code> object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any single <code>StatelessRules</code> object.</p>
73 /// <p>You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there's a wide range in between, for example use 100, 200, and so on.</p>
74 pub fn get_priority(&self) -> &::std::option::Option<i32> {
75 &self.priority
76 }
77 /// Consumes the builder and constructs a [`StatelessRule`](crate::types::StatelessRule).
78 /// This method will fail if any of the following fields are not set:
79 /// - [`priority`](crate::types::builders::StatelessRuleBuilder::priority)
80 pub fn build(self) -> ::std::result::Result<crate::types::StatelessRule, ::aws_smithy_types::error::operation::BuildError> {
81 ::std::result::Result::Ok(crate::types::StatelessRule {
82 rule_definition: self.rule_definition,
83 priority: self.priority.ok_or_else(|| {
84 ::aws_smithy_types::error::operation::BuildError::missing_field(
85 "priority",
86 "priority was not specified but it is required when building StatelessRule",
87 )
88 })?,
89 })
90 }
91}