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::put_event_selectors::_put_event_selectors_input::PutEventSelectorsInputBuilder;

pub use crate::operation::put_event_selectors::_put_event_selectors_output::PutEventSelectorsOutputBuilder;

impl crate::operation::put_event_selectors::builders::PutEventSelectorsInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::put_event_selectors::PutEventSelectorsOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::put_event_selectors::PutEventSelectorsError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.put_event_selectors();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `PutEventSelectors`.
///
/// <p>Configures event selectors (also referred to as <i>basic event selectors</i>) or advanced event selectors for your trail. You can use either <code>AdvancedEventSelectors</code> or <code>EventSelectors</code>, but not both. If you apply <code>AdvancedEventSelectors</code> to a trail, any existing <code>EventSelectors</code> are overwritten.</p>
/// <p>You can use <code>AdvancedEventSelectors</code> to log management events, data events for all resource types, and network activity events.</p>
/// <p>You can use <code>EventSelectors</code> to log management events and data events for the following resource types:</p>
/// <ul>
/// <li>
/// <p><code>AWS::DynamoDB::Table</code></p></li>
/// <li>
/// <p><code>AWS::Lambda::Function</code></p></li>
/// <li>
/// <p><code>AWS::S3::Object</code></p></li>
/// </ul>
/// <p>You can't use <code>EventSelectors</code> to log network activity events.</p>
/// <p>If you want your trail to log Insights events, be sure the event selector or advanced event selector enables logging of the Insights event types you want configured for your trail. For more information about logging Insights events, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-insights-events-with-cloudtrail.html">Working with CloudTrail Insights</a> in the <i>CloudTrail User Guide</i>. By default, trails created without specific event selectors are configured to log all read and write management events, and no data events or network activity events.</p>
/// <p>When an event occurs in your account, CloudTrail evaluates the event selectors or advanced event selectors in all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event.</p>
/// <p>Example</p>
/// <ol>
/// <li>
/// <p>You create an event selector for a trail and specify that you want to log write-only events.</p></li>
/// <li>
/// <p>The EC2 <code>GetConsoleOutput</code> and <code>RunInstances</code> API operations occur in your account.</p></li>
/// <li>
/// <p>CloudTrail evaluates whether the events match your event selectors.</p></li>
/// <li>
/// <p>The <code>RunInstances</code> is a write-only event and it matches your event selector. The trail logs the event.</p></li>
/// <li>
/// <p>The <code>GetConsoleOutput</code> is a read-only event that doesn't match your event selector. The trail doesn't log the event.</p></li>
/// </ol>
/// <p>The <code>PutEventSelectors</code> operation must be called from the Region in which the trail was created; otherwise, an <code>InvalidHomeRegionException</code> exception is thrown.</p>
/// <p>You can configure up to five event selectors for each trail.</p>
/// <p>You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html">Logging management events</a>, <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">Logging data events</a>, <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html">Logging network activity events</a>, and <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/WhatIsCloudTrail-Limits.html">Quotas in CloudTrail</a> in the <i>CloudTrail User Guide</i>.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct PutEventSelectorsFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::put_event_selectors::builders::PutEventSelectorsInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::put_event_selectors::PutEventSelectorsOutput,
        crate::operation::put_event_selectors::PutEventSelectorsError,
    > for PutEventSelectorsFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::put_event_selectors::PutEventSelectorsOutput,
            crate::operation::put_event_selectors::PutEventSelectorsError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl PutEventSelectorsFluentBuilder {
    /// Creates a new `PutEventSelectorsFluentBuilder`.
    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 PutEventSelectors as a reference.
    pub fn as_input(&self) -> &crate::operation::put_event_selectors::builders::PutEventSelectorsInputBuilder {
        &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::put_event_selectors::PutEventSelectorsOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::put_event_selectors::PutEventSelectorsError,
            ::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::put_event_selectors::PutEventSelectors::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::put_event_selectors::PutEventSelectors::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::put_event_selectors::PutEventSelectorsOutput,
        crate::operation::put_event_selectors::PutEventSelectorsError,
        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 or trail ARN. If you specify a trail name, the string 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>
    /// <p>If you specify a trail ARN, it must be in the following format.</p>
    /// <p><code>arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail</code></p>
    pub fn trail_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.trail_name(input.into());
        self
    }
    /// <p>Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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>
    /// <p>If you specify a trail ARN, it must be in the following format.</p>
    /// <p><code>arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail</code></p>
    pub fn set_trail_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_trail_name(input);
        self
    }
    /// <p>Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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>
    /// <p>If you specify a trail ARN, it must be in the following format.</p>
    /// <p><code>arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail</code></p>
    pub fn get_trail_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_trail_name()
    }
    ///
    /// Appends an item to `EventSelectors`.
    ///
    /// To override the contents of this collection use [`set_event_selectors`](Self::set_event_selectors).
    ///
    /// <p>Specifies the settings for your event selectors. You can use event selectors to log management events and data events for the following resource types:</p>
    /// <ul>
    /// <li>
    /// <p><code>AWS::DynamoDB::Table</code></p></li>
    /// <li>
    /// <p><code>AWS::Lambda::Function</code></p></li>
    /// <li>
    /// <p><code>AWS::S3::Object</code></p></li>
    /// </ul>
    /// <p>You can't use event selectors to log network activity events.</p>
    /// <p>You can configure up to five event selectors for a trail. You can use either <code>EventSelectors</code> or <code>AdvancedEventSelectors</code> in a <code>PutEventSelectors</code> request, but not both. If you apply <code>EventSelectors</code> to a trail, any existing <code>AdvancedEventSelectors</code> are overwritten.</p>
    pub fn event_selectors(mut self, input: crate::types::EventSelector) -> Self {
        self.inner = self.inner.event_selectors(input);
        self
    }
    /// <p>Specifies the settings for your event selectors. You can use event selectors to log management events and data events for the following resource types:</p>
    /// <ul>
    /// <li>
    /// <p><code>AWS::DynamoDB::Table</code></p></li>
    /// <li>
    /// <p><code>AWS::Lambda::Function</code></p></li>
    /// <li>
    /// <p><code>AWS::S3::Object</code></p></li>
    /// </ul>
    /// <p>You can't use event selectors to log network activity events.</p>
    /// <p>You can configure up to five event selectors for a trail. You can use either <code>EventSelectors</code> or <code>AdvancedEventSelectors</code> in a <code>PutEventSelectors</code> request, but not both. If you apply <code>EventSelectors</code> to a trail, any existing <code>AdvancedEventSelectors</code> are overwritten.</p>
    pub fn set_event_selectors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::EventSelector>>) -> Self {
        self.inner = self.inner.set_event_selectors(input);
        self
    }
    /// <p>Specifies the settings for your event selectors. You can use event selectors to log management events and data events for the following resource types:</p>
    /// <ul>
    /// <li>
    /// <p><code>AWS::DynamoDB::Table</code></p></li>
    /// <li>
    /// <p><code>AWS::Lambda::Function</code></p></li>
    /// <li>
    /// <p><code>AWS::S3::Object</code></p></li>
    /// </ul>
    /// <p>You can't use event selectors to log network activity events.</p>
    /// <p>You can configure up to five event selectors for a trail. You can use either <code>EventSelectors</code> or <code>AdvancedEventSelectors</code> in a <code>PutEventSelectors</code> request, but not both. If you apply <code>EventSelectors</code> to a trail, any existing <code>AdvancedEventSelectors</code> are overwritten.</p>
    pub fn get_event_selectors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::EventSelector>> {
        self.inner.get_event_selectors()
    }
    ///
    /// Appends an item to `AdvancedEventSelectors`.
    ///
    /// To override the contents of this collection use [`set_advanced_event_selectors`](Self::set_advanced_event_selectors).
    ///
    /// <p>Specifies the settings for advanced event selectors. You can use advanced event selectors to log management events, data events for all resource types, and network activity events.</p>
    /// <p>You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either <code>AdvancedEventSelectors</code> or <code>EventSelectors</code>, but not both. If you apply <code>AdvancedEventSelectors</code> to a trail, any existing <code>EventSelectors</code> are overwritten. For more information about advanced event selectors, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">Logging data events</a> and <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html">Logging network activity events</a> in the <i>CloudTrail User Guide</i>.</p>
    pub fn advanced_event_selectors(mut self, input: crate::types::AdvancedEventSelector) -> Self {
        self.inner = self.inner.advanced_event_selectors(input);
        self
    }
    /// <p>Specifies the settings for advanced event selectors. You can use advanced event selectors to log management events, data events for all resource types, and network activity events.</p>
    /// <p>You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either <code>AdvancedEventSelectors</code> or <code>EventSelectors</code>, but not both. If you apply <code>AdvancedEventSelectors</code> to a trail, any existing <code>EventSelectors</code> are overwritten. For more information about advanced event selectors, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">Logging data events</a> and <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html">Logging network activity events</a> in the <i>CloudTrail User Guide</i>.</p>
    pub fn set_advanced_event_selectors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AdvancedEventSelector>>) -> Self {
        self.inner = self.inner.set_advanced_event_selectors(input);
        self
    }
    /// <p>Specifies the settings for advanced event selectors. You can use advanced event selectors to log management events, data events for all resource types, and network activity events.</p>
    /// <p>You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either <code>AdvancedEventSelectors</code> or <code>EventSelectors</code>, but not both. If you apply <code>AdvancedEventSelectors</code> to a trail, any existing <code>EventSelectors</code> are overwritten. For more information about advanced event selectors, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html">Logging data events</a> and <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-network-events-with-cloudtrail.html">Logging network activity events</a> in the <i>CloudTrail User Guide</i>.</p>
    pub fn get_advanced_event_selectors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AdvancedEventSelector>> {
        self.inner.get_advanced_event_selectors()
    }
}