aws_sdk_route53/operation/create_query_logging_config/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_query_logging_config::_create_query_logging_config_output::CreateQueryLoggingConfigOutputBuilder;
3
4pub use crate::operation::create_query_logging_config::_create_query_logging_config_input::CreateQueryLoggingConfigInputBuilder;
5
6impl crate::operation::create_query_logging_config::builders::CreateQueryLoggingConfigInputBuilder {
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_query_logging_config::CreateQueryLoggingConfigOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_query_logging_config::CreateQueryLoggingConfigError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_query_logging_config();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateQueryLoggingConfig`.
24///
25/// <p>Creates a configuration for DNS query logging. After you create a query logging configuration, Amazon Route 53 begins to publish log data to an Amazon CloudWatch Logs log group.</p>
26/// <p>DNS query logs contain information about the queries that Route 53 receives for a specified public hosted zone, such as the following:</p>
27/// <ul>
28/// <li>
29/// <p>Route 53 edge location that responded to the DNS query</p></li>
30/// <li>
31/// <p>Domain or subdomain that was requested</p></li>
32/// <li>
33/// <p>DNS record type, such as A or AAAA</p></li>
34/// <li>
35/// <p>DNS response code, such as <code>NoError</code> or <code>ServFail</code></p></li>
36/// </ul>
37/// <dl>
38/// <dt>
39/// Log Group and Resource Policy
40/// </dt>
41/// <dd>
42/// <p>Before you create a query logging configuration, perform the following operations.</p><note>
43/// <p>If you create a query logging configuration using the Route 53 console, Route 53 performs these operations automatically.</p>
44/// </note>
45/// <ol>
46/// <li>
47/// <p>Create a CloudWatch Logs log group, and make note of the ARN, which you specify when you create a query logging configuration. Note the following:</p>
48/// <ul>
49/// <li>
50/// <p>You must create the log group in the us-east-1 region.</p></li>
51/// <li>
52/// <p>You must use the same Amazon Web Services account to create the log group and the hosted zone that you want to configure query logging for.</p></li>
53/// <li>
54/// <p>When you create log groups for query logging, we recommend that you use a consistent prefix, for example:</p>
55/// <p><code>/aws/route53/<i>hosted zone name</i> </code></p>
56/// <p>In the next step, you'll create a resource policy, which controls access to one or more log groups and the associated Amazon Web Services resources, such as Route 53 hosted zones. There's a limit on the number of resource policies that you can create, so we recommend that you use a consistent prefix so you can use the same resource policy for all the log groups that you create for query logging.</p></li>
57/// </ul></li>
58/// <li>
59/// <p>Create a CloudWatch Logs resource policy, and give it the permissions that Route 53 needs to create log streams and to send query logs to log streams. You must create the CloudWatch Logs resource policy in the us-east-1 region. For the value of <code>Resource</code>, specify the ARN for the log group that you created in the previous step. To use the same resource policy for all the CloudWatch Logs log groups that you created for query logging configurations, replace the hosted zone name with <code>*</code>, for example:</p>
60/// <p><code>arn:aws:logs:us-east-1:123412341234:log-group:/aws/route53/*</code></p>
61/// <p>To avoid the confused deputy problem, a security issue where an entity without a permission for an action can coerce a more-privileged entity to perform it, you can optionally limit the permissions that a service has to a resource in a resource-based policy by supplying the following values:</p>
62/// <ul>
63/// <li>
64/// <p>For <code>aws:SourceArn</code>, supply the hosted zone ARN used in creating the query logging configuration. For example, <code>aws:SourceArn: arn:aws:route53:::hostedzone/hosted zone ID</code>.</p></li>
65/// <li>
66/// <p>For <code>aws:SourceAccount</code>, supply the account ID for the account that creates the query logging configuration. For example, <code>aws:SourceAccount:111111111111</code>.</p></li>
67/// </ul>
68/// <p>For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html">The confused deputy problem</a> in the <i>Amazon Web Services IAM User Guide</i>.</p><note>
69/// <p>You can't use the CloudWatch console to create or edit a resource policy. You must use the CloudWatch API, one of the Amazon Web Services SDKs, or the CLI.</p>
70/// </note></li>
71/// </ol>
72/// </dd>
73/// <dt>
74/// Log Streams and Edge Locations
75/// </dt>
76/// <dd>
77/// <p>When Route 53 finishes creating the configuration for DNS query logging, it does the following:</p>
78/// <ul>
79/// <li>
80/// <p>Creates a log stream for an edge location the first time that the edge location responds to DNS queries for the specified hosted zone. That log stream is used to log all queries that Route 53 responds to for that edge location.</p></li>
81/// <li>
82/// <p>Begins to send query logs to the applicable log stream.</p></li>
83/// </ul>
84/// <p>The name of each log stream is in the following format:</p>
85/// <p><code> <i>hosted zone ID</i>/<i>edge location code</i> </code></p>
86/// <p>The edge location code is a three-letter code and an arbitrarily assigned number, for example, DFW3. The three-letter code typically corresponds with the International Air Transport Association airport code for an airport near the edge location. (These abbreviations might change in the future.) For a list of edge locations, see "The Route 53 Global Network" on the <a href="http://aws.amazon.com/route53/details/">Route 53 Product Details</a> page.</p>
87/// </dd>
88/// <dt>
89/// Queries That Are Logged
90/// </dt>
91/// <dd>
92/// <p>Query logs contain only the queries that DNS resolvers forward to Route 53. If a DNS resolver has already cached the response to a query (such as the IP address for a load balancer for example.com), the resolver will continue to return the cached response. It doesn't forward another query to Route 53 until the TTL for the corresponding resource record set expires. Depending on how many DNS queries are submitted for a resource record set, and depending on the TTL for that resource record set, query logs might contain information about only one query out of every several thousand queries that are submitted to DNS. For more information about how DNS works, see <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/welcome-dns-service.html">Routing Internet Traffic to Your Website or Web Application</a> in the <i>Amazon Route 53 Developer Guide</i>.</p>
93/// </dd>
94/// <dt>
95/// Log File Format
96/// </dt>
97/// <dd>
98/// <p>For a list of the values in each query log and the format of each value, see <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html">Logging DNS Queries</a> in the <i>Amazon Route 53 Developer Guide</i>.</p>
99/// </dd>
100/// <dt>
101/// Pricing
102/// </dt>
103/// <dd>
104/// <p>For information about charges for query logs, see <a href="http://aws.amazon.com/cloudwatch/pricing/">Amazon CloudWatch Pricing</a>.</p>
105/// </dd>
106/// <dt>
107/// How to Stop Logging
108/// </dt>
109/// <dd>
110/// <p>If you want Route 53 to stop sending query logs to CloudWatch Logs, delete the query logging configuration. For more information, see <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_DeleteQueryLoggingConfig.html">DeleteQueryLoggingConfig</a>.</p>
111/// </dd>
112/// </dl>
113#[derive(::std::clone::Clone, ::std::fmt::Debug)]
114pub struct CreateQueryLoggingConfigFluentBuilder {
115    handle: ::std::sync::Arc<crate::client::Handle>,
116    inner: crate::operation::create_query_logging_config::builders::CreateQueryLoggingConfigInputBuilder,
117    config_override: ::std::option::Option<crate::config::Builder>,
118}
119impl
120    crate::client::customize::internal::CustomizableSend<
121        crate::operation::create_query_logging_config::CreateQueryLoggingConfigOutput,
122        crate::operation::create_query_logging_config::CreateQueryLoggingConfigError,
123    > for CreateQueryLoggingConfigFluentBuilder
124{
125    fn send(
126        self,
127        config_override: crate::config::Builder,
128    ) -> crate::client::customize::internal::BoxFuture<
129        crate::client::customize::internal::SendResult<
130            crate::operation::create_query_logging_config::CreateQueryLoggingConfigOutput,
131            crate::operation::create_query_logging_config::CreateQueryLoggingConfigError,
132        >,
133    > {
134        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
135    }
136}
137impl CreateQueryLoggingConfigFluentBuilder {
138    /// Creates a new `CreateQueryLoggingConfigFluentBuilder`.
139    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
140        Self {
141            handle,
142            inner: ::std::default::Default::default(),
143            config_override: ::std::option::Option::None,
144        }
145    }
146    /// Access the CreateQueryLoggingConfig as a reference.
147    pub fn as_input(&self) -> &crate::operation::create_query_logging_config::builders::CreateQueryLoggingConfigInputBuilder {
148        &self.inner
149    }
150    /// Sends the request and returns the response.
151    ///
152    /// If an error occurs, an `SdkError` will be returned with additional details that
153    /// can be matched against.
154    ///
155    /// By default, any retryable failures will be retried twice. Retry behavior
156    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
157    /// set when configuring the client.
158    pub async fn send(
159        self,
160    ) -> ::std::result::Result<
161        crate::operation::create_query_logging_config::CreateQueryLoggingConfigOutput,
162        ::aws_smithy_runtime_api::client::result::SdkError<
163            crate::operation::create_query_logging_config::CreateQueryLoggingConfigError,
164            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
165        >,
166    > {
167        let input = self
168            .inner
169            .build()
170            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
171        let runtime_plugins = crate::operation::create_query_logging_config::CreateQueryLoggingConfig::operation_runtime_plugins(
172            self.handle.runtime_plugins.clone(),
173            &self.handle.conf,
174            self.config_override,
175        );
176        crate::operation::create_query_logging_config::CreateQueryLoggingConfig::orchestrate(&runtime_plugins, input).await
177    }
178
179    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
180    pub fn customize(
181        self,
182    ) -> crate::client::customize::CustomizableOperation<
183        crate::operation::create_query_logging_config::CreateQueryLoggingConfigOutput,
184        crate::operation::create_query_logging_config::CreateQueryLoggingConfigError,
185        Self,
186    > {
187        crate::client::customize::CustomizableOperation::new(self)
188    }
189    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
190        self.set_config_override(::std::option::Option::Some(config_override.into()));
191        self
192    }
193
194    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
195        self.config_override = config_override;
196        self
197    }
198    /// <p>The ID of the hosted zone that you want to log queries for. You can log queries only for public hosted zones.</p>
199    pub fn hosted_zone_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
200        self.inner = self.inner.hosted_zone_id(input.into());
201        self
202    }
203    /// <p>The ID of the hosted zone that you want to log queries for. You can log queries only for public hosted zones.</p>
204    pub fn set_hosted_zone_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
205        self.inner = self.inner.set_hosted_zone_id(input);
206        self
207    }
208    /// <p>The ID of the hosted zone that you want to log queries for. You can log queries only for public hosted zones.</p>
209    pub fn get_hosted_zone_id(&self) -> &::std::option::Option<::std::string::String> {
210        self.inner.get_hosted_zone_id()
211    }
212    /// <p>The Amazon Resource Name (ARN) for the log group that you want to Amazon Route 53 to send query logs to. This is the format of the ARN:</p>
213    /// <p>arn:aws:logs:<i>region</i>:<i>account-id</i>:log-group:<i>log_group_name</i></p>
214    /// <p>To get the ARN for a log group, you can use the CloudWatch console, the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogGroups.html">DescribeLogGroups</a> API action, the <a href="https://docs.aws.amazon.com/cli/latest/reference/logs/describe-log-groups.html">describe-log-groups</a> command, or the applicable command in one of the Amazon Web Services SDKs.</p>
215    pub fn cloud_watch_logs_log_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
216        self.inner = self.inner.cloud_watch_logs_log_group_arn(input.into());
217        self
218    }
219    /// <p>The Amazon Resource Name (ARN) for the log group that you want to Amazon Route 53 to send query logs to. This is the format of the ARN:</p>
220    /// <p>arn:aws:logs:<i>region</i>:<i>account-id</i>:log-group:<i>log_group_name</i></p>
221    /// <p>To get the ARN for a log group, you can use the CloudWatch console, the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogGroups.html">DescribeLogGroups</a> API action, the <a href="https://docs.aws.amazon.com/cli/latest/reference/logs/describe-log-groups.html">describe-log-groups</a> command, or the applicable command in one of the Amazon Web Services SDKs.</p>
222    pub fn set_cloud_watch_logs_log_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223        self.inner = self.inner.set_cloud_watch_logs_log_group_arn(input);
224        self
225    }
226    /// <p>The Amazon Resource Name (ARN) for the log group that you want to Amazon Route 53 to send query logs to. This is the format of the ARN:</p>
227    /// <p>arn:aws:logs:<i>region</i>:<i>account-id</i>:log-group:<i>log_group_name</i></p>
228    /// <p>To get the ARN for a log group, you can use the CloudWatch console, the <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogGroups.html">DescribeLogGroups</a> API action, the <a href="https://docs.aws.amazon.com/cli/latest/reference/logs/describe-log-groups.html">describe-log-groups</a> command, or the applicable command in one of the Amazon Web Services SDKs.</p>
229    pub fn get_cloud_watch_logs_log_group_arn(&self) -> &::std::option::Option<::std::string::String> {
230        self.inner.get_cloud_watch_logs_log_group_arn()
231    }
232}