aws_sdk_waf/operation/update_rule/
_update_rule_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct UpdateRuleInput {
6    /// <p>The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <code>ListRules</code>.</p>
7    pub rule_id: ::std::option::Option<::std::string::String>,
8    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
9    pub change_token: ::std::option::Option<::std::string::String>,
10    /// <p>An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <code>Rule</code>. For more information, see the applicable data types:</p>
11    /// <ul>
12    /// <li>
13    /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
14    /// <li>
15    /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
16    /// <li>
17    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
18    /// </ul>
19    pub updates: ::std::option::Option<::std::vec::Vec<crate::types::RuleUpdate>>,
20}
21impl UpdateRuleInput {
22    /// <p>The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <code>ListRules</code>.</p>
23    pub fn rule_id(&self) -> ::std::option::Option<&str> {
24        self.rule_id.as_deref()
25    }
26    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
27    pub fn change_token(&self) -> ::std::option::Option<&str> {
28        self.change_token.as_deref()
29    }
30    /// <p>An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <code>Rule</code>. For more information, see the applicable data types:</p>
31    /// <ul>
32    /// <li>
33    /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
34    /// <li>
35    /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
36    /// <li>
37    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
38    /// </ul>
39    ///
40    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.updates.is_none()`.
41    pub fn updates(&self) -> &[crate::types::RuleUpdate] {
42        self.updates.as_deref().unwrap_or_default()
43    }
44}
45impl UpdateRuleInput {
46    /// Creates a new builder-style object to manufacture [`UpdateRuleInput`](crate::operation::update_rule::UpdateRuleInput).
47    pub fn builder() -> crate::operation::update_rule::builders::UpdateRuleInputBuilder {
48        crate::operation::update_rule::builders::UpdateRuleInputBuilder::default()
49    }
50}
51
52/// A builder for [`UpdateRuleInput`](crate::operation::update_rule::UpdateRuleInput).
53#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
54#[non_exhaustive]
55pub struct UpdateRuleInputBuilder {
56    pub(crate) rule_id: ::std::option::Option<::std::string::String>,
57    pub(crate) change_token: ::std::option::Option<::std::string::String>,
58    pub(crate) updates: ::std::option::Option<::std::vec::Vec<crate::types::RuleUpdate>>,
59}
60impl UpdateRuleInputBuilder {
61    /// <p>The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <code>ListRules</code>.</p>
62    /// This field is required.
63    pub fn rule_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.rule_id = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <code>ListRules</code>.</p>
68    pub fn set_rule_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.rule_id = input;
70        self
71    }
72    /// <p>The <code>RuleId</code> of the <code>Rule</code> that you want to update. <code>RuleId</code> is returned by <code>CreateRule</code> and by <code>ListRules</code>.</p>
73    pub fn get_rule_id(&self) -> &::std::option::Option<::std::string::String> {
74        &self.rule_id
75    }
76    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
77    /// This field is required.
78    pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79        self.change_token = ::std::option::Option::Some(input.into());
80        self
81    }
82    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
83    pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84        self.change_token = input;
85        self
86    }
87    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
88    pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
89        &self.change_token
90    }
91    /// Appends an item to `updates`.
92    ///
93    /// To override the contents of this collection use [`set_updates`](Self::set_updates).
94    ///
95    /// <p>An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <code>Rule</code>. For more information, see the applicable data types:</p>
96    /// <ul>
97    /// <li>
98    /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
99    /// <li>
100    /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
101    /// <li>
102    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
103    /// </ul>
104    pub fn updates(mut self, input: crate::types::RuleUpdate) -> Self {
105        let mut v = self.updates.unwrap_or_default();
106        v.push(input);
107        self.updates = ::std::option::Option::Some(v);
108        self
109    }
110    /// <p>An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <code>Rule</code>. For more information, see the applicable data types:</p>
111    /// <ul>
112    /// <li>
113    /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
114    /// <li>
115    /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
116    /// <li>
117    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
118    /// </ul>
119    pub fn set_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleUpdate>>) -> Self {
120        self.updates = input;
121        self
122    }
123    /// <p>An array of <code>RuleUpdate</code> objects that you want to insert into or delete from a <code>Rule</code>. For more information, see the applicable data types:</p>
124    /// <ul>
125    /// <li>
126    /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
127    /// <li>
128    /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
129    /// <li>
130    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
131    /// </ul>
132    pub fn get_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleUpdate>> {
133        &self.updates
134    }
135    /// Consumes the builder and constructs a [`UpdateRuleInput`](crate::operation::update_rule::UpdateRuleInput).
136    pub fn build(self) -> ::std::result::Result<crate::operation::update_rule::UpdateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
137        ::std::result::Result::Ok(crate::operation::update_rule::UpdateRuleInput {
138            rule_id: self.rule_id,
139            change_token: self.change_token,
140            updates: self.updates,
141        })
142    }
143}