aws_sdk_wafv2/operation/create_rule_group/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_rule_group::_create_rule_group_output::CreateRuleGroupOutputBuilder;
3
4pub use crate::operation::create_rule_group::_create_rule_group_input::CreateRuleGroupInputBuilder;
5
6impl crate::operation::create_rule_group::builders::CreateRuleGroupInputBuilder {
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::create_rule_group::CreateRuleGroupOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_rule_group::CreateRuleGroupError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_rule_group();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateRuleGroup`.
24///
25/// <p>Creates a <code>RuleGroup</code> per the specifications provided.</p>
26/// <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>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateRuleGroupFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::create_rule_group::builders::CreateRuleGroupInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34 crate::client::customize::internal::CustomizableSend<
35 crate::operation::create_rule_group::CreateRuleGroupOutput,
36 crate::operation::create_rule_group::CreateRuleGroupError,
37 > for CreateRuleGroupFluentBuilder
38{
39 fn send(
40 self,
41 config_override: crate::config::Builder,
42 ) -> crate::client::customize::internal::BoxFuture<
43 crate::client::customize::internal::SendResult<
44 crate::operation::create_rule_group::CreateRuleGroupOutput,
45 crate::operation::create_rule_group::CreateRuleGroupError,
46 >,
47 > {
48 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49 }
50}
51impl CreateRuleGroupFluentBuilder {
52 /// Creates a new `CreateRuleGroupFluentBuilder`.
53 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54 Self {
55 handle,
56 inner: ::std::default::Default::default(),
57 config_override: ::std::option::Option::None,
58 }
59 }
60 /// Access the CreateRuleGroup as a reference.
61 pub fn as_input(&self) -> &crate::operation::create_rule_group::builders::CreateRuleGroupInputBuilder {
62 &self.inner
63 }
64 /// Sends the request and returns the response.
65 ///
66 /// If an error occurs, an `SdkError` will be returned with additional details that
67 /// can be matched against.
68 ///
69 /// By default, any retryable failures will be retried twice. Retry behavior
70 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71 /// set when configuring the client.
72 pub async fn send(
73 self,
74 ) -> ::std::result::Result<
75 crate::operation::create_rule_group::CreateRuleGroupOutput,
76 ::aws_smithy_runtime_api::client::result::SdkError<
77 crate::operation::create_rule_group::CreateRuleGroupError,
78 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79 >,
80 > {
81 let input = self
82 .inner
83 .build()
84 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85 let runtime_plugins = crate::operation::create_rule_group::CreateRuleGroup::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::create_rule_group::CreateRuleGroup::orchestrate(&runtime_plugins, input).await
91 }
92
93 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94 pub fn customize(
95 self,
96 ) -> crate::client::customize::CustomizableOperation<
97 crate::operation::create_rule_group::CreateRuleGroupOutput,
98 crate::operation::create_rule_group::CreateRuleGroupError,
99 Self,
100 > {
101 crate::client::customize::CustomizableOperation::new(self)
102 }
103 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104 self.set_config_override(::std::option::Option::Some(config_override.into()));
105 self
106 }
107
108 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109 self.config_override = config_override;
110 self
111 }
112 /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
113 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.inner = self.inner.name(input.into());
115 self
116 }
117 /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
118 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.inner = self.inner.set_name(input);
120 self
121 }
122 /// <p>The name of the rule group. You cannot change the name of a rule group after you create it.</p>
123 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
124 self.inner.get_name()
125 }
126 /// <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>
127 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
128 /// <ul>
129 /// <li>
130 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
131 /// <li>
132 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
133 /// </ul>
134 pub fn scope(mut self, input: crate::types::Scope) -> Self {
135 self.inner = self.inner.scope(input);
136 self
137 }
138 /// <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>
139 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
140 /// <ul>
141 /// <li>
142 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
143 /// <li>
144 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
145 /// </ul>
146 pub fn set_scope(mut self, input: ::std::option::Option<crate::types::Scope>) -> Self {
147 self.inner = self.inner.set_scope(input);
148 self
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 get_scope(&self) -> &::std::option::Option<crate::types::Scope> {
159 self.inner.get_scope()
160 }
161 /// <p>The web ACL capacity units (WCUs) required for this rule group.</p>
162 /// <p>When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using <code>CheckCapacity</code>.</p>
163 /// <p>WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/aws-waf-capacity-units.html">WAF web ACL capacity units (WCU)</a> in the <i>WAF Developer Guide</i>.</p>
164 pub fn capacity(mut self, input: i64) -> Self {
165 self.inner = self.inner.capacity(input);
166 self
167 }
168 /// <p>The web ACL capacity units (WCUs) required for this rule group.</p>
169 /// <p>When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using <code>CheckCapacity</code>.</p>
170 /// <p>WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/aws-waf-capacity-units.html">WAF web ACL capacity units (WCU)</a> in the <i>WAF Developer Guide</i>.</p>
171 pub fn set_capacity(mut self, input: ::std::option::Option<i64>) -> Self {
172 self.inner = self.inner.set_capacity(input);
173 self
174 }
175 /// <p>The web ACL capacity units (WCUs) required for this rule group.</p>
176 /// <p>When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, WAF enforces this limit. You can check the capacity for a set of rules using <code>CheckCapacity</code>.</p>
177 /// <p>WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/aws-waf-capacity-units.html">WAF web ACL capacity units (WCU)</a> in the <i>WAF Developer Guide</i>.</p>
178 pub fn get_capacity(&self) -> &::std::option::Option<i64> {
179 self.inner.get_capacity()
180 }
181 /// <p>A description of the rule group that helps with identification.</p>
182 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
183 self.inner = self.inner.description(input.into());
184 self
185 }
186 /// <p>A description of the rule group that helps with identification.</p>
187 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
188 self.inner = self.inner.set_description(input);
189 self
190 }
191 /// <p>A description of the rule group that helps with identification.</p>
192 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
193 self.inner.get_description()
194 }
195 ///
196 /// Appends an item to `Rules`.
197 ///
198 /// To override the contents of this collection use [`set_rules`](Self::set_rules).
199 ///
200 /// <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>
201 pub fn rules(mut self, input: crate::types::Rule) -> Self {
202 self.inner = self.inner.rules(input);
203 self
204 }
205 /// <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>
206 pub fn set_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Rule>>) -> Self {
207 self.inner = self.inner.set_rules(input);
208 self
209 }
210 /// <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>
211 pub fn get_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Rule>> {
212 self.inner.get_rules()
213 }
214 /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
215 pub fn visibility_config(mut self, input: crate::types::VisibilityConfig) -> Self {
216 self.inner = self.inner.visibility_config(input);
217 self
218 }
219 /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
220 pub fn set_visibility_config(mut self, input: ::std::option::Option<crate::types::VisibilityConfig>) -> Self {
221 self.inner = self.inner.set_visibility_config(input);
222 self
223 }
224 /// <p>Defines and enables Amazon CloudWatch metrics and web request sample collection.</p>
225 pub fn get_visibility_config(&self) -> &::std::option::Option<crate::types::VisibilityConfig> {
226 self.inner.get_visibility_config()
227 }
228 ///
229 /// Appends an item to `Tags`.
230 ///
231 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
232 ///
233 /// <p>An array of key:value pairs to associate with the resource.</p>
234 pub fn tags(mut self, input: crate::types::Tag) -> Self {
235 self.inner = self.inner.tags(input);
236 self
237 }
238 /// <p>An array of key:value pairs to associate with the resource.</p>
239 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
240 self.inner = self.inner.set_tags(input);
241 self
242 }
243 /// <p>An array of key:value pairs to associate with the resource.</p>
244 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
245 self.inner.get_tags()
246 }
247 ///
248 /// Adds a key-value pair to `CustomResponseBodies`.
249 ///
250 /// To override the contents of this collection use [`set_custom_response_bodies`](Self::set_custom_response_bodies).
251 ///
252 /// <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>
253 /// <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>
254 /// <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>
255 pub fn custom_response_bodies(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::CustomResponseBody) -> Self {
256 self.inner = self.inner.custom_response_bodies(k.into(), v);
257 self
258 }
259 /// <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>
260 /// <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>
261 /// <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>
262 pub fn set_custom_response_bodies(
263 mut self,
264 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CustomResponseBody>>,
265 ) -> Self {
266 self.inner = self.inner.set_custom_response_bodies(input);
267 self
268 }
269 /// <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>
270 /// <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>
271 /// <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>
272 pub fn get_custom_response_bodies(
273 &self,
274 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CustomResponseBody>> {
275 self.inner.get_custom_response_bodies()
276 }
277}