aws-sdk-dlm 1.94.0

AWS SDK for Amazon Data Lifecycle Manager
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p><b>\[Event-based policies only\]</b> Specifies an action for an event-based policy.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Action {
    /// <p>A descriptive name for the action.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The rule for copying shared snapshots across Regions.</p>
    pub cross_region_copy: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyAction>>,
}
impl Action {
    /// <p>A descriptive name for the action.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The rule for copying shared snapshots across Regions.</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 `.cross_region_copy.is_none()`.
    pub fn cross_region_copy(&self) -> &[crate::types::CrossRegionCopyAction] {
        self.cross_region_copy.as_deref().unwrap_or_default()
    }
}
impl Action {
    /// Creates a new builder-style object to manufacture [`Action`](crate::types::Action).
    pub fn builder() -> crate::types::builders::ActionBuilder {
        crate::types::builders::ActionBuilder::default()
    }
}

/// A builder for [`Action`](crate::types::Action).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ActionBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) cross_region_copy: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyAction>>,
}
impl ActionBuilder {
    /// <p>A descriptive name for the action.</p>
    /// This field is required.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A descriptive name for the action.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>A descriptive name for the action.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// Appends an item to `cross_region_copy`.
    ///
    /// To override the contents of this collection use [`set_cross_region_copy`](Self::set_cross_region_copy).
    ///
    /// <p>The rule for copying shared snapshots across Regions.</p>
    pub fn cross_region_copy(mut self, input: crate::types::CrossRegionCopyAction) -> Self {
        let mut v = self.cross_region_copy.unwrap_or_default();
        v.push(input);
        self.cross_region_copy = ::std::option::Option::Some(v);
        self
    }
    /// <p>The rule for copying shared snapshots across Regions.</p>
    pub fn set_cross_region_copy(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyAction>>) -> Self {
        self.cross_region_copy = input;
        self
    }
    /// <p>The rule for copying shared snapshots across Regions.</p>
    pub fn get_cross_region_copy(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyAction>> {
        &self.cross_region_copy
    }
    /// Consumes the builder and constructs a [`Action`](crate::types::Action).
    pub fn build(self) -> crate::types::Action {
        crate::types::Action {
            name: self.name,
            cross_region_copy: self.cross_region_copy,
        }
    }
}