aws_sdk_wafv2/operation/associate_web_acl/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::associate_web_acl::_associate_web_acl_output::AssociateWebAclOutputBuilder;
3
4pub use crate::operation::associate_web_acl::_associate_web_acl_input::AssociateWebAclInputBuilder;
5
6impl crate::operation::associate_web_acl::builders::AssociateWebAclInputBuilder {
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::associate_web_acl::AssociateWebAclOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::associate_web_acl::AssociateWebACLError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.associate_web_acl();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `AssociateWebACL`.
24///
25/// <p>Associates a web ACL with a resource, to protect the resource.</p>
26/// <p>Use this for all resource types except for Amazon CloudFront distributions. For Amazon CloudFront, call <code>UpdateDistribution</code> for the distribution and provide the Amazon Resource Name (ARN) of the web ACL in the web ACL ID. For information, see <a href="https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html">UpdateDistribution</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
27/// <p><b>Required permissions for customer-managed IAM policies</b></p>
28/// <p>This call requires permissions that are specific to the protected resource type. For details, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/security_iam_service-with-iam.html#security_iam_action-AssociateWebACL">Permissions for AssociateWebACL</a> in the <i>WAF Developer Guide</i>.</p>
29/// <p><b>Temporary inconsistencies during updates</b></p>
30/// <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>
31/// <p>The following are examples of the temporary inconsistencies that you might notice during change propagation:</p>
32/// <ul>
33/// <li>
34/// <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>
35/// <li>
36/// <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>
37/// <li>
38/// <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>
39/// <li>
40/// <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>
41/// </ul>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct AssociateWebACLFluentBuilder {
44 handle: ::std::sync::Arc<crate::client::Handle>,
45 inner: crate::operation::associate_web_acl::builders::AssociateWebAclInputBuilder,
46 config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49 crate::client::customize::internal::CustomizableSend<
50 crate::operation::associate_web_acl::AssociateWebAclOutput,
51 crate::operation::associate_web_acl::AssociateWebACLError,
52 > for AssociateWebACLFluentBuilder
53{
54 fn send(
55 self,
56 config_override: crate::config::Builder,
57 ) -> crate::client::customize::internal::BoxFuture<
58 crate::client::customize::internal::SendResult<
59 crate::operation::associate_web_acl::AssociateWebAclOutput,
60 crate::operation::associate_web_acl::AssociateWebACLError,
61 >,
62 > {
63 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64 }
65}
66impl AssociateWebACLFluentBuilder {
67 /// Creates a new `AssociateWebACLFluentBuilder`.
68 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
69 Self {
70 handle,
71 inner: ::std::default::Default::default(),
72 config_override: ::std::option::Option::None,
73 }
74 }
75 /// Access the AssociateWebACL as a reference.
76 pub fn as_input(&self) -> &crate::operation::associate_web_acl::builders::AssociateWebAclInputBuilder {
77 &self.inner
78 }
79 /// Sends the request and returns the response.
80 ///
81 /// If an error occurs, an `SdkError` will be returned with additional details that
82 /// can be matched against.
83 ///
84 /// By default, any retryable failures will be retried twice. Retry behavior
85 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
86 /// set when configuring the client.
87 pub async fn send(
88 self,
89 ) -> ::std::result::Result<
90 crate::operation::associate_web_acl::AssociateWebAclOutput,
91 ::aws_smithy_runtime_api::client::result::SdkError<
92 crate::operation::associate_web_acl::AssociateWebACLError,
93 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
94 >,
95 > {
96 let input = self
97 .inner
98 .build()
99 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
100 let runtime_plugins = crate::operation::associate_web_acl::AssociateWebACL::operation_runtime_plugins(
101 self.handle.runtime_plugins.clone(),
102 &self.handle.conf,
103 self.config_override,
104 );
105 crate::operation::associate_web_acl::AssociateWebACL::orchestrate(&runtime_plugins, input).await
106 }
107
108 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
109 pub fn customize(
110 self,
111 ) -> crate::client::customize::CustomizableOperation<
112 crate::operation::associate_web_acl::AssociateWebAclOutput,
113 crate::operation::associate_web_acl::AssociateWebACLError,
114 Self,
115 > {
116 crate::client::customize::CustomizableOperation::new(self)
117 }
118 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
119 self.set_config_override(::std::option::Option::Some(config_override.into()));
120 self
121 }
122
123 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
124 self.config_override = config_override;
125 self
126 }
127 /// <p>The Amazon Resource Name (ARN) of the web ACL that you want to associate with the resource.</p>
128 pub fn web_acl_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.inner = self.inner.web_acl_arn(input.into());
130 self
131 }
132 /// <p>The Amazon Resource Name (ARN) of the web ACL that you want to associate with the resource.</p>
133 pub fn set_web_acl_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134 self.inner = self.inner.set_web_acl_arn(input);
135 self
136 }
137 /// <p>The Amazon Resource Name (ARN) of the web ACL that you want to associate with the resource.</p>
138 pub fn get_web_acl_arn(&self) -> &::std::option::Option<::std::string::String> {
139 self.inner.get_web_acl_arn()
140 }
141 /// <p>The Amazon Resource Name (ARN) of the resource to associate with the web ACL.</p>
142 /// <p>The ARN must be in one of the following formats:</p>
143 /// <ul>
144 /// <li>
145 /// <p>For an Application Load Balancer: <code>arn:<i>partition</i>:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i> </code></p></li>
146 /// <li>
147 /// <p>For an Amazon API Gateway REST API: <code>arn:<i>partition</i>:apigateway:<i>region</i>::/restapis/<i>api-id</i>/stages/<i>stage-name</i> </code></p></li>
148 /// <li>
149 /// <p>For an AppSync GraphQL API: <code>arn:<i>partition</i>:appsync:<i>region</i>:<i>account-id</i>:apis/<i>GraphQLApiId</i> </code></p></li>
150 /// <li>
151 /// <p>For an Amazon Cognito user pool: <code>arn:<i>partition</i>:cognito-idp:<i>region</i>:<i>account-id</i>:userpool/<i>user-pool-id</i> </code></p></li>
152 /// <li>
153 /// <p>For an App Runner service: <code>arn:<i>partition</i>:apprunner:<i>region</i>:<i>account-id</i>:service/<i>apprunner-service-name</i>/<i>apprunner-service-id</i> </code></p></li>
154 /// <li>
155 /// <p>For an Amazon Web Services Verified Access instance: <code>arn:<i>partition</i>:ec2:<i>region</i>:<i>account-id</i>:verified-access-instance/<i>instance-id</i> </code></p></li>
156 /// <li>
157 /// <p>For an Amplify application: <code>arn:<i>partition</i>:amplify:<i>region</i>:<i>account-id</i>:apps/<i>app-id</i> </code></p></li>
158 /// </ul>
159 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160 self.inner = self.inner.resource_arn(input.into());
161 self
162 }
163 /// <p>The Amazon Resource Name (ARN) of the resource to associate with the web ACL.</p>
164 /// <p>The ARN must be in one of the following formats:</p>
165 /// <ul>
166 /// <li>
167 /// <p>For an Application Load Balancer: <code>arn:<i>partition</i>:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i> </code></p></li>
168 /// <li>
169 /// <p>For an Amazon API Gateway REST API: <code>arn:<i>partition</i>:apigateway:<i>region</i>::/restapis/<i>api-id</i>/stages/<i>stage-name</i> </code></p></li>
170 /// <li>
171 /// <p>For an AppSync GraphQL API: <code>arn:<i>partition</i>:appsync:<i>region</i>:<i>account-id</i>:apis/<i>GraphQLApiId</i> </code></p></li>
172 /// <li>
173 /// <p>For an Amazon Cognito user pool: <code>arn:<i>partition</i>:cognito-idp:<i>region</i>:<i>account-id</i>:userpool/<i>user-pool-id</i> </code></p></li>
174 /// <li>
175 /// <p>For an App Runner service: <code>arn:<i>partition</i>:apprunner:<i>region</i>:<i>account-id</i>:service/<i>apprunner-service-name</i>/<i>apprunner-service-id</i> </code></p></li>
176 /// <li>
177 /// <p>For an Amazon Web Services Verified Access instance: <code>arn:<i>partition</i>:ec2:<i>region</i>:<i>account-id</i>:verified-access-instance/<i>instance-id</i> </code></p></li>
178 /// <li>
179 /// <p>For an Amplify application: <code>arn:<i>partition</i>:amplify:<i>region</i>:<i>account-id</i>:apps/<i>app-id</i> </code></p></li>
180 /// </ul>
181 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.inner = self.inner.set_resource_arn(input);
183 self
184 }
185 /// <p>The Amazon Resource Name (ARN) of the resource to associate with the web ACL.</p>
186 /// <p>The ARN must be in one of the following formats:</p>
187 /// <ul>
188 /// <li>
189 /// <p>For an Application Load Balancer: <code>arn:<i>partition</i>:elasticloadbalancing:<i>region</i>:<i>account-id</i>:loadbalancer/app/<i>load-balancer-name</i>/<i>load-balancer-id</i> </code></p></li>
190 /// <li>
191 /// <p>For an Amazon API Gateway REST API: <code>arn:<i>partition</i>:apigateway:<i>region</i>::/restapis/<i>api-id</i>/stages/<i>stage-name</i> </code></p></li>
192 /// <li>
193 /// <p>For an AppSync GraphQL API: <code>arn:<i>partition</i>:appsync:<i>region</i>:<i>account-id</i>:apis/<i>GraphQLApiId</i> </code></p></li>
194 /// <li>
195 /// <p>For an Amazon Cognito user pool: <code>arn:<i>partition</i>:cognito-idp:<i>region</i>:<i>account-id</i>:userpool/<i>user-pool-id</i> </code></p></li>
196 /// <li>
197 /// <p>For an App Runner service: <code>arn:<i>partition</i>:apprunner:<i>region</i>:<i>account-id</i>:service/<i>apprunner-service-name</i>/<i>apprunner-service-id</i> </code></p></li>
198 /// <li>
199 /// <p>For an Amazon Web Services Verified Access instance: <code>arn:<i>partition</i>:ec2:<i>region</i>:<i>account-id</i>:verified-access-instance/<i>instance-id</i> </code></p></li>
200 /// <li>
201 /// <p>For an Amplify application: <code>arn:<i>partition</i>:amplify:<i>region</i>:<i>account-id</i>:apps/<i>app-id</i> </code></p></li>
202 /// </ul>
203 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
204 self.inner.get_resource_arn()
205 }
206}