1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p><b>[Event-based policies only]</b> Specifies an event that activates an event-based policy.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct EventParameters {
    /// <p>The type of event. Currently, only snapshot sharing events are supported.</p>
    pub event_type: ::std::option::Option<crate::types::EventTypeValues>,
    /// <p>The IDs of the Amazon Web Services accounts that can trigger policy by sharing snapshots with your account. The policy only runs if one of the specified Amazon Web Services accounts shares a snapshot with your account.</p>
    pub snapshot_owner: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The snapshot description that can trigger the policy. The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account.</p>
    /// <p>For example, specifying <code>^.*Created for policy: policy-1234567890abcdef0.*$</code> configures the policy to run only if snapshots created by policy <code>policy-1234567890abcdef0</code> are shared with your account.</p>
    pub description_regex: ::std::option::Option<::std::string::String>,
}
impl EventParameters {
    /// <p>The type of event. Currently, only snapshot sharing events are supported.</p>
    pub fn event_type(&self) -> ::std::option::Option<&crate::types::EventTypeValues> {
        self.event_type.as_ref()
    }
    /// <p>The IDs of the Amazon Web Services accounts that can trigger policy by sharing snapshots with your account. The policy only runs if one of the specified Amazon Web Services accounts shares a snapshot with your account.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.snapshot_owner.is_none()`.
    pub fn snapshot_owner(&self) -> &[::std::string::String] {
        self.snapshot_owner.as_deref().unwrap_or_default()
    }
    /// <p>The snapshot description that can trigger the policy. The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account.</p>
    /// <p>For example, specifying <code>^.*Created for policy: policy-1234567890abcdef0.*$</code> configures the policy to run only if snapshots created by policy <code>policy-1234567890abcdef0</code> are shared with your account.</p>
    pub fn description_regex(&self) -> ::std::option::Option<&str> {
        self.description_regex.as_deref()
    }
}
impl EventParameters {
    /// Creates a new builder-style object to manufacture [`EventParameters`](crate::types::EventParameters).
    pub fn builder() -> crate::types::builders::EventParametersBuilder {
        crate::types::builders::EventParametersBuilder::default()
    }
}

/// A builder for [`EventParameters`](crate::types::EventParameters).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct EventParametersBuilder {
    pub(crate) event_type: ::std::option::Option<crate::types::EventTypeValues>,
    pub(crate) snapshot_owner: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) description_regex: ::std::option::Option<::std::string::String>,
}
impl EventParametersBuilder {
    /// <p>The type of event. Currently, only snapshot sharing events are supported.</p>
    /// This field is required.
    pub fn event_type(mut self, input: crate::types::EventTypeValues) -> Self {
        self.event_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of event. Currently, only snapshot sharing events are supported.</p>
    pub fn set_event_type(mut self, input: ::std::option::Option<crate::types::EventTypeValues>) -> Self {
        self.event_type = input;
        self
    }
    /// <p>The type of event. Currently, only snapshot sharing events are supported.</p>
    pub fn get_event_type(&self) -> &::std::option::Option<crate::types::EventTypeValues> {
        &self.event_type
    }
    /// Appends an item to `snapshot_owner`.
    ///
    /// To override the contents of this collection use [`set_snapshot_owner`](Self::set_snapshot_owner).
    ///
    /// <p>The IDs of the Amazon Web Services accounts that can trigger policy by sharing snapshots with your account. The policy only runs if one of the specified Amazon Web Services accounts shares a snapshot with your account.</p>
    pub fn snapshot_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.snapshot_owner.unwrap_or_default();
        v.push(input.into());
        self.snapshot_owner = ::std::option::Option::Some(v);
        self
    }
    /// <p>The IDs of the Amazon Web Services accounts that can trigger policy by sharing snapshots with your account. The policy only runs if one of the specified Amazon Web Services accounts shares a snapshot with your account.</p>
    pub fn set_snapshot_owner(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.snapshot_owner = input;
        self
    }
    /// <p>The IDs of the Amazon Web Services accounts that can trigger policy by sharing snapshots with your account. The policy only runs if one of the specified Amazon Web Services accounts shares a snapshot with your account.</p>
    pub fn get_snapshot_owner(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.snapshot_owner
    }
    /// <p>The snapshot description that can trigger the policy. The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account.</p>
    /// <p>For example, specifying <code>^.*Created for policy: policy-1234567890abcdef0.*$</code> configures the policy to run only if snapshots created by policy <code>policy-1234567890abcdef0</code> are shared with your account.</p>
    /// This field is required.
    pub fn description_regex(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description_regex = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The snapshot description that can trigger the policy. The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account.</p>
    /// <p>For example, specifying <code>^.*Created for policy: policy-1234567890abcdef0.*$</code> configures the policy to run only if snapshots created by policy <code>policy-1234567890abcdef0</code> are shared with your account.</p>
    pub fn set_description_regex(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description_regex = input;
        self
    }
    /// <p>The snapshot description that can trigger the policy. The description pattern is specified using a regular expression. The policy runs only if a snapshot with a description that matches the specified pattern is shared with your account.</p>
    /// <p>For example, specifying <code>^.*Created for policy: policy-1234567890abcdef0.*$</code> configures the policy to run only if snapshots created by policy <code>policy-1234567890abcdef0</code> are shared with your account.</p>
    pub fn get_description_regex(&self) -> &::std::option::Option<::std::string::String> {
        &self.description_regex
    }
    /// Consumes the builder and constructs a [`EventParameters`](crate::types::EventParameters).
    pub fn build(self) -> crate::types::EventParameters {
        crate::types::EventParameters {
            event_type: self.event_type,
            snapshot_owner: self.snapshot_owner,
            description_regex: self.description_regex,
        }
    }
}