aws_sdk_cloudwatchlogs/operation/create_export_task/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_export_task::_create_export_task_output::CreateExportTaskOutputBuilder;
3
4pub use crate::operation::create_export_task::_create_export_task_input::CreateExportTaskInputBuilder;
5
6impl crate::operation::create_export_task::builders::CreateExportTaskInputBuilder {
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_export_task::CreateExportTaskOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_export_task::CreateExportTaskError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_export_task();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateExportTask`.
24///
25/// <p>Creates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket. When you perform a <code>CreateExportTask</code> operation, you must use credentials that have permission to write to the S3 bucket that you specify as the destination.</p>
26/// <p>Exporting log data to S3 buckets that are encrypted by KMS is supported. Exporting log data to Amazon S3 buckets that have S3 Object Lock enabled with a retention period is also supported.</p>
27/// <p>Exporting to S3 buckets that are encrypted with AES-256 is supported.</p>
28/// <p>This is an asynchronous call. If all the required information is provided, this operation initiates an export task and responds with the ID of the task. After the task has started, you can use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeExportTasks.html">DescribeExportTasks</a> to get the status of the export task. Each account can only have one active (<code>RUNNING</code> or <code>PENDING</code>) export task at a time. To cancel an export task, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CancelExportTask.html">CancelExportTask</a>.</p>
29/// <p>You can export logs from multiple log groups or multiple time ranges to the same S3 bucket. To separate log data for each export task, specify a prefix to be used as the Amazon S3 key prefix for all exported objects.</p><note>
30/// <p>We recommend that you don't regularly export to Amazon S3 as a way to continuously archive your logs. For that use case, we instead recommend that you use subscriptions. For more information about subscriptions, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Subscriptions.html">Real-time processing of log data with subscriptions</a>.</p>
31/// </note> <note>
32/// <p>Time-based sorting on chunks of log data inside an exported file is not guaranteed. You can sort the exported log field data by using Linux utilities.</p>
33/// </note>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct CreateExportTaskFluentBuilder {
36 handle: ::std::sync::Arc<crate::client::Handle>,
37 inner: crate::operation::create_export_task::builders::CreateExportTaskInputBuilder,
38 config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl
41 crate::client::customize::internal::CustomizableSend<
42 crate::operation::create_export_task::CreateExportTaskOutput,
43 crate::operation::create_export_task::CreateExportTaskError,
44 > for CreateExportTaskFluentBuilder
45{
46 fn send(
47 self,
48 config_override: crate::config::Builder,
49 ) -> crate::client::customize::internal::BoxFuture<
50 crate::client::customize::internal::SendResult<
51 crate::operation::create_export_task::CreateExportTaskOutput,
52 crate::operation::create_export_task::CreateExportTaskError,
53 >,
54 > {
55 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56 }
57}
58impl CreateExportTaskFluentBuilder {
59 /// Creates a new `CreateExportTaskFluentBuilder`.
60 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61 Self {
62 handle,
63 inner: ::std::default::Default::default(),
64 config_override: ::std::option::Option::None,
65 }
66 }
67 /// Access the CreateExportTask as a reference.
68 pub fn as_input(&self) -> &crate::operation::create_export_task::builders::CreateExportTaskInputBuilder {
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::create_export_task::CreateExportTaskOutput,
83 ::aws_smithy_runtime_api::client::result::SdkError<
84 crate::operation::create_export_task::CreateExportTaskError,
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 = crate::operation::create_export_task::CreateExportTask::operation_runtime_plugins(
93 self.handle.runtime_plugins.clone(),
94 &self.handle.conf,
95 self.config_override,
96 );
97 crate::operation::create_export_task::CreateExportTask::orchestrate(&runtime_plugins, input).await
98 }
99
100 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101 pub fn customize(
102 self,
103 ) -> crate::client::customize::CustomizableOperation<
104 crate::operation::create_export_task::CreateExportTaskOutput,
105 crate::operation::create_export_task::CreateExportTaskError,
106 Self,
107 > {
108 crate::client::customize::CustomizableOperation::new(self)
109 }
110 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111 self.set_config_override(::std::option::Option::Some(config_override.into()));
112 self
113 }
114
115 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116 self.config_override = config_override;
117 self
118 }
119 /// <p>The name of the export task.</p>
120 pub fn task_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121 self.inner = self.inner.task_name(input.into());
122 self
123 }
124 /// <p>The name of the export task.</p>
125 pub fn set_task_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126 self.inner = self.inner.set_task_name(input);
127 self
128 }
129 /// <p>The name of the export task.</p>
130 pub fn get_task_name(&self) -> &::std::option::Option<::std::string::String> {
131 self.inner.get_task_name()
132 }
133 /// <p>The name of the log group.</p>
134 pub fn log_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135 self.inner = self.inner.log_group_name(input.into());
136 self
137 }
138 /// <p>The name of the log group.</p>
139 pub fn set_log_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140 self.inner = self.inner.set_log_group_name(input);
141 self
142 }
143 /// <p>The name of the log group.</p>
144 pub fn get_log_group_name(&self) -> &::std::option::Option<::std::string::String> {
145 self.inner.get_log_group_name()
146 }
147 /// <p>Export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied.</p>
148 pub fn log_stream_name_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149 self.inner = self.inner.log_stream_name_prefix(input.into());
150 self
151 }
152 /// <p>Export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied.</p>
153 pub fn set_log_stream_name_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154 self.inner = self.inner.set_log_stream_name_prefix(input);
155 self
156 }
157 /// <p>Export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied.</p>
158 pub fn get_log_stream_name_prefix(&self) -> &::std::option::Option<::std::string::String> {
159 self.inner.get_log_stream_name_prefix()
160 }
161 /// <p>The start time of the range for the request, expressed as the number of milliseconds after <code>Jan 1, 1970 00:00:00 UTC</code>. Events with a timestamp earlier than this time are not exported.</p>
162 pub fn from(mut self, input: i64) -> Self {
163 self.inner = self.inner.from(input);
164 self
165 }
166 /// <p>The start time of the range for the request, expressed as the number of milliseconds after <code>Jan 1, 1970 00:00:00 UTC</code>. Events with a timestamp earlier than this time are not exported.</p>
167 pub fn set_from(mut self, input: ::std::option::Option<i64>) -> Self {
168 self.inner = self.inner.set_from(input);
169 self
170 }
171 /// <p>The start time of the range for the request, expressed as the number of milliseconds after <code>Jan 1, 1970 00:00:00 UTC</code>. Events with a timestamp earlier than this time are not exported.</p>
172 pub fn get_from(&self) -> &::std::option::Option<i64> {
173 self.inner.get_from()
174 }
175 /// <p>The end time of the range for the request, expressed as the number of milliseconds after <code>Jan 1, 1970 00:00:00 UTC</code>. Events with a timestamp later than this time are not exported.</p>
176 /// <p>You must specify a time that is not earlier than when this log group was created.</p>
177 pub fn to(mut self, input: i64) -> Self {
178 self.inner = self.inner.to(input);
179 self
180 }
181 /// <p>The end time of the range for the request, expressed as the number of milliseconds after <code>Jan 1, 1970 00:00:00 UTC</code>. Events with a timestamp later than this time are not exported.</p>
182 /// <p>You must specify a time that is not earlier than when this log group was created.</p>
183 pub fn set_to(mut self, input: ::std::option::Option<i64>) -> Self {
184 self.inner = self.inner.set_to(input);
185 self
186 }
187 /// <p>The end time of the range for the request, expressed as the number of milliseconds after <code>Jan 1, 1970 00:00:00 UTC</code>. Events with a timestamp later than this time are not exported.</p>
188 /// <p>You must specify a time that is not earlier than when this log group was created.</p>
189 pub fn get_to(&self) -> &::std::option::Option<i64> {
190 self.inner.get_to()
191 }
192 /// <p>The name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services Region.</p>
193 pub fn destination(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194 self.inner = self.inner.destination(input.into());
195 self
196 }
197 /// <p>The name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services Region.</p>
198 pub fn set_destination(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199 self.inner = self.inner.set_destination(input);
200 self
201 }
202 /// <p>The name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services Region.</p>
203 pub fn get_destination(&self) -> &::std::option::Option<::std::string::String> {
204 self.inner.get_destination()
205 }
206 /// <p>The prefix used as the start of the key for every object exported. If you don't specify a value, the default is <code>exportedlogs</code>.</p>
207 /// <p>The length of this parameter must comply with the S3 object key name length limits. The object key name is a sequence of Unicode characters with UTF-8 encoding, and can be up to 1,024 bytes.</p>
208 pub fn destination_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209 self.inner = self.inner.destination_prefix(input.into());
210 self
211 }
212 /// <p>The prefix used as the start of the key for every object exported. If you don't specify a value, the default is <code>exportedlogs</code>.</p>
213 /// <p>The length of this parameter must comply with the S3 object key name length limits. The object key name is a sequence of Unicode characters with UTF-8 encoding, and can be up to 1,024 bytes.</p>
214 pub fn set_destination_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
215 self.inner = self.inner.set_destination_prefix(input);
216 self
217 }
218 /// <p>The prefix used as the start of the key for every object exported. If you don't specify a value, the default is <code>exportedlogs</code>.</p>
219 /// <p>The length of this parameter must comply with the S3 object key name length limits. The object key name is a sequence of Unicode characters with UTF-8 encoding, and can be up to 1,024 bytes.</p>
220 pub fn get_destination_prefix(&self) -> &::std::option::Option<::std::string::String> {
221 self.inner.get_destination_prefix()
222 }
223}