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
// 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,
}
}
}