aws_sdk_wafv2/operation/put_logging_configuration/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_logging_configuration::_put_logging_configuration_output::PutLoggingConfigurationOutputBuilder;
3
4pub use crate::operation::put_logging_configuration::_put_logging_configuration_input::PutLoggingConfigurationInputBuilder;
5
6impl crate::operation::put_logging_configuration::builders::PutLoggingConfigurationInputBuilder {
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::put_logging_configuration::PutLoggingConfigurationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_logging_configuration::PutLoggingConfigurationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_logging_configuration();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutLoggingConfiguration`.
24///
25/// <p>Enables the specified <code>LoggingConfiguration</code>, to start logging from a web ACL, according to the configuration provided.</p>
26/// <p>If you configure data protection for the web ACL, the protection applies to the data that WAF sends to the logs.</p><note>
27/// <p>This operation completely replaces any mutable specifications that you already have for a logging configuration with the ones that you provide to this call.</p>
28/// <p>To modify an existing logging configuration, do the following:</p>
29/// <ol>
30/// <li>
31/// <p>Retrieve it by calling <code>GetLoggingConfiguration</code></p></li>
32/// <li>
33/// <p>Update its settings as needed</p></li>
34/// <li>
35/// <p>Provide the complete logging configuration specification to this call</p></li>
36/// </ol>
37/// </note> <note>
38/// <p>You can define one logging destination per web ACL.</p>
39/// </note>
40/// <p>You can access information about the traffic that WAF inspects using the following steps:</p>
41/// <ol>
42/// <li>
43/// <p>Create your logging destination. You can use an Amazon CloudWatch Logs log group, an Amazon Simple Storage Service (Amazon S3) bucket, or an Amazon Kinesis Data Firehose.</p>
44/// <p>The name that you give the destination must start with <code>aws-waf-logs-</code>. Depending on the type of destination, you might need to configure additional settings or permissions.</p>
45/// <p>For configuration requirements and pricing information for each destination type, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/logging.html">Logging web ACL traffic</a> in the <i>WAF Developer Guide</i>.</p></li>
46/// <li>
47/// <p>Associate your logging destination to your web ACL using a <code>PutLoggingConfiguration</code> request.</p></li>
48/// </ol>
49/// <p>When you successfully enable logging using a <code>PutLoggingConfiguration</code> request, WAF creates an additional role or policy that is required to write logs to the logging destination. For an Amazon CloudWatch Logs log group, WAF creates a resource policy on the log group. For an Amazon S3 bucket, WAF creates a bucket policy. For an Amazon Kinesis Data Firehose, WAF creates a service-linked role.</p>
50/// <p>For additional information about web ACL logging, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/logging.html">Logging web ACL traffic information</a> in the <i>WAF Developer Guide</i>.</p>
51#[derive(::std::clone::Clone, ::std::fmt::Debug)]
52pub struct PutLoggingConfigurationFluentBuilder {
53    handle: ::std::sync::Arc<crate::client::Handle>,
54    inner: crate::operation::put_logging_configuration::builders::PutLoggingConfigurationInputBuilder,
55    config_override: ::std::option::Option<crate::config::Builder>,
56}
57impl
58    crate::client::customize::internal::CustomizableSend<
59        crate::operation::put_logging_configuration::PutLoggingConfigurationOutput,
60        crate::operation::put_logging_configuration::PutLoggingConfigurationError,
61    > for PutLoggingConfigurationFluentBuilder
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::put_logging_configuration::PutLoggingConfigurationOutput,
69            crate::operation::put_logging_configuration::PutLoggingConfigurationError,
70        >,
71    > {
72        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
73    }
74}
75impl PutLoggingConfigurationFluentBuilder {
76    /// Creates a new `PutLoggingConfigurationFluentBuilder`.
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 PutLoggingConfiguration as a reference.
85    pub fn as_input(&self) -> &crate::operation::put_logging_configuration::builders::PutLoggingConfigurationInputBuilder {
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::put_logging_configuration::PutLoggingConfigurationOutput,
100        ::aws_smithy_runtime_api::client::result::SdkError<
101            crate::operation::put_logging_configuration::PutLoggingConfigurationError,
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::put_logging_configuration::PutLoggingConfiguration::operation_runtime_plugins(
110            self.handle.runtime_plugins.clone(),
111            &self.handle.conf,
112            self.config_override,
113        );
114        crate::operation::put_logging_configuration::PutLoggingConfiguration::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::put_logging_configuration::PutLoggingConfigurationOutput,
122        crate::operation::put_logging_configuration::PutLoggingConfigurationError,
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></p>
137    pub fn logging_configuration(mut self, input: crate::types::LoggingConfiguration) -> Self {
138        self.inner = self.inner.logging_configuration(input);
139        self
140    }
141    /// <p></p>
142    pub fn set_logging_configuration(mut self, input: ::std::option::Option<crate::types::LoggingConfiguration>) -> Self {
143        self.inner = self.inner.set_logging_configuration(input);
144        self
145    }
146    /// <p></p>
147    pub fn get_logging_configuration(&self) -> &::std::option::Option<crate::types::LoggingConfiguration> {
148        self.inner.get_logging_configuration()
149    }
150}