2 2 |
|
3 3 | /// <p>You can use the access point scope to restrict access to specific prefixes, API operations, or a combination of both.</p>
|
4 4 | /// <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>
|
5 5 | #[non_exhaustive]
|
6 6 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
7 7 | pub struct Scope {
|
8 8 | /// <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>
|
9 9 | pub prefixes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
10 10 | /// <p>You can include one or more API operations as permissions.</p>
|
11 11 | pub permissions: ::std::option::Option<::std::vec::Vec<crate::types::ScopePermission>>,
|
12 12 | }
|
13 13 | impl Scope {
|
14 14 | /// <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>
|
15 15 | ///
|
16 16 | /// 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()`.
|
17 17 | pub fn prefixes(&self) -> &[::std::string::String] {
|
18 18 | self.prefixes.as_deref().unwrap_or_default()
|
19 19 | }
|
20 20 | /// <p>You can include one or more API operations as permissions.</p>
|
21 21 | ///
|
22 22 | /// 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()`.
|
23 23 | pub fn permissions(&self) -> &[crate::types::ScopePermission] {
|
24 24 | self.permissions.as_deref().unwrap_or_default()
|
25 25 | }
|
26 26 | }
|
27 27 | static SCOPE_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
|
28 28 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.s3control#Scope", "com.amazonaws.s3control", "Scope");
|
29 29 | static SCOPE_MEMBER_PREFIXES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
30 30 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.s3control#Scope$Prefixes", "com.amazonaws.s3control", "Scope"),
|
31 31 | ::aws_smithy_schema::ShapeType::List,
|
32 - | "prefixes",
|
32 + | "Prefixes",
|
33 33 | 0,
|
34 34 | )
|
35 35 | .with_xml_name("Prefixes");
|
36 36 | static SCOPE_MEMBER_PERMISSIONS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
37 37 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.s3control#Scope$Permissions", "com.amazonaws.s3control", "Scope"),
|
38 38 | ::aws_smithy_schema::ShapeType::List,
|
39 - | "permissions",
|
39 + | "Permissions",
|
40 40 | 1,
|
41 41 | )
|
42 42 | .with_xml_name("Permissions");
|
43 43 | static SCOPE_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
44 44 | SCOPE_SCHEMA_ID,
|
45 45 | ::aws_smithy_schema::ShapeType::Structure,
|
46 46 | &[&SCOPE_MEMBER_PREFIXES, &SCOPE_MEMBER_PERMISSIONS],
|
47 47 | );
|
48 48 | impl Scope {
|
49 49 | /// The schema for this shape.
|
50 50 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &SCOPE_SCHEMA;
|
51 51 | }
|
52 52 | impl ::aws_smithy_schema::serde::SerializableStruct for Scope {
|
53 53 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
54 54 | fn serialize_members(
|
55 55 | &self,
|
56 56 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
57 57 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
58 58 | if let Some(ref val) = self.prefixes {
|
59 59 | ser.write_list(&SCOPE_MEMBER_PREFIXES, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
60 60 | for item in val {
|
61 61 | ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
|
62 62 | }
|
63 63 | Ok(())
|
64 64 | })?;
|
65 65 | }
|
66 66 | if let Some(ref val) = self.permissions {
|
67 67 | ser.write_list(&SCOPE_MEMBER_PERMISSIONS, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
68 68 | for item in val {
|
69 69 | ser.write_string(&aws_smithy_schema::prelude::STRING, item.as_str())?;
|
70 70 | }
|
71 71 | Ok(())
|
72 72 | })?;
|
73 73 | }
|
74 74 | Ok(())
|
75 75 | }
|
76 76 | }
|
77 77 | impl Scope {
|
78 78 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
79 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
80 - | deserializer: &mut D,
|
79 + | pub fn deserialize(
|
80 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
81 81 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
82 82 | #[allow(unused_variables, unused_mut)]
|
83 83 | let mut builder = Self::builder();
|
84 84 | #[allow(
|
85 85 | unused_variables,
|
86 86 | unreachable_code,
|
87 87 | clippy::single_match,
|
88 88 | clippy::match_single_binding,
|
89 89 | clippy::diverging_sub_expression
|
90 90 | )]
|
91 - | deserializer.read_struct(&SCOPE_SCHEMA, (), |_, member, deser| {
|
91 + | deserializer.read_struct(&SCOPE_SCHEMA, &mut |member, deser| {
|
92 92 | match member.member_index() {
|
93 93 | Some(0) => {
|
94 - | builder.prefixes = Some({
|
95 - | let container = if let Some(cap) = deser.container_size() {
|
96 - | Vec::with_capacity(cap)
|
97 - | } else {
|
98 - | Vec::new()
|
99 - | };
|
100 - | deser.read_list(member, container, |mut list, deser| {
|
101 - | list.push(deser.read_string(member)?);
|
102 - | Ok(list)
|
103 - | })?
|
104 - | });
|
94 + | builder.prefixes = Some(deser.read_string_list(member)?);
|
105 95 | }
|
106 96 | Some(1) => {
|
107 97 | builder.permissions = Some({
|
108 - | let container = if let Some(cap) = deser.container_size() {
|
109 - | Vec::with_capacity(cap)
|
110 - | } else {
|
111 - | Vec::new()
|
112 - | };
|
113 - | deser.read_list(member, container, |mut list, deser| {
|
114 - | list.push(crate::types::ScopePermission::from(deser.read_string(member)?.as_str()));
|
115 - | Ok(list)
|
116 - | })?
|
98 + | let mut container = Vec::new();
|
99 + | deser.read_list(member, &mut |deser| {
|
100 + | container.push(crate::types::ScopePermission::from(deser.read_string(member)?.as_str()));
|
101 + | Ok(())
|
102 + | })?;
|
103 + | container
|
117 104 | });
|
118 105 | }
|
119 106 | _ => {}
|
120 107 | }
|
121 108 | Ok(())
|
122 109 | })?;
|
123 110 | Ok(builder.build())
|
124 111 | }
|
125 112 | }
|
113 + | impl Scope {
|
114 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
115 + | pub fn deserialize_with_response(
|
116 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
117 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
118 + | _status: u16,
|
119 + | _body: &[u8],
|
120 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
121 + | Self::deserialize(deserializer)
|
122 + | }
|
123 + | }
|
126 124 | impl Scope {
|
127 125 | /// Creates a new builder-style object to manufacture [`Scope`](crate::types::Scope).
|
128 126 | pub fn builder() -> crate::types::builders::ScopeBuilder {
|
129 127 | crate::types::builders::ScopeBuilder::default()
|
130 128 | }
|
131 129 | }
|
132 130 |
|
133 131 | /// A builder for [`Scope`](crate::types::Scope).
|
134 132 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
135 133 | #[non_exhaustive]
|