aws_sdk_cloudwatchlogs/operation/start_query/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_query::_start_query_output::StartQueryOutputBuilder;
3
4pub use crate::operation::start_query::_start_query_input::StartQueryInputBuilder;
5
6impl crate::operation::start_query::builders::StartQueryInputBuilder {
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::start_query::StartQueryOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::start_query::StartQueryError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.start_query();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `StartQuery`.
24///
25/// <p>Starts a query of one or more log groups or data sources using CloudWatch Logs Insights. You specify the log groups or data sources and time range to query and the query string to use. You can query up to 10 data sources in a single query.</p>
26/// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html">CloudWatch Logs Insights Query Syntax</a>.</p>
27/// <p>After you run a query using <code>StartQuery</code>, the query results are stored by CloudWatch Logs. You can use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html">GetQueryResults</a> to retrieve the results of a query, using the <code>queryId</code> that <code>StartQuery</code> returns.</p>
28/// <p>Interactive queries started with <code>StartQuery</code> share concurrency limits with automated scheduled query executions. Both types of queries count toward the same regional concurrent query quota, so high scheduled query activity may affect the availability of concurrent slots for interactive queries.</p><note>
29/// <p>To specify the log groups to query, a <code>StartQuery</code> operation must include one of the following:</p>
30/// <ul>
31/// <li>
32/// <p>Either exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code></p></li>
33/// <li>
34/// <p>Or the <code>queryString</code> must include a <code>SOURCE</code> command to select log groups for the query. The <code>SOURCE</code> command can select log groups based on log group name prefix, account ID, and log class, or select data sources using dataSource syntax in LogsQL, PPL, and SQL.</p>
35/// <p>For more information about the <code>SOURCE</code> command, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax-Source.html">SOURCE</a>.</p></li>
36/// </ul>
37/// </note>
38/// <p>If you have associated a KMS key with the query results in this account, then <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html">StartQuery</a> uses that key to encrypt the results when it stores them. If no key is associated with query results, the query results are encrypted with the default CloudWatch Logs encryption method.</p>
39/// <p>Queries time out after 60 minutes of runtime. If your queries are timing out, reduce the time range being searched or partition your query into a number of queries.</p>
40/// <p>If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account to start a query in a linked source account. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html">CloudWatch cross-account observability</a>. For a cross-account <code>StartQuery</code> operation, the query definition must be defined in the monitoring account.</p>
41/// <p>You can have up to 30 concurrent CloudWatch Logs insights queries, including queries that have been added to dashboards.</p>
42#[derive(::std::clone::Clone, ::std::fmt::Debug)]
43pub struct StartQueryFluentBuilder {
44 handle: ::std::sync::Arc<crate::client::Handle>,
45 inner: crate::operation::start_query::builders::StartQueryInputBuilder,
46 config_override: ::std::option::Option<crate::config::Builder>,
47}
48impl
49 crate::client::customize::internal::CustomizableSend<
50 crate::operation::start_query::StartQueryOutput,
51 crate::operation::start_query::StartQueryError,
52 > for StartQueryFluentBuilder
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::start_query::StartQueryOutput,
60 crate::operation::start_query::StartQueryError,
61 >,
62 > {
63 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
64 }
65}
66impl StartQueryFluentBuilder {
67 /// Creates a new `StartQueryFluentBuilder`.
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 StartQuery as a reference.
76 pub fn as_input(&self) -> &crate::operation::start_query::builders::StartQueryInputBuilder {
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::start_query::StartQueryOutput,
91 ::aws_smithy_runtime_api::client::result::SdkError<
92 crate::operation::start_query::StartQueryError,
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::start_query::StartQuery::operation_runtime_plugins(
101 self.handle.runtime_plugins.clone(),
102 &self.handle.conf,
103 self.config_override,
104 );
105 crate::operation::start_query::StartQuery::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::start_query::StartQueryOutput,
113 crate::operation::start_query::StartQueryError,
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>Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL, and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html">Supported query languages</a>.</p>
128 pub fn query_language(mut self, input: crate::types::QueryLanguage) -> Self {
129 self.inner = self.inner.query_language(input);
130 self
131 }
132 /// <p>Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL, and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html">Supported query languages</a>.</p>
133 pub fn set_query_language(mut self, input: ::std::option::Option<crate::types::QueryLanguage>) -> Self {
134 self.inner = self.inner.set_query_language(input);
135 self
136 }
137 /// <p>Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL, and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html">Supported query languages</a>.</p>
138 pub fn get_query_language(&self) -> &::std::option::Option<crate::types::QueryLanguage> {
139 self.inner.get_query_language()
140 }
141 /// <p>The log group on which to perform the query.</p><note>
142 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
143 /// </note>
144 pub fn log_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145 self.inner = self.inner.log_group_name(input.into());
146 self
147 }
148 /// <p>The log group on which to perform the query.</p><note>
149 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
150 /// </note>
151 pub fn set_log_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_log_group_name(input);
153 self
154 }
155 /// <p>The log group on which to perform the query.</p><note>
156 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
157 /// </note>
158 pub fn get_log_group_name(&self) -> &::std::option::Option<::std::string::String> {
159 self.inner.get_log_group_name()
160 }
161 ///
162 /// Appends an item to `logGroupNames`.
163 ///
164 /// To override the contents of this collection use [`set_log_group_names`](Self::set_log_group_names).
165 ///
166 /// <p>The list of log groups to be queried. You can include up to 50 log groups.</p><note>
167 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
168 /// </note>
169 pub fn log_group_names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.log_group_names(input.into());
171 self
172 }
173 /// <p>The list of log groups to be queried. You can include up to 50 log groups.</p><note>
174 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
175 /// </note>
176 pub fn set_log_group_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
177 self.inner = self.inner.set_log_group_names(input);
178 self
179 }
180 /// <p>The list of log groups to be queried. You can include up to 50 log groups.</p><note>
181 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
182 /// </note>
183 pub fn get_log_group_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
184 self.inner.get_log_group_names()
185 }
186 ///
187 /// Appends an item to `logGroupIdentifiers`.
188 ///
189 /// To override the contents of this collection use [`set_log_group_identifiers`](Self::set_log_group_identifiers).
190 ///
191 /// <p>The list of log groups to query. You can include up to 50 log groups.</p>
192 /// <p>You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also be defined in the monitoring account.</p>
193 /// <p>If you specify an ARN, use the format arn:aws:logs:<i>region</i>:<i>account-id</i>:log-group:<i>log_group_name</i> Don't include an * at the end.</p>
194 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
195 pub fn log_group_identifiers(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
196 self.inner = self.inner.log_group_identifiers(input.into());
197 self
198 }
199 /// <p>The list of log groups to query. You can include up to 50 log groups.</p>
200 /// <p>You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also be defined in the monitoring account.</p>
201 /// <p>If you specify an ARN, use the format arn:aws:logs:<i>region</i>:<i>account-id</i>:log-group:<i>log_group_name</i> Don't include an * at the end.</p>
202 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
203 pub fn set_log_group_identifiers(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
204 self.inner = self.inner.set_log_group_identifiers(input);
205 self
206 }
207 /// <p>The list of log groups to query. You can include up to 50 log groups.</p>
208 /// <p>You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also be defined in the monitoring account.</p>
209 /// <p>If you specify an ARN, use the format arn:aws:logs:<i>region</i>:<i>account-id</i>:log-group:<i>log_group_name</i> Don't include an * at the end.</p>
210 /// <p>A <code>StartQuery</code> operation must include exactly one of the following parameters: <code>logGroupName</code>, <code>logGroupNames</code>, or <code>logGroupIdentifiers</code>. The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the <code>querystring</code> instead of here.</p>
211 pub fn get_log_group_identifiers(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
212 self.inner.get_log_group_identifiers()
213 }
214 /// <p>The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
215 pub fn start_time(mut self, input: i64) -> Self {
216 self.inner = self.inner.start_time(input);
217 self
218 }
219 /// <p>The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
220 pub fn set_start_time(mut self, input: ::std::option::Option<i64>) -> Self {
221 self.inner = self.inner.set_start_time(input);
222 self
223 }
224 /// <p>The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
225 pub fn get_start_time(&self) -> &::std::option::Option<i64> {
226 self.inner.get_start_time()
227 }
228 /// <p>The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
229 pub fn end_time(mut self, input: i64) -> Self {
230 self.inner = self.inner.end_time(input);
231 self
232 }
233 /// <p>The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
234 pub fn set_end_time(mut self, input: ::std::option::Option<i64>) -> Self {
235 self.inner = self.inner.set_end_time(input);
236 self
237 }
238 /// <p>The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since <code>January 1, 1970, 00:00:00 UTC</code>.</p>
239 pub fn get_end_time(&self) -> &::std::option::Option<i64> {
240 self.inner.get_end_time()
241 }
242 /// <p>The query string to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html">CloudWatch Logs Insights Query Syntax</a>.</p>
243 pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
244 self.inner = self.inner.query_string(input.into());
245 self
246 }
247 /// <p>The query string to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html">CloudWatch Logs Insights Query Syntax</a>.</p>
248 pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
249 self.inner = self.inner.set_query_string(input);
250 self
251 }
252 /// <p>The query string to use. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html">CloudWatch Logs Insights Query Syntax</a>.</p>
253 pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
254 self.inner.get_query_string()
255 }
256 /// <p>The maximum number of log events to return in the query. If the query string uses the <code>fields</code> command, only the specified fields and their values are returned. The default is 10,000.</p>
257 pub fn limit(mut self, input: i32) -> Self {
258 self.inner = self.inner.limit(input);
259 self
260 }
261 /// <p>The maximum number of log events to return in the query. If the query string uses the <code>fields</code> command, only the specified fields and their values are returned. The default is 10,000.</p>
262 pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
263 self.inner = self.inner.set_limit(input);
264 self
265 }
266 /// <p>The maximum number of log events to return in the query. If the query string uses the <code>fields</code> command, only the specified fields and their values are returned. The default is 10,000.</p>
267 pub fn get_limit(&self) -> &::std::option::Option<i32> {
268 self.inner.get_limit()
269 }
270}