aws_sdk_cloudtrail/operation/start_import/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_import::_start_import_output::StartImportOutputBuilder;
3
4pub use crate::operation::start_import::_start_import_input::StartImportInputBuilder;
5
6impl crate::operation::start_import::builders::StartImportInputBuilder {
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_import::StartImportOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_import::StartImportError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_import();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartImport`.
24///
25/// <p>Starts an import of logged trail events from a source S3 bucket to a destination event data store. By default, CloudTrail only imports events contained in the S3 bucket's <code>CloudTrail</code> prefix and the prefixes inside the <code>CloudTrail</code> prefix, and does not check prefixes for other Amazon Web Services services. If you want to import CloudTrail events contained in another prefix, you must include the prefix in the <code>S3LocationUri</code>. For more considerations about importing trail events, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-copy-trail-to-lake.html#cloudtrail-trail-copy-considerations">Considerations for copying trail events</a> in the <i>CloudTrail User Guide</i>.</p>
26/// <p>When you start a new import, the <code>Destinations</code> and <code>ImportSource</code> parameters are required. Before starting a new import, disable any access control lists (ACLs) attached to the source S3 bucket. For more information about disabling ACLs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html">Controlling ownership of objects and disabling ACLs for your bucket</a>.</p>
27/// <p>When you retry an import, the <code>ImportID</code> parameter is required.</p><note>
28/// <p>If the destination event data store is for an organization, you must use the management account to import trail events. You cannot use the delegated administrator account for the organization.</p>
29/// </note>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct StartImportFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::start_import::builders::StartImportInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::start_import::StartImportOutput,
39        crate::operation::start_import::StartImportError,
40    > for StartImportFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::start_import::StartImportOutput,
48            crate::operation::start_import::StartImportError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl StartImportFluentBuilder {
55    /// Creates a new `StartImportFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the StartImport as a reference.
64    pub fn as_input(&self) -> &crate::operation::start_import::builders::StartImportInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::start_import::StartImportOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::start_import::StartImportError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::start_import::StartImport::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::start_import::StartImport::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::start_import::StartImportOutput,
101        crate::operation::start_import::StartImportError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    ///
116    /// Appends an item to `Destinations`.
117    ///
118    /// To override the contents of this collection use [`set_destinations`](Self::set_destinations).
119    ///
120    /// <p>The ARN of the destination event data store. Use this parameter for a new import.</p>
121    pub fn destinations(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.destinations(input.into());
123        self
124    }
125    /// <p>The ARN of the destination event data store. Use this parameter for a new import.</p>
126    pub fn set_destinations(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
127        self.inner = self.inner.set_destinations(input);
128        self
129    }
130    /// <p>The ARN of the destination event data store. Use this parameter for a new import.</p>
131    pub fn get_destinations(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
132        self.inner.get_destinations()
133    }
134    /// <p>The source S3 bucket for the import. Use this parameter for a new import.</p>
135    pub fn import_source(mut self, input: crate::types::ImportSource) -> Self {
136        self.inner = self.inner.import_source(input);
137        self
138    }
139    /// <p>The source S3 bucket for the import. Use this parameter for a new import.</p>
140    pub fn set_import_source(mut self, input: ::std::option::Option<crate::types::ImportSource>) -> Self {
141        self.inner = self.inner.set_import_source(input);
142        self
143    }
144    /// <p>The source S3 bucket for the import. Use this parameter for a new import.</p>
145    pub fn get_import_source(&self) -> &::std::option::Option<crate::types::ImportSource> {
146        self.inner.get_import_source()
147    }
148    /// <p>Use with <code>EndEventTime</code> to bound a <code>StartImport</code> request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified <code>StartEventTime</code> and <code>EndEventTime</code> before attempting to import events.</p>
149    pub fn start_event_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
150        self.inner = self.inner.start_event_time(input);
151        self
152    }
153    /// <p>Use with <code>EndEventTime</code> to bound a <code>StartImport</code> request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified <code>StartEventTime</code> and <code>EndEventTime</code> before attempting to import events.</p>
154    pub fn set_start_event_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
155        self.inner = self.inner.set_start_event_time(input);
156        self
157    }
158    /// <p>Use with <code>EndEventTime</code> to bound a <code>StartImport</code> request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified <code>StartEventTime</code> and <code>EndEventTime</code> before attempting to import events.</p>
159    pub fn get_start_event_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
160        self.inner.get_start_event_time()
161    }
162    /// <p>Use with <code>StartEventTime</code> to bound a <code>StartImport</code> request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified <code>StartEventTime</code> and <code>EndEventTime</code> before attempting to import events.</p>
163    pub fn end_event_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
164        self.inner = self.inner.end_event_time(input);
165        self
166    }
167    /// <p>Use with <code>StartEventTime</code> to bound a <code>StartImport</code> request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified <code>StartEventTime</code> and <code>EndEventTime</code> before attempting to import events.</p>
168    pub fn set_end_event_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
169        self.inner = self.inner.set_end_event_time(input);
170        self
171    }
172    /// <p>Use with <code>StartEventTime</code> to bound a <code>StartImport</code> request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified <code>StartEventTime</code> and <code>EndEventTime</code> before attempting to import events.</p>
173    pub fn get_end_event_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
174        self.inner.get_end_event_time()
175    }
176    /// <p>The ID of the import. Use this parameter when you are retrying an import.</p>
177    pub fn import_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178        self.inner = self.inner.import_id(input.into());
179        self
180    }
181    /// <p>The ID of the import. Use this parameter when you are retrying an import.</p>
182    pub fn set_import_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.inner = self.inner.set_import_id(input);
184        self
185    }
186    /// <p>The ID of the import. Use this parameter when you are retrying an import.</p>
187    pub fn get_import_id(&self) -> &::std::option::Option<::std::string::String> {
188        self.inner.get_import_id()
189    }
190}