aws_sdk_shield/operation/enable_application_layer_automatic_response/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::enable_application_layer_automatic_response::_enable_application_layer_automatic_response_output::EnableApplicationLayerAutomaticResponseOutputBuilder;
3
4pub use crate::operation::enable_application_layer_automatic_response::_enable_application_layer_automatic_response_input::EnableApplicationLayerAutomaticResponseInputBuilder;
5
6impl crate::operation::enable_application_layer_automatic_response::builders::EnableApplicationLayerAutomaticResponseInputBuilder {
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::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.enable_application_layer_automatic_response();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `EnableApplicationLayerAutomaticResponse`.
24///
25/// <p>Enable the Shield Advanced automatic application layer DDoS mitigation for the protected resource.</p><note>
26/// <p>This feature is available for Amazon CloudFront distributions and Application Load Balancers only.</p>
27/// </note>
28/// <p>This causes Shield Advanced to create, verify, and apply WAF rules for DDoS attacks that it detects for the resource. Shield Advanced applies the rules in a Shield rule group inside the web ACL that you've associated with the resource. For information about how automatic mitigation works and the requirements for using it, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/ddos-advanced-automatic-app-layer-response.html">Shield Advanced automatic application layer DDoS mitigation</a>.</p><note>
29/// <p>Don't use this action to make changes to automatic mitigation settings when it's already enabled for a resource. Instead, use <code>UpdateApplicationLayerAutomaticResponse</code>.</p>
30/// </note>
31/// <p>To use this feature, you must associate a web ACL with the protected resource. The web ACL must be created using the latest version of WAF (v2). You can associate the web ACL through the Shield Advanced console at <a href="https://console.aws.amazon.com/wafv2/shieldv2#/">https://console.aws.amazon.com/wafv2/shieldv2#/</a>. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/getting-started-ddos.html">Getting Started with Shield Advanced</a>. You can also associate the web ACL to the resource through the WAF console or the WAF API, but you must manage Shield Advanced automatic mitigation through Shield Advanced. For information about WAF, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">WAF Developer Guide</a>.</p>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct EnableApplicationLayerAutomaticResponseFluentBuilder {
34    handle: ::std::sync::Arc<crate::client::Handle>,
35    inner: crate::operation::enable_application_layer_automatic_response::builders::EnableApplicationLayerAutomaticResponseInputBuilder,
36    config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39    crate::client::customize::internal::CustomizableSend<
40        crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseOutput,
41        crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseError,
42    > for EnableApplicationLayerAutomaticResponseFluentBuilder
43{
44    fn send(
45        self,
46        config_override: crate::config::Builder,
47    ) -> crate::client::customize::internal::BoxFuture<
48        crate::client::customize::internal::SendResult<
49            crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseOutput,
50            crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseError,
51        >,
52    > {
53        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54    }
55}
56impl EnableApplicationLayerAutomaticResponseFluentBuilder {
57    /// Creates a new `EnableApplicationLayerAutomaticResponseFluentBuilder`.
58    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59        Self {
60            handle,
61            inner: ::std::default::Default::default(),
62            config_override: ::std::option::Option::None,
63        }
64    }
65    /// Access the EnableApplicationLayerAutomaticResponse as a reference.
66    pub fn as_input(
67        &self,
68    ) -> &crate::operation::enable_application_layer_automatic_response::builders::EnableApplicationLayerAutomaticResponseInputBuilder {
69        &self.inner
70    }
71    /// Sends the request and returns the response.
72    ///
73    /// If an error occurs, an `SdkError` will be returned with additional details that
74    /// can be matched against.
75    ///
76    /// By default, any retryable failures will be retried twice. Retry behavior
77    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78    /// set when configuring the client.
79    pub async fn send(
80        self,
81    ) -> ::std::result::Result<
82        crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseOutput,
83        ::aws_smithy_runtime_api::client::result::SdkError<
84            crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseError,
85            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86        >,
87    > {
88        let input = self
89            .inner
90            .build()
91            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92        let runtime_plugins =
93            crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponse::operation_runtime_plugins(
94                self.handle.runtime_plugins.clone(),
95                &self.handle.conf,
96                self.config_override,
97            );
98        crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponse::orchestrate(&runtime_plugins, input)
99            .await
100    }
101
102    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
103    pub fn customize(
104        self,
105    ) -> crate::client::customize::CustomizableOperation<
106        crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseOutput,
107        crate::operation::enable_application_layer_automatic_response::EnableApplicationLayerAutomaticResponseError,
108        Self,
109    > {
110        crate::client::customize::CustomizableOperation::new(self)
111    }
112    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
113        self.set_config_override(::std::option::Option::Some(config_override.into()));
114        self
115    }
116
117    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
118        self.config_override = config_override;
119        self
120    }
121    /// <p>The ARN (Amazon Resource Name) of the protected resource.</p>
122    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.resource_arn(input.into());
124        self
125    }
126    /// <p>The ARN (Amazon Resource Name) of the protected resource.</p>
127    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128        self.inner = self.inner.set_resource_arn(input);
129        self
130    }
131    /// <p>The ARN (Amazon Resource Name) of the protected resource.</p>
132    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
133        self.inner.get_resource_arn()
134    }
135    /// <p>Specifies the action setting that Shield Advanced should use in the WAF rules that it creates on behalf of the protected resource in response to DDoS attacks. You specify this as part of the configuration for the automatic application layer DDoS mitigation feature, when you enable or update automatic mitigation. Shield Advanced creates the WAF rules in a Shield Advanced-managed rule group, inside the web ACL that you have associated with the resource.</p>
136    pub fn action(mut self, input: crate::types::ResponseAction) -> Self {
137        self.inner = self.inner.action(input);
138        self
139    }
140    /// <p>Specifies the action setting that Shield Advanced should use in the WAF rules that it creates on behalf of the protected resource in response to DDoS attacks. You specify this as part of the configuration for the automatic application layer DDoS mitigation feature, when you enable or update automatic mitigation. Shield Advanced creates the WAF rules in a Shield Advanced-managed rule group, inside the web ACL that you have associated with the resource.</p>
141    pub fn set_action(mut self, input: ::std::option::Option<crate::types::ResponseAction>) -> Self {
142        self.inner = self.inner.set_action(input);
143        self
144    }
145    /// <p>Specifies the action setting that Shield Advanced should use in the WAF rules that it creates on behalf of the protected resource in response to DDoS attacks. You specify this as part of the configuration for the automatic application layer DDoS mitigation feature, when you enable or update automatic mitigation. Shield Advanced creates the WAF rules in a Shield Advanced-managed rule group, inside the web ACL that you have associated with the resource.</p>
146    pub fn get_action(&self) -> &::std::option::Option<crate::types::ResponseAction> {
147        self.inner.get_action()
148    }
149}