aws-sdk-cloudtrail 1.104.0

AWS SDK for AWS CloudTrail
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_trail::_create_trail_input::CreateTrailInputBuilder;

pub use crate::operation::create_trail::_create_trail_output::CreateTrailOutputBuilder;

impl crate::operation::create_trail::builders::CreateTrailInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::create_trail::CreateTrailOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_trail::CreateTrailError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.create_trail();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `CreateTrail`.
///
/// <p>Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateTrailFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::create_trail::builders::CreateTrailInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::create_trail::CreateTrailOutput,
        crate::operation::create_trail::CreateTrailError,
    > for CreateTrailFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::create_trail::CreateTrailOutput,
            crate::operation::create_trail::CreateTrailError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl CreateTrailFluentBuilder {
    /// Creates a new `CreateTrailFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the CreateTrail as a reference.
    pub fn as_input(&self) -> &crate::operation::create_trail::builders::CreateTrailInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::create_trail::CreateTrailOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_trail::CreateTrailError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::create_trail::CreateTrail::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::create_trail::CreateTrail::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::create_trail::CreateTrailOutput,
        crate::operation::create_trail::CreateTrailError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <p>Specifies the name of the trail. The name must meet the following requirements:</p>
    /// <ul>
    /// <li>
    /// <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p></li>
    /// <li>
    /// <p>Start with a letter or number, and end with a letter or number</p></li>
    /// <li>
    /// <p>Be between 3 and 128 characters</p></li>
    /// <li>
    /// <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p></li>
    /// <li>
    /// <p>Not be in IP address format (for example, 192.168.5.4)</p></li>
    /// </ul>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.name(input.into());
        self
    }
    /// <p>Specifies the name of the trail. The name must meet the following requirements:</p>
    /// <ul>
    /// <li>
    /// <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p></li>
    /// <li>
    /// <p>Start with a letter or number, and end with a letter or number</p></li>
    /// <li>
    /// <p>Be between 3 and 128 characters</p></li>
    /// <li>
    /// <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p></li>
    /// <li>
    /// <p>Not be in IP address format (for example, 192.168.5.4)</p></li>
    /// </ul>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_name(input);
        self
    }
    /// <p>Specifies the name of the trail. The name must meet the following requirements:</p>
    /// <ul>
    /// <li>
    /// <p>Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)</p></li>
    /// <li>
    /// <p>Start with a letter or number, and end with a letter or number</p></li>
    /// <li>
    /// <p>Be between 3 and 128 characters</p></li>
    /// <li>
    /// <p>Have no adjacent periods, underscores or dashes. Names like <code>my-_namespace</code> and <code>my--namespace</code> are not valid.</p></li>
    /// <li>
    /// <p>Not be in IP address format (for example, 192.168.5.4)</p></li>
    /// </ul>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_name()
    }
    /// <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>
    pub fn s3_bucket_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.s3_bucket_name(input.into());
        self
    }
    /// <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>
    pub fn set_s3_bucket_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_s3_bucket_name(input);
        self
    }
    /// <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>
    pub fn get_s3_bucket_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_s3_bucket_name()
    }
    /// <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>
    pub fn s3_key_prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.s3_key_prefix(input.into());
        self
    }
    /// <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>
    pub fn set_s3_key_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_s3_key_prefix(input);
        self
    }
    /// <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>
    pub fn get_s3_key_prefix(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_s3_key_prefix()
    }
    /// <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>
    pub fn sns_topic_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.sns_topic_name(input.into());
        self
    }
    /// <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>
    pub fn set_sns_topic_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_sns_topic_name(input);
        self
    }
    /// <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>
    pub fn get_sns_topic_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_sns_topic_name()
    }
    /// <p>Specifies whether the trail is publishing events from global services such as IAM to the log files.</p>
    pub fn include_global_service_events(mut self, input: bool) -> Self {
        self.inner = self.inner.include_global_service_events(input);
        self
    }
    /// <p>Specifies whether the trail is publishing events from global services such as IAM to the log files.</p>
    pub fn set_include_global_service_events(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_include_global_service_events(input);
        self
    }
    /// <p>Specifies whether the trail is publishing events from global services such as IAM to the log files.</p>
    pub fn get_include_global_service_events(&self) -> &::std::option::Option<bool> {
        self.inner.get_include_global_service_events()
    }
    /// <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>
    pub fn is_multi_region_trail(mut self, input: bool) -> Self {
        self.inner = self.inner.is_multi_region_trail(input);
        self
    }
    /// <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>
    pub fn set_is_multi_region_trail(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_is_multi_region_trail(input);
        self
    }
    /// <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>
    pub fn get_is_multi_region_trail(&self) -> &::std::option::Option<bool> {
        self.inner.get_is_multi_region_trail()
    }
    /// <p>Specifies whether log file integrity validation is enabled. The default is false.</p><note>
    /// <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>
    /// </note>
    pub fn enable_log_file_validation(mut self, input: bool) -> Self {
        self.inner = self.inner.enable_log_file_validation(input);
        self
    }
    /// <p>Specifies whether log file integrity validation is enabled. The default is false.</p><note>
    /// <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>
    /// </note>
    pub fn set_enable_log_file_validation(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_enable_log_file_validation(input);
        self
    }
    /// <p>Specifies whether log file integrity validation is enabled. The default is false.</p><note>
    /// <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>
    /// </note>
    pub fn get_enable_log_file_validation(&self) -> &::std::option::Option<bool> {
        self.inner.get_enable_log_file_validation()
    }
    /// <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>
    /// <p>Not required unless you specify <code>CloudWatchLogsRoleArn</code>.</p>
    pub fn cloud_watch_logs_log_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.cloud_watch_logs_log_group_arn(input.into());
        self
    }
    /// <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>
    /// <p>Not required unless you specify <code>CloudWatchLogsRoleArn</code>.</p>
    pub fn set_cloud_watch_logs_log_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_cloud_watch_logs_log_group_arn(input);
        self
    }
    /// <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>
    /// <p>Not required unless you specify <code>CloudWatchLogsRoleArn</code>.</p>
    pub fn get_cloud_watch_logs_log_group_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_cloud_watch_logs_log_group_arn()
    }
    /// <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>
    pub fn cloud_watch_logs_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.cloud_watch_logs_role_arn(input.into());
        self
    }
    /// <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>
    pub fn set_cloud_watch_logs_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_cloud_watch_logs_role_arn(input);
        self
    }
    /// <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>
    pub fn get_cloud_watch_logs_role_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_cloud_watch_logs_role_arn()
    }
    /// <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>
    /// <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>
    /// <p>Examples:</p>
    /// <ul>
    /// <li>
    /// <p><code>alias/MyAliasName</code></p></li>
    /// <li>
    /// <p><code>arn:aws:kms:us-east-2:123456789012:alias/MyAliasName</code></p></li>
    /// <li>
    /// <p><code>arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
    /// <li>
    /// <p><code>12345678-1234-1234-1234-123456789012</code></p></li>
    /// </ul>
    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.kms_key_id(input.into());
        self
    }
    /// <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>
    /// <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>
    /// <p>Examples:</p>
    /// <ul>
    /// <li>
    /// <p><code>alias/MyAliasName</code></p></li>
    /// <li>
    /// <p><code>arn:aws:kms:us-east-2:123456789012:alias/MyAliasName</code></p></li>
    /// <li>
    /// <p><code>arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
    /// <li>
    /// <p><code>12345678-1234-1234-1234-123456789012</code></p></li>
    /// </ul>
    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_kms_key_id(input);
        self
    }
    /// <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>
    /// <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>
    /// <p>Examples:</p>
    /// <ul>
    /// <li>
    /// <p><code>alias/MyAliasName</code></p></li>
    /// <li>
    /// <p><code>arn:aws:kms:us-east-2:123456789012:alias/MyAliasName</code></p></li>
    /// <li>
    /// <p><code>arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012</code></p></li>
    /// <li>
    /// <p><code>12345678-1234-1234-1234-123456789012</code></p></li>
    /// </ul>
    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_kms_key_id()
    }
    /// <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>
    pub fn is_organization_trail(mut self, input: bool) -> Self {
        self.inner = self.inner.is_organization_trail(input);
        self
    }
    /// <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>
    pub fn set_is_organization_trail(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_is_organization_trail(input);
        self
    }
    /// <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>
    pub fn get_is_organization_trail(&self) -> &::std::option::Option<bool> {
        self.inner.get_is_organization_trail()
    }
    ///
    /// Appends an item to `TagsList`.
    ///
    /// To override the contents of this collection use [`set_tags_list`](Self::set_tags_list).
    ///
    /// <p>A list of tags.</p>
    pub fn tags_list(mut self, input: crate::types::Tag) -> Self {
        self.inner = self.inner.tags_list(input);
        self
    }
    /// <p>A list of tags.</p>
    pub fn set_tags_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
        self.inner = self.inner.set_tags_list(input);
        self
    }
    /// <p>A list of tags.</p>
    pub fn get_tags_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
        self.inner.get_tags_list()
    }
}