aws_sdk_cloudtrail/operation/create_trail/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_trail::_create_trail_output::CreateTrailOutputBuilder;
3
4pub use crate::operation::create_trail::_create_trail_input::CreateTrailInputBuilder;
5
6impl crate::operation::create_trail::builders::CreateTrailInputBuilder {
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_trail::CreateTrailOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_trail::CreateTrailError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_trail();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateTrail`.
24///
25/// <p>Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateTrailFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_trail::builders::CreateTrailInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_trail::CreateTrailOutput,
35        crate::operation::create_trail::CreateTrailError,
36    > for CreateTrailFluentBuilder
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_trail::CreateTrailOutput,
44            crate::operation::create_trail::CreateTrailError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateTrailFluentBuilder {
51    /// Creates a new `CreateTrailFluentBuilder`.
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 CreateTrail as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_trail::builders::CreateTrailInputBuilder {
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_trail::CreateTrailOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_trail::CreateTrailError,
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_trail::CreateTrail::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_trail::CreateTrail::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_trail::CreateTrailOutput,
97        crate::operation::create_trail::CreateTrailError,
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>Specifies the name of the trail. The name must meet the following requirements:</p>
112    /// <ul>
113    /// <li>
114    /// <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p></li>
115    /// <li>
116    /// <p>Start with a letter or number, and end with a letter or number</p></li>
117    /// <li>
118    /// <p>Be between 3 and 128 characters</p></li>
119    /// <li>
120    /// <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p></li>
121    /// <li>
122    /// <p>Not be in IP address format (for example, 192.168.5.4)</p></li>
123    /// </ul>
124    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.inner = self.inner.name(input.into());
126        self
127    }
128    /// <p>Specifies the name of the trail. The name must meet the following requirements:</p>
129    /// <ul>
130    /// <li>
131    /// <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p></li>
132    /// <li>
133    /// <p>Start with a letter or number, and end with a letter or number</p></li>
134    /// <li>
135    /// <p>Be between 3 and 128 characters</p></li>
136    /// <li>
137    /// <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p></li>
138    /// <li>
139    /// <p>Not be in IP address format (for example, 192.168.5.4)</p></li>
140    /// </ul>
141    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.inner = self.inner.set_name(input);
143        self
144    }
145    /// <p>Specifies the name of the trail. The name must meet the following requirements:</p>
146    /// <ul>
147    /// <li>
148    /// <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p></li>
149    /// <li>
150    /// <p>Start with a letter or number, and end with a letter or number</p></li>
151    /// <li>
152    /// <p>Be between 3 and 128 characters</p></li>
153    /// <li>
154    /// <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p></li>
155    /// <li>
156    /// <p>Not be in IP address format (for example, 192.168.5.4)</p></li>
157    /// </ul>
158    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_name()
160    }
161    /// <p>Specifies the name of the Amazon S3 bucket designated for publishing log files. For information about bucket naming rules, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html">Bucket naming rules</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p>
162    pub fn s3_bucket_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.inner = self.inner.s3_bucket_name(input.into());
164        self
165    }
166    /// <p>Specifies the name of the Amazon S3 bucket designated for publishing log files. For information about bucket naming rules, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html">Bucket naming rules</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p>
167    pub fn set_s3_bucket_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_s3_bucket_name(input);
169        self
170    }
171    /// <p>Specifies the name of the Amazon S3 bucket designated for publishing log files. For information about bucket naming rules, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html">Bucket naming rules</a> in the <i>Amazon Simple Storage Service User Guide</i>.</p>
172    pub fn get_s3_bucket_name(&self) -> &::std::option::Option<::std::string::String> {
173        self.inner.get_s3_bucket_name()
174    }
175    /// <p>Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/get-and-view-cloudtrail-log-files.html#cloudtrail-find-log-files">Finding Your CloudTrail Log Files</a>. The maximum length is 200 characters.</p>
176    pub fn s3_key_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177        self.inner = self.inner.s3_key_prefix(input.into());
178        self
179    }
180    /// <p>Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/get-and-view-cloudtrail-log-files.html#cloudtrail-find-log-files">Finding Your CloudTrail Log Files</a>. The maximum length is 200 characters.</p>
181    pub fn set_s3_key_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182        self.inner = self.inner.set_s3_key_prefix(input);
183        self
184    }
185    /// <p>Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/get-and-view-cloudtrail-log-files.html#cloudtrail-find-log-files">Finding Your CloudTrail Log Files</a>. The maximum length is 200 characters.</p>
186    pub fn get_s3_key_prefix(&self) -> &::std::option::Option<::std::string::String> {
187        self.inner.get_s3_key_prefix()
188    }
189    /// <p>Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.</p>
190    pub fn sns_topic_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.sns_topic_name(input.into());
192        self
193    }
194    /// <p>Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.</p>
195    pub fn set_sns_topic_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.inner = self.inner.set_sns_topic_name(input);
197        self
198    }
199    /// <p>Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters.</p>
200    pub fn get_sns_topic_name(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_sns_topic_name()
202    }
203    /// <p>Specifies whether the trail is publishing events from global services such as IAM to the log files.</p>
204    pub fn include_global_service_events(mut self, input: bool) -> Self {
205        self.inner = self.inner.include_global_service_events(input);
206        self
207    }
208    /// <p>Specifies whether the trail is publishing events from global services such as IAM to the log files.</p>
209    pub fn set_include_global_service_events(mut self, input: ::std::option::Option<bool>) -> Self {
210        self.inner = self.inner.set_include_global_service_events(input);
211        self
212    }
213    /// <p>Specifies whether the trail is publishing events from global services such as IAM to the log files.</p>
214    pub fn get_include_global_service_events(&self) -> &::std::option::Option<bool> {
215        self.inner.get_include_global_service_events()
216    }
217    /// <p>Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions.</p>
218    pub fn is_multi_region_trail(mut self, input: bool) -> Self {
219        self.inner = self.inner.is_multi_region_trail(input);
220        self
221    }
222    /// <p>Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions.</p>
223    pub fn set_is_multi_region_trail(mut self, input: ::std::option::Option<bool>) -> Self {
224        self.inner = self.inner.set_is_multi_region_trail(input);
225        self
226    }
227    /// <p>Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions.</p>
228    pub fn get_is_multi_region_trail(&self) -> &::std::option::Option<bool> {
229        self.inner.get_is_multi_region_trail()
230    }
231    /// <p>Specifies whether log file integrity validation is enabled. The default is false.</p><note>
232    /// <p>When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.</p>
233    /// </note>
234    pub fn enable_log_file_validation(mut self, input: bool) -> Self {
235        self.inner = self.inner.enable_log_file_validation(input);
236        self
237    }
238    /// <p>Specifies whether log file integrity validation is enabled. The default is false.</p><note>
239    /// <p>When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.</p>
240    /// </note>
241    pub fn set_enable_log_file_validation(mut self, input: ::std::option::Option<bool>) -> Self {
242        self.inner = self.inner.set_enable_log_file_validation(input);
243        self
244    }
245    /// <p>Specifies whether log file integrity validation is enabled. The default is false.</p><note>
246    /// <p>When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.</p>
247    /// </note>
248    pub fn get_enable_log_file_validation(&self) -> &::std::option::Option<bool> {
249        self.inner.get_enable_log_file_validation()
250    }
251    /// <p>Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account.</p>
252    /// <p>Not required unless you specify <code>CloudWatchLogsRoleArn</code>.</p>
253    pub fn cloud_watch_logs_log_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
254        self.inner = self.inner.cloud_watch_logs_log_group_arn(input.into());
255        self
256    }
257    /// <p>Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account.</p>
258    /// <p>Not required unless you specify <code>CloudWatchLogsRoleArn</code>.</p>
259    pub fn set_cloud_watch_logs_log_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
260        self.inner = self.inner.set_cloud_watch_logs_log_group_arn(input);
261        self
262    }
263    /// <p>Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account.</p>
264    /// <p>Not required unless you specify <code>CloudWatchLogsRoleArn</code>.</p>
265    pub fn get_cloud_watch_logs_log_group_arn(&self) -> &::std::option::Option<::std::string::String> {
266        self.inner.get_cloud_watch_logs_log_group_arn()
267    }
268    /// <p>Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.</p>
269    pub fn cloud_watch_logs_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
270        self.inner = self.inner.cloud_watch_logs_role_arn(input.into());
271        self
272    }
273    /// <p>Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.</p>
274    pub fn set_cloud_watch_logs_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
275        self.inner = self.inner.set_cloud_watch_logs_role_arn(input);
276        self
277    }
278    /// <p>Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account.</p>
279    pub fn get_cloud_watch_logs_role_arn(&self) -> &::std::option::Option<::std::string::String> {
280        self.inner.get_cloud_watch_logs_role_arn()
281    }
282    /// <p>Specifies the KMS key ID to use to encrypt the logs and digest files delivered by CloudTrail. The value can be an alias name prefixed by <code>alias/</code>, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.</p>
283    /// <p>CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Using multi-Region keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
284    /// <p>Examples:</p>
285    /// <ul>
286    /// <li>
287    /// <p><code>alias/MyAliasName</code></p></li>
288    /// <li>
289    /// <p><code>arn:aws:kms:us-east-2:123456789012:alias/MyAliasName</code></p></li>
290    /// <li>
291    /// <p><code>arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
292    /// <li>
293    /// <p><code>12345678-1234-1234-1234-123456789012</code></p></li>
294    /// </ul>
295    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
296        self.inner = self.inner.kms_key_id(input.into());
297        self
298    }
299    /// <p>Specifies the KMS key ID to use to encrypt the logs and digest files delivered by CloudTrail. The value can be an alias name prefixed by <code>alias/</code>, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.</p>
300    /// <p>CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Using multi-Region keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
301    /// <p>Examples:</p>
302    /// <ul>
303    /// <li>
304    /// <p><code>alias/MyAliasName</code></p></li>
305    /// <li>
306    /// <p><code>arn:aws:kms:us-east-2:123456789012:alias/MyAliasName</code></p></li>
307    /// <li>
308    /// <p><code>arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
309    /// <li>
310    /// <p><code>12345678-1234-1234-1234-123456789012</code></p></li>
311    /// </ul>
312    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
313        self.inner = self.inner.set_kms_key_id(input);
314        self
315    }
316    /// <p>Specifies the KMS key ID to use to encrypt the logs and digest files delivered by CloudTrail. The value can be an alias name prefixed by <code>alias/</code>, a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.</p>
317    /// <p>CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html">Using multi-Region keys</a> in the <i>Key Management Service Developer Guide</i>.</p>
318    /// <p>Examples:</p>
319    /// <ul>
320    /// <li>
321    /// <p><code>alias/MyAliasName</code></p></li>
322    /// <li>
323    /// <p><code>arn:aws:kms:us-east-2:123456789012:alias/MyAliasName</code></p></li>
324    /// <li>
325    /// <p><code>arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
326    /// <li>
327    /// <p><code>12345678-1234-1234-1234-123456789012</code></p></li>
328    /// </ul>
329    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
330        self.inner.get_kms_key_id()
331    }
332    /// <p>Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations.</p>
333    pub fn is_organization_trail(mut self, input: bool) -> Self {
334        self.inner = self.inner.is_organization_trail(input);
335        self
336    }
337    /// <p>Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations.</p>
338    pub fn set_is_organization_trail(mut self, input: ::std::option::Option<bool>) -> Self {
339        self.inner = self.inner.set_is_organization_trail(input);
340        self
341    }
342    /// <p>Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations.</p>
343    pub fn get_is_organization_trail(&self) -> &::std::option::Option<bool> {
344        self.inner.get_is_organization_trail()
345    }
346    ///
347    /// Appends an item to `TagsList`.
348    ///
349    /// To override the contents of this collection use [`set_tags_list`](Self::set_tags_list).
350    ///
351    /// <p>A list of tags.</p>
352    pub fn tags_list(mut self, input: crate::types::Tag) -> Self {
353        self.inner = self.inner.tags_list(input);
354        self
355    }
356    /// <p>A list of tags.</p>
357    pub fn set_tags_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
358        self.inner = self.inner.set_tags_list(input);
359        self
360    }
361    /// <p>A list of tags.</p>
362    pub fn get_tags_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
363        self.inner.get_tags_list()
364    }
365}