aws_sdk_timestreamquery/operation/create_scheduled_query/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_scheduled_query::_create_scheduled_query_output::CreateScheduledQueryOutputBuilder;
3
4pub use crate::operation::create_scheduled_query::_create_scheduled_query_input::CreateScheduledQueryInputBuilder;
5
6impl crate::operation::create_scheduled_query::builders::CreateScheduledQueryInputBuilder {
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_scheduled_query::CreateScheduledQueryOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_scheduled_query::CreateScheduledQueryError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_scheduled_query();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateScheduledQuery`.
24///
25/// <p>Create a scheduled query that will be run on your behalf at the configured schedule. Timestream assumes the execution role provided as part of the <code>ScheduledQueryExecutionRoleArn</code> parameter to run the query. You can use the <code>NotificationConfiguration</code> parameter to configure notification for your scheduled query operations.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateScheduledQueryFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_scheduled_query::builders::CreateScheduledQueryInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_scheduled_query::CreateScheduledQueryOutput,
35        crate::operation::create_scheduled_query::CreateScheduledQueryError,
36    > for CreateScheduledQueryFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::create_scheduled_query::CreateScheduledQueryOutput,
44            crate::operation::create_scheduled_query::CreateScheduledQueryError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateScheduledQueryFluentBuilder {
51    /// Creates a new `CreateScheduledQueryFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the CreateScheduledQuery as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_scheduled_query::builders::CreateScheduledQueryInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::create_scheduled_query::CreateScheduledQueryOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_scheduled_query::CreateScheduledQueryError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::create_scheduled_query::CreateScheduledQuery::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_scheduled_query::CreateScheduledQuery::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::create_scheduled_query::CreateScheduledQueryOutput,
97        crate::operation::create_scheduled_query::CreateScheduledQueryError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>Name of the scheduled query.</p>
112    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.name(input.into());
114        self
115    }
116    /// <p>Name of the scheduled query.</p>
117    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_name(input);
119        self
120    }
121    /// <p>Name of the scheduled query.</p>
122    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_name()
124    }
125    /// <p>The query string to run. Parameter names can be specified in the query string <code>@</code> character followed by an identifier. The named Parameter <code>@scheduled_runtime</code> is reserved and can be used in the query to get the time at which the query is scheduled to run.</p>
126    /// <p>The timestamp calculated according to the ScheduleConfiguration parameter, will be the value of <code>@scheduled_runtime</code> paramater for each query run. For example, consider an instance of a scheduled query executing on 2021-12-01 00:00:00. For this instance, the <code>@scheduled_runtime</code> parameter is initialized to the timestamp 2021-12-01 00:00:00 when invoking the query.</p>
127    pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.query_string(input.into());
129        self
130    }
131    /// <p>The query string to run. Parameter names can be specified in the query string <code>@</code> character followed by an identifier. The named Parameter <code>@scheduled_runtime</code> is reserved and can be used in the query to get the time at which the query is scheduled to run.</p>
132    /// <p>The timestamp calculated according to the ScheduleConfiguration parameter, will be the value of <code>@scheduled_runtime</code> paramater for each query run. For example, consider an instance of a scheduled query executing on 2021-12-01 00:00:00. For this instance, the <code>@scheduled_runtime</code> parameter is initialized to the timestamp 2021-12-01 00:00:00 when invoking the query.</p>
133    pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_query_string(input);
135        self
136    }
137    /// <p>The query string to run. Parameter names can be specified in the query string <code>@</code> character followed by an identifier. The named Parameter <code>@scheduled_runtime</code> is reserved and can be used in the query to get the time at which the query is scheduled to run.</p>
138    /// <p>The timestamp calculated according to the ScheduleConfiguration parameter, will be the value of <code>@scheduled_runtime</code> paramater for each query run. For example, consider an instance of a scheduled query executing on 2021-12-01 00:00:00. For this instance, the <code>@scheduled_runtime</code> parameter is initialized to the timestamp 2021-12-01 00:00:00 when invoking the query.</p>
139    pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_query_string()
141    }
142    /// <p>The schedule configuration for the query.</p>
143    pub fn schedule_configuration(mut self, input: crate::types::ScheduleConfiguration) -> Self {
144        self.inner = self.inner.schedule_configuration(input);
145        self
146    }
147    /// <p>The schedule configuration for the query.</p>
148    pub fn set_schedule_configuration(mut self, input: ::std::option::Option<crate::types::ScheduleConfiguration>) -> Self {
149        self.inner = self.inner.set_schedule_configuration(input);
150        self
151    }
152    /// <p>The schedule configuration for the query.</p>
153    pub fn get_schedule_configuration(&self) -> &::std::option::Option<crate::types::ScheduleConfiguration> {
154        self.inner.get_schedule_configuration()
155    }
156    /// <p>Notification configuration for the scheduled query. A notification is sent by Timestream when a query run finishes, when the state is updated or when you delete it.</p>
157    pub fn notification_configuration(mut self, input: crate::types::NotificationConfiguration) -> Self {
158        self.inner = self.inner.notification_configuration(input);
159        self
160    }
161    /// <p>Notification configuration for the scheduled query. A notification is sent by Timestream when a query run finishes, when the state is updated or when you delete it.</p>
162    pub fn set_notification_configuration(mut self, input: ::std::option::Option<crate::types::NotificationConfiguration>) -> Self {
163        self.inner = self.inner.set_notification_configuration(input);
164        self
165    }
166    /// <p>Notification configuration for the scheduled query. A notification is sent by Timestream when a query run finishes, when the state is updated or when you delete it.</p>
167    pub fn get_notification_configuration(&self) -> &::std::option::Option<crate::types::NotificationConfiguration> {
168        self.inner.get_notification_configuration()
169    }
170    /// <p>Configuration used for writing the result of a query.</p>
171    pub fn target_configuration(mut self, input: crate::types::TargetConfiguration) -> Self {
172        self.inner = self.inner.target_configuration(input);
173        self
174    }
175    /// <p>Configuration used for writing the result of a query.</p>
176    pub fn set_target_configuration(mut self, input: ::std::option::Option<crate::types::TargetConfiguration>) -> Self {
177        self.inner = self.inner.set_target_configuration(input);
178        self
179    }
180    /// <p>Configuration used for writing the result of a query.</p>
181    pub fn get_target_configuration(&self) -> &::std::option::Option<crate::types::TargetConfiguration> {
182        self.inner.get_target_configuration()
183    }
184    /// <p>Using a ClientToken makes the call to CreateScheduledQuery idempotent, in other words, making the same request repeatedly will produce the same result. Making multiple identical CreateScheduledQuery requests has the same effect as making a single request.</p>
185    /// <ul>
186    /// <li>
187    /// <p>If CreateScheduledQuery is called without a <code>ClientToken</code>, the Query SDK generates a <code>ClientToken</code> on your behalf.</p></li>
188    /// <li>
189    /// <p>After 8 hours, any request with the same <code>ClientToken</code> is treated as a new request.</p></li>
190    /// </ul>
191    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
192        self.inner = self.inner.client_token(input.into());
193        self
194    }
195    /// <p>Using a ClientToken makes the call to CreateScheduledQuery idempotent, in other words, making the same request repeatedly will produce the same result. Making multiple identical CreateScheduledQuery requests has the same effect as making a single request.</p>
196    /// <ul>
197    /// <li>
198    /// <p>If CreateScheduledQuery is called without a <code>ClientToken</code>, the Query SDK generates a <code>ClientToken</code> on your behalf.</p></li>
199    /// <li>
200    /// <p>After 8 hours, any request with the same <code>ClientToken</code> is treated as a new request.</p></li>
201    /// </ul>
202    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
203        self.inner = self.inner.set_client_token(input);
204        self
205    }
206    /// <p>Using a ClientToken makes the call to CreateScheduledQuery idempotent, in other words, making the same request repeatedly will produce the same result. Making multiple identical CreateScheduledQuery requests has the same effect as making a single request.</p>
207    /// <ul>
208    /// <li>
209    /// <p>If CreateScheduledQuery is called without a <code>ClientToken</code>, the Query SDK generates a <code>ClientToken</code> on your behalf.</p></li>
210    /// <li>
211    /// <p>After 8 hours, any request with the same <code>ClientToken</code> is treated as a new request.</p></li>
212    /// </ul>
213    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
214        self.inner.get_client_token()
215    }
216    /// <p>The ARN for the IAM role that Timestream will assume when running the scheduled query.</p>
217    pub fn scheduled_query_execution_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218        self.inner = self.inner.scheduled_query_execution_role_arn(input.into());
219        self
220    }
221    /// <p>The ARN for the IAM role that Timestream will assume when running the scheduled query.</p>
222    pub fn set_scheduled_query_execution_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223        self.inner = self.inner.set_scheduled_query_execution_role_arn(input);
224        self
225    }
226    /// <p>The ARN for the IAM role that Timestream will assume when running the scheduled query.</p>
227    pub fn get_scheduled_query_execution_role_arn(&self) -> &::std::option::Option<::std::string::String> {
228        self.inner.get_scheduled_query_execution_role_arn()
229    }
230    ///
231    /// Appends an item to `Tags`.
232    ///
233    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
234    ///
235    /// <p>A list of key-value pairs to label the scheduled query.</p>
236    pub fn tags(mut self, input: crate::types::Tag) -> Self {
237        self.inner = self.inner.tags(input);
238        self
239    }
240    /// <p>A list of key-value pairs to label the scheduled query.</p>
241    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
242        self.inner = self.inner.set_tags(input);
243        self
244    }
245    /// <p>A list of key-value pairs to label the scheduled query.</p>
246    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
247        self.inner.get_tags()
248    }
249    /// <p>The Amazon KMS key used to encrypt the scheduled query resource, at-rest. If the Amazon KMS key is not specified, the scheduled query resource will be encrypted with a Timestream owned Amazon KMS key. To specify a KMS key, use the key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix the name with <i>alias/</i></p>
250    /// <p>If ErrorReportConfiguration uses <code>SSE_KMS</code> as encryption type, the same KmsKeyId is used to encrypt the error report at rest.</p>
251    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
252        self.inner = self.inner.kms_key_id(input.into());
253        self
254    }
255    /// <p>The Amazon KMS key used to encrypt the scheduled query resource, at-rest. If the Amazon KMS key is not specified, the scheduled query resource will be encrypted with a Timestream owned Amazon KMS key. To specify a KMS key, use the key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix the name with <i>alias/</i></p>
256    /// <p>If ErrorReportConfiguration uses <code>SSE_KMS</code> as encryption type, the same KmsKeyId is used to encrypt the error report at rest.</p>
257    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
258        self.inner = self.inner.set_kms_key_id(input);
259        self
260    }
261    /// <p>The Amazon KMS key used to encrypt the scheduled query resource, at-rest. If the Amazon KMS key is not specified, the scheduled query resource will be encrypted with a Timestream owned Amazon KMS key. To specify a KMS key, use the key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix the name with <i>alias/</i></p>
262    /// <p>If ErrorReportConfiguration uses <code>SSE_KMS</code> as encryption type, the same KmsKeyId is used to encrypt the error report at rest.</p>
263    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
264        self.inner.get_kms_key_id()
265    }
266    /// <p>Configuration for error reporting. Error reports will be generated when a problem is encountered when writing the query results.</p>
267    pub fn error_report_configuration(mut self, input: crate::types::ErrorReportConfiguration) -> Self {
268        self.inner = self.inner.error_report_configuration(input);
269        self
270    }
271    /// <p>Configuration for error reporting. Error reports will be generated when a problem is encountered when writing the query results.</p>
272    pub fn set_error_report_configuration(mut self, input: ::std::option::Option<crate::types::ErrorReportConfiguration>) -> Self {
273        self.inner = self.inner.set_error_report_configuration(input);
274        self
275    }
276    /// <p>Configuration for error reporting. Error reports will be generated when a problem is encountered when writing the query results.</p>
277    pub fn get_error_report_configuration(&self) -> &::std::option::Option<crate::types::ErrorReportConfiguration> {
278        self.inner.get_error_report_configuration()
279    }
280}