aws_sdk_waf/operation/update_rule/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_rule::_update_rule_output::UpdateRuleOutputBuilder;
3
4pub use crate::operation::update_rule::_update_rule_input::UpdateRuleInputBuilder;
5
6impl crate::operation::update_rule::builders::UpdateRuleInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::update_rule::UpdateRuleOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_rule::UpdateRuleError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_rule();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateRule`.
24///
25/// <note>
26/// <p>This is <b>AWS WAF Classic</b> documentation. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html">AWS WAF Classic</a> in the developer guide.</p>
27/// <p><b>For the latest version of AWS WAF</b>, use the AWS WAFV2 API and see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS WAF Developer Guide</a>. With the latest version, AWS WAF has a single set of endpoints for regional and global use.</p>
28/// </note>
29/// <p>Inserts or deletes <code>Predicate</code> objects in a <code>Rule</code>. Each <code>Predicate</code> object identifies a predicate, such as a <code>ByteMatchSet</code> or an <code>IPSet</code>, that specifies the web requests that you want to allow, block, or count. If you add more than one predicate to a <code>Rule</code>, a request must match all of the specifications to be allowed, blocked, or counted. For example, suppose that you add the following to a <code>Rule</code>:</p>
30/// <ul>
31/// <li>
32/// <p>A <code>ByteMatchSet</code> that matches the value <code>BadBot</code> in the <code>User-Agent</code> header</p></li>
33/// <li>
34/// <p>An <code>IPSet</code> that matches the IP address <code>192.0.2.44</code></p></li>
35/// </ul>
36/// <p>You then add the <code>Rule</code> to a <code>WebACL</code> and specify that you want to block requests that satisfy the <code>Rule</code>. For a request to be blocked, the <code>User-Agent</code> header in the request must contain the value <code>BadBot</code> <i>and</i> the request must originate from the IP address 192.0.2.44.</p>
37/// <p>To create and configure a <code>Rule</code>, perform the following steps:</p>
38/// <ol>
39/// <li>
40/// <p>Create and update the predicates that you want to include in the <code>Rule</code>.</p></li>
41/// <li>
42/// <p>Create the <code>Rule</code>. See <code>CreateRule</code>.</p></li>
43/// <li>
44/// <p>Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code> parameter of an <code>UpdateRule</code> request.</p></li>
45/// <li>
46/// <p>Submit an <code>UpdateRule</code> request to add predicates to the <code>Rule</code>.</p></li>
47/// <li>
48/// <p>Create and update a <code>WebACL</code> that contains the <code>Rule</code>. See <code>CreateWebACL</code>.</p></li>
49/// </ol>
50/// <p>If you want to replace one <code>ByteMatchSet</code> or <code>IPSet</code> with another, you delete the existing one and add the new one.</p>
51/// <p>For more information about how to use the AWS WAF API to allow or block HTTP requests, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer Guide</a>.</p>
52#[derive(::std::clone::Clone, ::std::fmt::Debug)]
53pub struct UpdateRuleFluentBuilder {
54 handle: ::std::sync::Arc<crate::client::Handle>,
55 inner: crate::operation::update_rule::builders::UpdateRuleInputBuilder,
56 config_override: ::std::option::Option<crate::config::Builder>,
57}
58impl
59 crate::client::customize::internal::CustomizableSend<
60 crate::operation::update_rule::UpdateRuleOutput,
61 crate::operation::update_rule::UpdateRuleError,
62 > for UpdateRuleFluentBuilder
63{
64 fn send(
65 self,
66 config_override: crate::config::Builder,
67 ) -> crate::client::customize::internal::BoxFuture<
68 crate::client::customize::internal::SendResult<
69 crate::operation::update_rule::UpdateRuleOutput,
70 crate::operation::update_rule::UpdateRuleError,
71 >,
72 > {
73 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
74 }
75}
76impl UpdateRuleFluentBuilder {
77 /// Creates a new `UpdateRuleFluentBuilder`.
78 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
79 Self {
80 handle,
81 inner: ::std::default::Default::default(),
82 config_override: ::std::option::Option::None,
83 }
84 }
85 /// Access the UpdateRule as a reference.
86 pub fn as_input(&self) -> &crate::operation::update_rule::builders::UpdateRuleInputBuilder {
87 &self.inner
88 }
89 /// Sends the request and returns the response.
90 ///
91 /// If an error occurs, an `SdkError` will be returned with additional details that
92 /// can be matched against.
93 ///
94 /// By default, any retryable failures will be retried twice. Retry behavior
95 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
96 /// set when configuring the client.
97 pub async fn send(
98 self,
99 ) -> ::std::result::Result<
100 crate::operation::update_rule::UpdateRuleOutput,
101 ::aws_smithy_runtime_api::client::result::SdkError<
102 crate::operation::update_rule::UpdateRuleError,
103 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
104 >,
105 > {
106 let input = self
107 .inner
108 .build()
109 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
110 let runtime_plugins = crate::operation::update_rule::UpdateRule::operation_runtime_plugins(
111 self.handle.runtime_plugins.clone(),
112 &self.handle.conf,
113 self.config_override,
114 );
115 crate::operation::update_rule::UpdateRule::orchestrate(&runtime_plugins, input).await
116 }
117
118 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
119 pub fn customize(
120 self,
121 ) -> crate::client::customize::CustomizableOperation<
122 crate::operation::update_rule::UpdateRuleOutput,
123 crate::operation::update_rule::UpdateRuleError,
124 Self,
125 > {
126 crate::client::customize::CustomizableOperation::new(self)
127 }
128 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
129 self.set_config_override(::std::option::Option::Some(config_override.into()));
130 self
131 }
132
133 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
134 self.config_override = config_override;
135 self
136 }
137 /// <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>
138 pub fn rule_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139 self.inner = self.inner.rule_id(input.into());
140 self
141 }
142 /// <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>
143 pub fn set_rule_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144 self.inner = self.inner.set_rule_id(input);
145 self
146 }
147 /// <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>
148 pub fn get_rule_id(&self) -> &::std::option::Option<::std::string::String> {
149 self.inner.get_rule_id()
150 }
151 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
152 pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153 self.inner = self.inner.change_token(input.into());
154 self
155 }
156 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
157 pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158 self.inner = self.inner.set_change_token(input);
159 self
160 }
161 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
162 pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
163 self.inner.get_change_token()
164 }
165 ///
166 /// Appends an item to `Updates`.
167 ///
168 /// To override the contents of this collection use [`set_updates`](Self::set_updates).
169 ///
170 /// <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>
171 /// <ul>
172 /// <li>
173 /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
174 /// <li>
175 /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
176 /// <li>
177 /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
178 /// </ul>
179 pub fn updates(mut self, input: crate::types::RuleUpdate) -> Self {
180 self.inner = self.inner.updates(input);
181 self
182 }
183 /// <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>
184 /// <ul>
185 /// <li>
186 /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
187 /// <li>
188 /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
189 /// <li>
190 /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
191 /// </ul>
192 pub fn set_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RuleUpdate>>) -> Self {
193 self.inner = self.inner.set_updates(input);
194 self
195 }
196 /// <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>
197 /// <ul>
198 /// <li>
199 /// <p><code>RuleUpdate</code>: Contains <code>Action</code> and <code>Predicate</code></p></li>
200 /// <li>
201 /// <p><code>Predicate</code>: Contains <code>DataId</code>, <code>Negated</code>, and <code>Type</code></p></li>
202 /// <li>
203 /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
204 /// </ul>
205 pub fn get_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RuleUpdate>> {
206 self.inner.get_updates()
207 }
208}