aws-sdk-s3control 1.108.0

AWS SDK for AWS S3 Control
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>You can use the access point scope to restrict access to specific prefixes, API operations, or a combination of both.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points-directory-buckets-manage-scope.html">Manage the scope of your access points for directory buckets</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Scope {
    /// <p>You can specify any amount of prefixes, but the total length of characters of all prefixes must be less than 256 bytes in size.</p>
    pub prefixes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>You can include one or more API operations as permissions.</p>
    pub permissions: ::std::option::Option<::std::vec::Vec<crate::types::ScopePermission>>,
}
impl Scope {
    /// <p>You can specify any amount of prefixes, but the total length of characters of all prefixes must be less than 256 bytes in size.</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 `.prefixes.is_none()`.
    pub fn prefixes(&self) -> &[::std::string::String] {
        self.prefixes.as_deref().unwrap_or_default()
    }
    /// <p>You can include one or more API operations as permissions.</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 `.permissions.is_none()`.
    pub fn permissions(&self) -> &[crate::types::ScopePermission] {
        self.permissions.as_deref().unwrap_or_default()
    }
}
impl Scope {
    /// Creates a new builder-style object to manufacture [`Scope`](crate::types::Scope).
    pub fn builder() -> crate::types::builders::ScopeBuilder {
        crate::types::builders::ScopeBuilder::default()
    }
}

/// A builder for [`Scope`](crate::types::Scope).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ScopeBuilder {
    pub(crate) prefixes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) permissions: ::std::option::Option<::std::vec::Vec<crate::types::ScopePermission>>,
}
impl ScopeBuilder {
    /// Appends an item to `prefixes`.
    ///
    /// To override the contents of this collection use [`set_prefixes`](Self::set_prefixes).
    ///
    /// <p>You can specify any amount of prefixes, but the total length of characters of all prefixes must be less than 256 bytes in size.</p>
    pub fn prefixes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.prefixes.unwrap_or_default();
        v.push(input.into());
        self.prefixes = ::std::option::Option::Some(v);
        self
    }
    /// <p>You can specify any amount of prefixes, but the total length of characters of all prefixes must be less than 256 bytes in size.</p>
    pub fn set_prefixes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.prefixes = input;
        self
    }
    /// <p>You can specify any amount of prefixes, but the total length of characters of all prefixes must be less than 256 bytes in size.</p>
    pub fn get_prefixes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.prefixes
    }
    /// Appends an item to `permissions`.
    ///
    /// To override the contents of this collection use [`set_permissions`](Self::set_permissions).
    ///
    /// <p>You can include one or more API operations as permissions.</p>
    pub fn permissions(mut self, input: crate::types::ScopePermission) -> Self {
        let mut v = self.permissions.unwrap_or_default();
        v.push(input);
        self.permissions = ::std::option::Option::Some(v);
        self
    }
    /// <p>You can include one or more API operations as permissions.</p>
    pub fn set_permissions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ScopePermission>>) -> Self {
        self.permissions = input;
        self
    }
    /// <p>You can include one or more API operations as permissions.</p>
    pub fn get_permissions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ScopePermission>> {
        &self.permissions
    }
    /// Consumes the builder and constructs a [`Scope`](crate::types::Scope).
    pub fn build(self) -> crate::types::Scope {
        crate::types::Scope {
            prefixes: self.prefixes,
            permissions: self.permissions,
        }
    }
}