aws_sdk_wafv2/operation/update_rule_group/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_rule_group::_update_rule_group_output::UpdateRuleGroupOutputBuilder;
3
4pub use crate::operation::update_rule_group::_update_rule_group_input::UpdateRuleGroupInputBuilder;
5
6impl crate::operation::update_rule_group::builders::UpdateRuleGroupInputBuilder {
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_group::UpdateRuleGroupOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_rule_group::UpdateRuleGroupError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_rule_group();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateRuleGroup`.
24///
25/// <p>Updates the specified <code>RuleGroup</code>.</p><note>
26/// <p>This operation completely replaces the mutable specifications that you already have for the rule group with the ones that you provide to this call.</p>
27/// <p>To modify a rule group, do the following:</p>
28/// <ol>
29/// <li>
30/// <p>Retrieve it by calling <code>GetRuleGroup</code></p></li>
31/// <li>
32/// <p>Update its settings as needed</p></li>
33/// <li>
34/// <p>Provide the complete rule group specification to this call</p></li>
35/// </ol>
36/// </note>
37/// <p>A rule group defines a collection of rules to inspect and control web requests that you can use in a <code>WebACL</code>. When you create a rule group, you define an immutable capacity limit. If you update a rule group, you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity requirements.</p>
38/// <p><b>Temporary inconsistencies during updates</b></p>
39/// <p>When you create or change a web ACL or other WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes.</p>
40/// <p>The following are examples of the temporary inconsistencies that you might notice during change propagation:</p>
41/// <ul>
42/// <li>
43/// <p>After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable.</p></li>
44/// <li>
45/// <p>After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another.</p></li>
46/// <li>
47/// <p>After you change a rule action setting, you might see the old action in some places and the new action in others.</p></li>
48/// <li>
49/// <p>After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another.</p></li>
50/// </ul>
51#[derive(::std::clone::Clone, ::std::fmt::Debug)]
52pub struct UpdateRuleGroupFluentBuilder {
53 handle: ::std::sync::Arc<crate::client::Handle>,
54 inner: crate::operation::update_rule_group::builders::UpdateRuleGroupInputBuilder,
55 config_override: ::std::option::Option<crate::config::Builder>,
56}
57impl
58 crate::client::customize::internal::CustomizableSend<
59 crate::operation::update_rule_group::UpdateRuleGroupOutput,
60 crate::operation::update_rule_group::UpdateRuleGroupError,
61 > for UpdateRuleGroupFluentBuilder
62{
63 fn send(
64 self,
65 config_override: crate::config::Builder,
66 ) -> crate::client::customize::internal::BoxFuture<
67 crate::client::customize::internal::SendResult<
68 crate::operation::update_rule_group::UpdateRuleGroupOutput,
69 crate::operation::update_rule_group::UpdateRuleGroupError,
70 >,
71 > {
72 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
73 }
74}
75impl UpdateRuleGroupFluentBuilder {
76 /// Creates a new `UpdateRuleGroupFluentBuilder`.
77 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
78 Self {
79 handle,
80 inner: ::std::default::Default::default(),
81 config_override: ::std::option::Option::None,
82 }
83 }
84 /// Access the UpdateRuleGroup as a reference.
85 pub fn as_input(&self) -> &crate::operation::update_rule_group::builders::UpdateRuleGroupInputBuilder {
86 &self.inner
87 }
88 /// Sends the request and returns the response.
89 ///
90 /// If an error occurs, an `SdkError` will be returned with additional details that
91 /// can be matched against.
92 ///
93 /// By default, any retryable failures will be retried twice. Retry behavior
94 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
95 /// set when configuring the client.
96 pub async fn send(
97 self,
98 ) -> ::std::result::Result<
99 crate::operation::update_rule_group::UpdateRuleGroupOutput,
100 ::aws_smithy_runtime_api::client::result::SdkError<
101 crate::operation::update_rule_group::UpdateRuleGroupError,
102 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
103 >,
104 > {
105 let input = self
106 .inner
107 .build()
108 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
109 let runtime_plugins = crate::operation::update_rule_group::UpdateRuleGroup::operation_runtime_plugins(
110 self.handle.runtime_plugins.clone(),
111 &self.handle.conf,
112 self.config_override,
113 );
114 crate::operation::update_rule_group::UpdateRuleGroup::orchestrate(&runtime_plugins, input).await
115 }
116
117 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
118 pub fn customize(
119 self,
120 ) -> crate::client::customize::CustomizableOperation<
121 crate::operation::update_rule_group::UpdateRuleGroupOutput,
122 crate::operation::update_rule_group::UpdateRuleGroupError,
123 Self,
124 > {
125 crate::client::customize::CustomizableOperation::new(self)
126 }
127 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
128 self.set_config_override(::std::option::Option::Some(config_override.into()));
129 self
130 }
131
132 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
133 self.config_override = config_override;
134 self
135 }
136 /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
137 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138 self.inner = self.inner.name(input.into());
139 self
140 }
141 /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
142 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143 self.inner = self.inner.set_name(input);
144 self
145 }
146 /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
147 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
148 self.inner.get_name()
149 }
150 /// <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p>
151 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
152 /// <ul>
153 /// <li>
154 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
155 /// <li>
156 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
157 /// </ul>
158 pub fn scope(mut self, input: crate::types::Scope) -> Self {
159 self.inner = self.inner.scope(input);
160 self
161 }
162 /// <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p>
163 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
164 /// <ul>
165 /// <li>
166 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
167 /// <li>
168 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
169 /// </ul>
170 pub fn set_scope(mut self, input: ::std::option::Option<crate::types::Scope>) -> Self {
171 self.inner = self.inner.set_scope(input);
172 self
173 }
174 /// <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p>
175 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
176 /// <ul>
177 /// <li>
178 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
179 /// <li>
180 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
181 /// </ul>
182 pub fn get_scope(&self) -> &::std::option::Option<crate::types::Scope> {
183 self.inner.get_scope()
184 }
185 /// <p>A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.</p>
186 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187 self.inner = self.inner.id(input.into());
188 self
189 }
190 /// <p>A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.</p>
191 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192 self.inner = self.inner.set_id(input);
193 self
194 }
195 /// <p>A unique identifier for the rule group. This ID is returned in the responses to create and list commands. You provide it to operations like update and delete.</p>
196 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
197 self.inner.get_id()
198 }
199 /// <p>A description of the rule group that helps with identification.</p>
200 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201 self.inner = self.inner.description(input.into());
202 self
203 }
204 /// <p>A description of the rule group that helps with identification.</p>
205 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
206 self.inner = self.inner.set_description(input);
207 self
208 }
209 /// <p>A description of the rule group that helps with identification.</p>
210 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
211 self.inner.get_description()
212 }
213 ///
214 /// Appends an item to `Rules`.
215 ///
216 /// To override the contents of this collection use [`set_rules`](Self::set_rules).
217 ///
218 /// <p>The <code>Rule</code> statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.</p>
219 pub fn rules(mut self, input: crate::types::Rule) -> Self {
220 self.inner = self.inner.rules(input);
221 self
222 }
223 /// <p>The <code>Rule</code> statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.</p>
224 pub fn set_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Rule>>) -> Self {
225 self.inner = self.inner.set_rules(input);
226 self
227 }
228 /// <p>The <code>Rule</code> statements used to identify the web requests that you want to manage. Each rule includes one top-level statement that WAF uses to identify matching web requests, and parameters that govern how WAF handles them.</p>
229 pub fn get_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Rule>> {
230 self.inner.get_rules()
231 }
232 /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
233 pub fn visibility_config(mut self, input: crate::types::VisibilityConfig) -> Self {
234 self.inner = self.inner.visibility_config(input);
235 self
236 }
237 /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
238 pub fn set_visibility_config(mut self, input: ::std::option::Option<crate::types::VisibilityConfig>) -> Self {
239 self.inner = self.inner.set_visibility_config(input);
240 self
241 }
242 /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
243 pub fn get_visibility_config(&self) -> &::std::option::Option<crate::types::VisibilityConfig> {
244 self.inner.get_visibility_config()
245 }
246 /// <p>A token used for optimistic locking. WAF returns a token to your <code>get</code> and <code>list</code> requests, to mark the state of the entity at the time of the request. To make changes to the entity associated with the token, you provide the token to operations like <code>update</code> and <code>delete</code>. WAF uses the token to ensure that no changes have been made to the entity since you last retrieved it. If a change has been made, the update fails with a <code>WAFOptimisticLockException</code>. If this happens, perform another <code>get</code>, and use the new token returned by that operation.</p>
247 pub fn lock_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
248 self.inner = self.inner.lock_token(input.into());
249 self
250 }
251 /// <p>A token used for optimistic locking. WAF returns a token to your <code>get</code> and <code>list</code> requests, to mark the state of the entity at the time of the request. To make changes to the entity associated with the token, you provide the token to operations like <code>update</code> and <code>delete</code>. WAF uses the token to ensure that no changes have been made to the entity since you last retrieved it. If a change has been made, the update fails with a <code>WAFOptimisticLockException</code>. If this happens, perform another <code>get</code>, and use the new token returned by that operation.</p>
252 pub fn set_lock_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
253 self.inner = self.inner.set_lock_token(input);
254 self
255 }
256 /// <p>A token used for optimistic locking. WAF returns a token to your <code>get</code> and <code>list</code> requests, to mark the state of the entity at the time of the request. To make changes to the entity associated with the token, you provide the token to operations like <code>update</code> and <code>delete</code>. WAF uses the token to ensure that no changes have been made to the entity since you last retrieved it. If a change has been made, the update fails with a <code>WAFOptimisticLockException</code>. If this happens, perform another <code>get</code>, and use the new token returned by that operation.</p>
257 pub fn get_lock_token(&self) -> &::std::option::Option<::std::string::String> {
258 self.inner.get_lock_token()
259 }
260 ///
261 /// Adds a key-value pair to `CustomResponseBodies`.
262 ///
263 /// To override the contents of this collection use [`set_custom_response_bodies`](Self::set_custom_response_bodies).
264 ///
265 /// <p>A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.</p>
266 /// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
267 /// <p>For information about the limits on count and size for custom request and response settings, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">WAF quotas</a> in the <i>WAF Developer Guide</i>.</p>
268 pub fn custom_response_bodies(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::CustomResponseBody) -> Self {
269 self.inner = self.inner.custom_response_bodies(k.into(), v);
270 self
271 }
272 /// <p>A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.</p>
273 /// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
274 /// <p>For information about the limits on count and size for custom request and response settings, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">WAF quotas</a> in the <i>WAF Developer Guide</i>.</p>
275 pub fn set_custom_response_bodies(
276 mut self,
277 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CustomResponseBody>>,
278 ) -> Self {
279 self.inner = self.inner.set_custom_response_bodies(input);
280 self
281 }
282 /// <p>A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.</p>
283 /// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
284 /// <p>For information about the limits on count and size for custom request and response settings, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/limits.html">WAF quotas</a> in the <i>WAF Developer Guide</i>.</p>
285 pub fn get_custom_response_bodies(
286 &self,
287 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CustomResponseBody>> {
288 self.inner.get_custom_response_bodies()
289 }
290}