Skip to main content

aws_sdk_cloudtrail/types/
_source_config.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains configuration information about the channel.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SourceConfig {
7    /// <p>Specifies whether the channel applies to a single Region or to all Regions.</p>
8    pub apply_to_all_regions: ::std::option::Option<bool>,
9    /// <p>The advanced event selectors that are configured for the channel.</p>
10    pub advanced_event_selectors: ::std::option::Option<::std::vec::Vec<crate::types::AdvancedEventSelector>>,
11}
12impl SourceConfig {
13    /// <p>Specifies whether the channel applies to a single Region or to all Regions.</p>
14    pub fn apply_to_all_regions(&self) -> ::std::option::Option<bool> {
15        self.apply_to_all_regions
16    }
17    /// <p>The advanced event selectors that are configured for the channel.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.advanced_event_selectors.is_none()`.
20    pub fn advanced_event_selectors(&self) -> &[crate::types::AdvancedEventSelector] {
21        self.advanced_event_selectors.as_deref().unwrap_or_default()
22    }
23}
24impl SourceConfig {
25    /// Creates a new builder-style object to manufacture [`SourceConfig`](crate::types::SourceConfig).
26    pub fn builder() -> crate::types::builders::SourceConfigBuilder {
27        crate::types::builders::SourceConfigBuilder::default()
28    }
29}
30
31/// A builder for [`SourceConfig`](crate::types::SourceConfig).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct SourceConfigBuilder {
35    pub(crate) apply_to_all_regions: ::std::option::Option<bool>,
36    pub(crate) advanced_event_selectors: ::std::option::Option<::std::vec::Vec<crate::types::AdvancedEventSelector>>,
37}
38impl SourceConfigBuilder {
39    /// <p>Specifies whether the channel applies to a single Region or to all Regions.</p>
40    pub fn apply_to_all_regions(mut self, input: bool) -> Self {
41        self.apply_to_all_regions = ::std::option::Option::Some(input);
42        self
43    }
44    /// <p>Specifies whether the channel applies to a single Region or to all Regions.</p>
45    pub fn set_apply_to_all_regions(mut self, input: ::std::option::Option<bool>) -> Self {
46        self.apply_to_all_regions = input;
47        self
48    }
49    /// <p>Specifies whether the channel applies to a single Region or to all Regions.</p>
50    pub fn get_apply_to_all_regions(&self) -> &::std::option::Option<bool> {
51        &self.apply_to_all_regions
52    }
53    /// Appends an item to `advanced_event_selectors`.
54    ///
55    /// To override the contents of this collection use [`set_advanced_event_selectors`](Self::set_advanced_event_selectors).
56    ///
57    /// <p>The advanced event selectors that are configured for the channel.</p>
58    pub fn advanced_event_selectors(mut self, input: crate::types::AdvancedEventSelector) -> Self {
59        let mut v = self.advanced_event_selectors.unwrap_or_default();
60        v.push(input);
61        self.advanced_event_selectors = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>The advanced event selectors that are configured for the channel.</p>
65    pub fn set_advanced_event_selectors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AdvancedEventSelector>>) -> Self {
66        self.advanced_event_selectors = input;
67        self
68    }
69    /// <p>The advanced event selectors that are configured for the channel.</p>
70    pub fn get_advanced_event_selectors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AdvancedEventSelector>> {
71        &self.advanced_event_selectors
72    }
73    /// Consumes the builder and constructs a [`SourceConfig`](crate::types::SourceConfig).
74    pub fn build(self) -> crate::types::SourceConfig {
75        crate::types::SourceConfig {
76            apply_to_all_regions: self.apply_to_all_regions,
77            advanced_event_selectors: self.advanced_event_selectors,
78        }
79    }
80}