Skip to main content

aws_sdk_cloudwatchlogs/operation/create_import_task/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_import_task::_create_import_task_input::CreateImportTaskInputBuilder;
3
4pub use crate::operation::create_import_task::_create_import_task_output::CreateImportTaskOutputBuilder;
5
6impl crate::operation::create_import_task::builders::CreateImportTaskInputBuilder {
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_import_task::CreateImportTaskOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_import_task::CreateImportTaskError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_import_task();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateImportTask`.
24///
25/// <p>Starts an import from a data source to CloudWatch Log and creates a managed log group as the destination for the imported data. Currently, <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-event-data-store.html">CloudTrail Event Data Store</a> is the only supported data source.</p>
26/// <p>The import task must satisfy the following constraints:</p>
27/// <ul>
28/// <li>
29/// <p>The specified source must be in an ACTIVE state.</p></li>
30/// <li>
31/// <p>The API caller must have permissions to access the data in the provided source and to perform iam:PassRole on the provided import role which has the same permissions, as described below.</p></li>
32/// <li>
33/// <p>The provided IAM role must trust the "cloudtrail.amazonaws.com" principal and have the following permissions:</p>
34/// <ul>
35/// <li>
36/// <p>cloudtrail:GetEventDataStoreData</p></li>
37/// <li>
38/// <p>logs:CreateLogGroup</p></li>
39/// <li>
40/// <p>logs:CreateLogStream</p></li>
41/// <li>
42/// <p>logs:PutResourcePolicy</p></li>
43/// <li>
44/// <p>(If source has an associated Amazon Web Services KMS Key) kms:Decrypt</p></li>
45/// <li>
46/// <p>(If source has an associated Amazon Web Services KMS Key) kms:GenerateDataKey</p></li>
47/// </ul>
48/// <p>Example IAM policy for provided import role:</p>
49/// <p><code>\[ { "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::123456789012:role/apiCallerCredentials", "Condition": { "StringLike": { "iam:AssociatedResourceARN": "arn:aws:logs:us-east-1:123456789012:log-group:aws/cloudtrail/f1d45bff-d0e3-4868-b5d9-2eb678aa32fb:*" } } }, { "Effect": "Allow", "Action": \[ "cloudtrail:GetEventDataStoreData" \], "Resource": \[ "arn:aws:cloudtrail:us-east-1:123456789012:eventdatastore/f1d45bff-d0e3-4868-b5d9-2eb678aa32fb" \] }, { "Effect": "Allow", "Action": \[ "logs:CreateImportTask", "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutResourcePolicy" \], "Resource": \[ "arn:aws:logs:us-east-1:123456789012:log-group:/aws/cloudtrail/*" \] }, { "Effect": "Allow", "Action": \[ "kms:Decrypt", "kms:GenerateDataKey" \], "Resource": \[ "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" \] } \]</code></p></li>
50/// <li>
51/// <p>If the import source has a customer managed key, the "cloudtrail.amazonaws.com" principal needs permissions to perform kms:Decrypt and kms:GenerateDataKey.</p></li>
52/// <li>
53/// <p>There can be no more than 3 active imports per account at a given time.</p></li>
54/// <li>
55/// <p>The startEventTime must be less than or equal to endEventTime.</p></li>
56/// <li>
57/// <p>The data being imported must be within the specified source's retention period.</p></li>
58/// </ul>
59#[derive(::std::clone::Clone, ::std::fmt::Debug)]
60pub struct CreateImportTaskFluentBuilder {
61    handle: ::std::sync::Arc<crate::client::Handle>,
62    inner: crate::operation::create_import_task::builders::CreateImportTaskInputBuilder,
63    config_override: ::std::option::Option<crate::config::Builder>,
64}
65impl
66    crate::client::customize::internal::CustomizableSend<
67        crate::operation::create_import_task::CreateImportTaskOutput,
68        crate::operation::create_import_task::CreateImportTaskError,
69    > for CreateImportTaskFluentBuilder
70{
71    fn send(
72        self,
73        config_override: crate::config::Builder,
74    ) -> crate::client::customize::internal::BoxFuture<
75        crate::client::customize::internal::SendResult<
76            crate::operation::create_import_task::CreateImportTaskOutput,
77            crate::operation::create_import_task::CreateImportTaskError,
78        >,
79    > {
80        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
81    }
82}
83impl CreateImportTaskFluentBuilder {
84    /// Creates a new `CreateImportTaskFluentBuilder`.
85    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
86        Self {
87            handle,
88            inner: ::std::default::Default::default(),
89            config_override: ::std::option::Option::None,
90        }
91    }
92    /// Access the CreateImportTask as a reference.
93    pub fn as_input(&self) -> &crate::operation::create_import_task::builders::CreateImportTaskInputBuilder {
94        &self.inner
95    }
96    /// Sends the request and returns the response.
97    ///
98    /// If an error occurs, an `SdkError` will be returned with additional details that
99    /// can be matched against.
100    ///
101    /// By default, any retryable failures will be retried twice. Retry behavior
102    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
103    /// set when configuring the client.
104    pub async fn send(
105        self,
106    ) -> ::std::result::Result<
107        crate::operation::create_import_task::CreateImportTaskOutput,
108        ::aws_smithy_runtime_api::client::result::SdkError<
109            crate::operation::create_import_task::CreateImportTaskError,
110            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
111        >,
112    > {
113        let input = self
114            .inner
115            .build()
116            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
117        let runtime_plugins = crate::operation::create_import_task::CreateImportTask::operation_runtime_plugins(
118            self.handle.runtime_plugins.clone(),
119            &self.handle.conf,
120            self.config_override,
121        );
122        crate::operation::create_import_task::CreateImportTask::orchestrate(&runtime_plugins, input).await
123    }
124
125    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
126    pub fn customize(
127        self,
128    ) -> crate::client::customize::CustomizableOperation<
129        crate::operation::create_import_task::CreateImportTaskOutput,
130        crate::operation::create_import_task::CreateImportTaskError,
131        Self,
132    > {
133        crate::client::customize::CustomizableOperation::new(self)
134    }
135    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
136        self.set_config_override(::std::option::Option::Some(config_override.into()));
137        self
138    }
139
140    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
141        self.config_override = config_override;
142        self
143    }
144    /// <p>The ARN of the source to import from.</p>
145    pub fn import_source_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.import_source_arn(input.into());
147        self
148    }
149    /// <p>The ARN of the source to import from.</p>
150    pub fn set_import_source_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_import_source_arn(input);
152        self
153    }
154    /// <p>The ARN of the source to import from.</p>
155    pub fn get_import_source_arn(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_import_source_arn()
157    }
158    /// <p>The ARN of the IAM role that grants CloudWatch Logs permission to import from the CloudTrail Lake Event Data Store.</p>
159    pub fn import_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.import_role_arn(input.into());
161        self
162    }
163    /// <p>The ARN of the IAM role that grants CloudWatch Logs permission to import from the CloudTrail Lake Event Data Store.</p>
164    pub fn set_import_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_import_role_arn(input);
166        self
167    }
168    /// <p>The ARN of the IAM role that grants CloudWatch Logs permission to import from the CloudTrail Lake Event Data Store.</p>
169    pub fn get_import_role_arn(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_import_role_arn()
171    }
172    /// <p>Optional filters to constrain the import by CloudTrail event time. Times are specified in Unix timestamp milliseconds. The range of data being imported must be within the specified source's retention period.</p>
173    pub fn import_filter(mut self, input: crate::types::ImportFilter) -> Self {
174        self.inner = self.inner.import_filter(input);
175        self
176    }
177    /// <p>Optional filters to constrain the import by CloudTrail event time. Times are specified in Unix timestamp milliseconds. The range of data being imported must be within the specified source's retention period.</p>
178    pub fn set_import_filter(mut self, input: ::std::option::Option<crate::types::ImportFilter>) -> Self {
179        self.inner = self.inner.set_import_filter(input);
180        self
181    }
182    /// <p>Optional filters to constrain the import by CloudTrail event time. Times are specified in Unix timestamp milliseconds. The range of data being imported must be within the specified source's retention period.</p>
183    pub fn get_import_filter(&self) -> &::std::option::Option<crate::types::ImportFilter> {
184        self.inner.get_import_filter()
185    }
186}