1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
3 + | #[derive(
|
4 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
5 + | )]
|
6 + | pub struct GetObjectInput {
|
7 + | #[allow(missing_docs)] // documentation missing in model
|
8 + | pub bucket: ::std::string::String,
|
9 + | #[allow(missing_docs)] // documentation missing in model
|
10 + | pub key: crate::model::ObjectKey,
|
11 + | }
|
12 + | impl GetObjectInput {
|
13 + | #[allow(missing_docs)] // documentation missing in model
|
14 + | pub fn bucket(&self) -> &str {
|
15 + | use std::ops::Deref;
|
16 + | self.bucket.deref()
|
17 + | }
|
18 + | #[allow(missing_docs)] // documentation missing in model
|
19 + | pub fn key(&self) -> &crate::model::ObjectKey {
|
20 + | &self.key
|
21 + | }
|
22 + | }
|
23 + | impl GetObjectInput {
|
24 + | /// Creates a new builder-style object to manufacture [`GetObjectInput`](crate::input::GetObjectInput).
|
25 + | pub fn builder() -> crate::input::get_object_input::Builder {
|
26 + | crate::input::get_object_input::Builder::default()
|
27 + | }
|
28 + | }
|
29 + | impl crate::constrained::Constrained for crate::input::GetObjectInput {
|
30 + | type Unconstrained = crate::input::get_object_input::Builder;
|
31 + | }
|
32 + |
|
33 + | #[allow(missing_docs)] // documentation missing in model
|
34 + | #[derive(
|
35 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
36 + | )]
|
37 + | pub struct DeleteObjectTaggingInput {
|
38 + | #[allow(missing_docs)] // documentation missing in model
|
39 + | pub bucket: ::std::string::String,
|
40 + | #[allow(missing_docs)] // documentation missing in model
|
41 + | pub key: crate::model::ObjectKey,
|
42 + | #[allow(missing_docs)] // documentation missing in model
|
43 + | pub version_id: ::std::option::Option<::std::string::String>,
|
44 + | #[allow(missing_docs)] // documentation missing in model
|
45 + | pub expected_bucket_owner: ::std::option::Option<::std::string::String>,
|
46 + | }
|
47 + | impl DeleteObjectTaggingInput {
|
48 + | #[allow(missing_docs)] // documentation missing in model
|
49 + | pub fn bucket(&self) -> &str {
|
50 + | use std::ops::Deref;
|
51 + | self.bucket.deref()
|
52 + | }
|
53 + | #[allow(missing_docs)] // documentation missing in model
|
54 + | pub fn key(&self) -> &crate::model::ObjectKey {
|
55 + | &self.key
|
56 + | }
|
57 + | #[allow(missing_docs)] // documentation missing in model
|
58 + | pub fn version_id(&self) -> ::std::option::Option<&str> {
|
59 + | self.version_id.as_deref()
|
60 + | }
|
61 + | #[allow(missing_docs)] // documentation missing in model
|
62 + | pub fn expected_bucket_owner(&self) -> ::std::option::Option<&str> {
|
63 + | self.expected_bucket_owner.as_deref()
|
64 + | }
|
65 + | }
|
66 + | impl DeleteObjectTaggingInput {
|
67 + | /// Creates a new builder-style object to manufacture [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput).
|
68 + | pub fn builder() -> crate::input::delete_object_tagging_input::Builder {
|
69 + | crate::input::delete_object_tagging_input::Builder::default()
|
70 + | }
|
71 + | }
|
72 + | impl crate::constrained::Constrained for crate::input::DeleteObjectTaggingInput {
|
73 + | type Unconstrained = crate::input::delete_object_tagging_input::Builder;
|
74 + | }
|
75 + |
|
76 + | #[allow(missing_docs)] // documentation missing in model
|
77 + | #[derive(
|
78 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
79 + | )]
|
80 + | pub struct GetBucketLocationInput {
|
81 + | #[allow(missing_docs)] // documentation missing in model
|
82 + | pub bucket: ::std::string::String,
|
83 + | }
|
84 + | impl GetBucketLocationInput {
|
85 + | #[allow(missing_docs)] // documentation missing in model
|
86 + | pub fn bucket(&self) -> &str {
|
87 + | use std::ops::Deref;
|
88 + | self.bucket.deref()
|
89 + | }
|
90 + | }
|
91 + | impl GetBucketLocationInput {
|
92 + | /// Creates a new builder-style object to manufacture [`GetBucketLocationInput`](crate::input::GetBucketLocationInput).
|
93 + | pub fn builder() -> crate::input::get_bucket_location_input::Builder {
|
94 + | crate::input::get_bucket_location_input::Builder::default()
|
95 + | }
|
96 + | }
|
97 + | impl crate::constrained::Constrained for crate::input::GetBucketLocationInput {
|
98 + | type Unconstrained = crate::input::get_bucket_location_input::Builder;
|
99 + | }
|
100 + |
|
101 + | #[allow(missing_docs)] // documentation missing in model
|
102 + | #[derive(
|
103 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
104 + | )]
|
105 + | pub struct ListObjectsV2Input {
|
106 + | #[allow(missing_docs)] // documentation missing in model
|
107 + | pub bucket: ::std::string::String,
|
108 + | #[allow(missing_docs)] // documentation missing in model
|
109 + | pub delimiter: ::std::option::Option<::std::string::String>,
|
110 + | #[allow(missing_docs)] // documentation missing in model
|
111 + | pub encoding_type: ::std::option::Option<crate::model::EncodingType>,
|
112 + | #[allow(missing_docs)] // documentation missing in model
|
113 + | pub max_keys: ::std::option::Option<i32>,
|
114 + | #[allow(missing_docs)] // documentation missing in model
|
115 + | pub prefix: ::std::option::Option<::std::string::String>,
|
116 + | #[allow(missing_docs)] // documentation missing in model
|
117 + | pub continuation_token: ::std::option::Option<::std::string::String>,
|
118 + | #[allow(missing_docs)] // documentation missing in model
|
119 + | pub fetch_owner: ::std::option::Option<bool>,
|
120 + | #[allow(missing_docs)] // documentation missing in model
|
121 + | pub start_after: ::std::option::Option<::std::string::String>,
|
122 + | #[allow(missing_docs)] // documentation missing in model
|
123 + | pub request_payer: ::std::option::Option<crate::model::RequestPayer>,
|
124 + | #[allow(missing_docs)] // documentation missing in model
|
125 + | pub expected_bucket_owner: ::std::option::Option<::std::string::String>,
|
126 + | }
|
127 + | impl ListObjectsV2Input {
|
128 + | #[allow(missing_docs)] // documentation missing in model
|
129 + | pub fn bucket(&self) -> &str {
|
130 + | use std::ops::Deref;
|
131 + | self.bucket.deref()
|
132 + | }
|
133 + | #[allow(missing_docs)] // documentation missing in model
|
134 + | pub fn delimiter(&self) -> ::std::option::Option<&str> {
|
135 + | self.delimiter.as_deref()
|
136 + | }
|
137 + | #[allow(missing_docs)] // documentation missing in model
|
138 + | pub fn encoding_type(&self) -> ::std::option::Option<&crate::model::EncodingType> {
|
139 + | self.encoding_type.as_ref()
|
140 + | }
|
141 + | #[allow(missing_docs)] // documentation missing in model
|
142 + | pub fn max_keys(&self) -> ::std::option::Option<i32> {
|
143 + | self.max_keys
|
144 + | }
|
145 + | #[allow(missing_docs)] // documentation missing in model
|
146 + | pub fn prefix(&self) -> ::std::option::Option<&str> {
|
147 + | self.prefix.as_deref()
|
148 + | }
|
149 + | #[allow(missing_docs)] // documentation missing in model
|
150 + | pub fn continuation_token(&self) -> ::std::option::Option<&str> {
|
151 + | self.continuation_token.as_deref()
|
152 + | }
|
153 + | #[allow(missing_docs)] // documentation missing in model
|
154 + | pub fn fetch_owner(&self) -> ::std::option::Option<bool> {
|
155 + | self.fetch_owner
|
156 + | }
|
157 + | #[allow(missing_docs)] // documentation missing in model
|
158 + | pub fn start_after(&self) -> ::std::option::Option<&str> {
|
159 + | self.start_after.as_deref()
|
160 + | }
|
161 + | #[allow(missing_docs)] // documentation missing in model
|
162 + | pub fn request_payer(&self) -> ::std::option::Option<&crate::model::RequestPayer> {
|
163 + | self.request_payer.as_ref()
|
164 + | }
|
165 + | #[allow(missing_docs)] // documentation missing in model
|
166 + | pub fn expected_bucket_owner(&self) -> ::std::option::Option<&str> {
|
167 + | self.expected_bucket_owner.as_deref()
|
168 + | }
|
169 + | }
|
170 + | impl ListObjectsV2Input {
|
171 + | /// Creates a new builder-style object to manufacture [`ListObjectsV2Input`](crate::input::ListObjectsV2Input).
|
172 + | pub fn builder() -> crate::input::list_objects_v2_input::Builder {
|
173 + | crate::input::list_objects_v2_input::Builder::default()
|
174 + | }
|
175 + | }
|
176 + | impl crate::constrained::Constrained for crate::input::ListObjectsV2Input {
|
177 + | type Unconstrained = crate::input::list_objects_v2_input::Builder;
|
178 + | }
|
179 + | /// See [`GetObjectInput`](crate::input::GetObjectInput).
|
180 + | pub mod get_object_input {
|
181 + |
|
182 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
183 + | /// Holds one variant for each of the ways the builder can fail.
|
184 + | #[non_exhaustive]
|
185 + | #[allow(clippy::enum_variant_names)]
|
186 + | pub enum ConstraintViolation {
|
187 + | /// `bucket` was not provided but it is required when building `GetObjectInput`.
|
188 + | MissingBucket,
|
189 + | /// `key` was not provided but it is required when building `GetObjectInput`.
|
190 + | MissingKey,
|
191 + | /// Constraint violation occurred building member `key` when building `GetObjectInput`.
|
192 + | #[doc(hidden)]
|
193 + | Key(crate::model::object_key::ConstraintViolation),
|
194 + | }
|
195 + | impl ::std::fmt::Display for ConstraintViolation {
|
196 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
197 + | match self {
|
198 + | ConstraintViolation::MissingBucket => write!(f, "`bucket` was not provided but it is required when building `GetObjectInput`"),
|
199 + | ConstraintViolation::MissingKey => write!(f, "`key` was not provided but it is required when building `GetObjectInput`"),
|
200 + | ConstraintViolation::Key(_) => write!(f, "constraint violation occurred building member `key` when building `GetObjectInput`"),
|
201 + | }
|
202 + | }
|
203 + | }
|
204 + | impl ::std::error::Error for ConstraintViolation {}
|
205 + | impl ConstraintViolation {
|
206 + | pub(crate) fn as_validation_exception_field(
|
207 + | self,
|
208 + | path: ::std::string::String,
|
209 + | ) -> crate::model::ValidationExceptionField {
|
210 + | match self {
|
211 + | ConstraintViolation::MissingBucket => crate::model::ValidationExceptionField {
|
212 + | message: format!("Value at '{}/Bucket' failed to satisfy constraint: Member must not be null", path),
|
213 + | path: path + "/Bucket",
|
214 + | },
|
215 + | ConstraintViolation::MissingKey => crate::model::ValidationExceptionField {
|
216 + | message: format!("Value at '{}/Key' failed to satisfy constraint: Member must not be null", path),
|
217 + | path: path + "/Key",
|
218 + | },
|
219 + | ConstraintViolation::Key(inner) => inner.as_validation_exception_field(path + "/Key"),
|
220 + | }
|
221 + | }
|
222 + | }
|
223 + | impl ::std::convert::From<ConstraintViolation>
|
224 + | for ::aws_smithy_legacy_http_server::protocol::rest_xml::rejection::RequestRejection
|
225 + | {
|
226 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
227 + | let first_validation_exception_field =
|
228 + | constraint_violation.as_validation_exception_field("".to_owned());
|
229 + | let validation_exception = crate::error::ValidationException {
|
230 + | message: format!(
|
231 + | "1 validation error detected. {}",
|
232 + | &first_validation_exception_field.message
|
233 + | ),
|
234 + | field_list: Some(vec![first_validation_exception_field]),
|
235 + | };
|
236 + | Self::ConstraintViolation(
|
237 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
238 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
239 + | )
|
240 + | }
|
241 + | }
|
242 + | impl ::std::convert::From<Builder>
|
243 + | for crate::constrained::MaybeConstrained<crate::input::GetObjectInput>
|
244 + | {
|
245 + | fn from(builder: Builder) -> Self {
|
246 + | Self::Unconstrained(builder)
|
247 + | }
|
248 + | }
|
249 + | impl ::std::convert::TryFrom<Builder> for crate::input::GetObjectInput {
|
250 + | type Error = ConstraintViolation;
|
251 + |
|
252 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
253 + | builder.build()
|
254 + | }
|
255 + | }
|
256 + | /// A builder for [`GetObjectInput`](crate::input::GetObjectInput).
|
257 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
258 + | pub struct Builder {
|
259 + | pub(crate) bucket: ::std::option::Option<::std::string::String>,
|
260 + | pub(crate) key:
|
261 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ObjectKey>>,
|
262 + | }
|
263 + | impl Builder {
|
264 + | #[allow(missing_docs)] // documentation missing in model
|
265 + | pub fn bucket(mut self, input: ::std::string::String) -> Self {
|
266 + | self.bucket = Some(input);
|
267 + | self
|
268 + | }
|
269 + | #[allow(missing_docs)] // documentation missing in model
|
270 + | pub(crate) fn set_bucket(
|
271 + | mut self,
|
272 + | input: impl ::std::convert::Into<::std::string::String>,
|
273 + | ) -> Self {
|
274 + | self.bucket = Some(input.into());
|
275 + | self
|
276 + | }
|
277 + | #[allow(missing_docs)] // documentation missing in model
|
278 + | pub fn key(mut self, input: crate::model::ObjectKey) -> Self {
|
279 + | self.key = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
280 + | self
|
281 + | }
|
282 + | #[allow(missing_docs)] // documentation missing in model
|
283 + | pub(crate) fn set_key(
|
284 + | mut self,
|
285 + | input: impl ::std::convert::Into<
|
286 + | crate::constrained::MaybeConstrained<crate::model::ObjectKey>,
|
287 + | >,
|
288 + | ) -> Self {
|
289 + | self.key = Some(input.into());
|
290 + | self
|
291 + | }
|
292 + | /// Consumes the builder and constructs a [`GetObjectInput`](crate::input::GetObjectInput).
|
293 + | ///
|
294 + | /// The builder fails to construct a [`GetObjectInput`](crate::input::GetObjectInput) if a [`ConstraintViolation`] occurs.
|
295 + | ///
|
296 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
297 + | pub fn build(self) -> Result<crate::input::GetObjectInput, ConstraintViolation> {
|
298 + | self.build_enforcing_all_constraints()
|
299 + | }
|
300 + | fn build_enforcing_all_constraints(
|
301 + | self,
|
302 + | ) -> Result<crate::input::GetObjectInput, ConstraintViolation> {
|
303 + | Ok(crate::input::GetObjectInput {
|
304 + | bucket: self.bucket.ok_or(ConstraintViolation::MissingBucket)?,
|
305 + | key: self
|
306 + | .key
|
307 + | .map(|v| match v {
|
308 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
309 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
310 + | })
|
311 + | .map(|res| res.map_err(ConstraintViolation::Key))
|
312 + | .transpose()?
|
313 + | .ok_or(ConstraintViolation::MissingKey)?,
|
314 + | })
|
315 + | }
|
316 + | }
|
317 + | }
|
318 + | /// See [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput).
|
319 + | pub mod delete_object_tagging_input {
|
320 + |
|
321 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
322 + | /// Holds one variant for each of the ways the builder can fail.
|
323 + | #[non_exhaustive]
|
324 + | #[allow(clippy::enum_variant_names)]
|
325 + | pub enum ConstraintViolation {
|
326 + | /// `bucket` was not provided but it is required when building `DeleteObjectTaggingInput`.
|
327 + | MissingBucket,
|
328 + | /// `key` was not provided but it is required when building `DeleteObjectTaggingInput`.
|
329 + | MissingKey,
|
330 + | /// Constraint violation occurred building member `key` when building `DeleteObjectTaggingInput`.
|
331 + | #[doc(hidden)]
|
332 + | Key(crate::model::object_key::ConstraintViolation),
|
333 + | }
|
334 + | impl ::std::fmt::Display for ConstraintViolation {
|
335 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
336 + | match self {
|
337 + | ConstraintViolation::MissingBucket => write!(f, "`bucket` was not provided but it is required when building `DeleteObjectTaggingInput`"),
|
338 + | ConstraintViolation::MissingKey => write!(f, "`key` was not provided but it is required when building `DeleteObjectTaggingInput`"),
|
339 + | ConstraintViolation::Key(_) => write!(f, "constraint violation occurred building member `key` when building `DeleteObjectTaggingInput`"),
|
340 + | }
|
341 + | }
|
342 + | }
|
343 + | impl ::std::error::Error for ConstraintViolation {}
|
344 + | impl ConstraintViolation {
|
345 + | pub(crate) fn as_validation_exception_field(
|
346 + | self,
|
347 + | path: ::std::string::String,
|
348 + | ) -> crate::model::ValidationExceptionField {
|
349 + | match self {
|
350 + | ConstraintViolation::MissingBucket => crate::model::ValidationExceptionField {
|
351 + | message: format!("Value at '{}/Bucket' failed to satisfy constraint: Member must not be null", path),
|
352 + | path: path + "/Bucket",
|
353 + | },
|
354 + | ConstraintViolation::MissingKey => crate::model::ValidationExceptionField {
|
355 + | message: format!("Value at '{}/Key' failed to satisfy constraint: Member must not be null", path),
|
356 + | path: path + "/Key",
|
357 + | },
|
358 + | ConstraintViolation::Key(inner) => inner.as_validation_exception_field(path + "/Key"),
|
359 + | }
|
360 + | }
|
361 + | }
|
362 + | impl ::std::convert::From<ConstraintViolation>
|
363 + | for ::aws_smithy_legacy_http_server::protocol::rest_xml::rejection::RequestRejection
|
364 + | {
|
365 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
366 + | let first_validation_exception_field =
|
367 + | constraint_violation.as_validation_exception_field("".to_owned());
|
368 + | let validation_exception = crate::error::ValidationException {
|
369 + | message: format!(
|
370 + | "1 validation error detected. {}",
|
371 + | &first_validation_exception_field.message
|
372 + | ),
|
373 + | field_list: Some(vec![first_validation_exception_field]),
|
374 + | };
|
375 + | Self::ConstraintViolation(
|
376 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
377 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
378 + | )
|
379 + | }
|
380 + | }
|
381 + | impl ::std::convert::From<Builder>
|
382 + | for crate::constrained::MaybeConstrained<crate::input::DeleteObjectTaggingInput>
|
383 + | {
|
384 + | fn from(builder: Builder) -> Self {
|
385 + | Self::Unconstrained(builder)
|
386 + | }
|
387 + | }
|
388 + | impl ::std::convert::TryFrom<Builder> for crate::input::DeleteObjectTaggingInput {
|
389 + | type Error = ConstraintViolation;
|
390 + |
|
391 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
392 + | builder.build()
|
393 + | }
|
394 + | }
|
395 + | /// A builder for [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput).
|
396 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
397 + | pub struct Builder {
|
398 + | pub(crate) bucket: ::std::option::Option<::std::string::String>,
|
399 + | pub(crate) key:
|
400 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::ObjectKey>>,
|
401 + | pub(crate) version_id: ::std::option::Option<::std::string::String>,
|
402 + | pub(crate) expected_bucket_owner: ::std::option::Option<::std::string::String>,
|
403 + | }
|
404 + | impl Builder {
|
405 + | #[allow(missing_docs)] // documentation missing in model
|
406 + | pub fn bucket(mut self, input: ::std::string::String) -> Self {
|
407 + | self.bucket = Some(input);
|
408 + | self
|
409 + | }
|
410 + | #[allow(missing_docs)] // documentation missing in model
|
411 + | pub(crate) fn set_bucket(
|
412 + | mut self,
|
413 + | input: impl ::std::convert::Into<::std::string::String>,
|
414 + | ) -> Self {
|
415 + | self.bucket = Some(input.into());
|
416 + | self
|
417 + | }
|
418 + | #[allow(missing_docs)] // documentation missing in model
|
419 + | pub fn key(mut self, input: crate::model::ObjectKey) -> Self {
|
420 + | self.key = Some(crate::constrained::MaybeConstrained::Constrained(input));
|
421 + | self
|
422 + | }
|
423 + | #[allow(missing_docs)] // documentation missing in model
|
424 + | pub(crate) fn set_key(
|
425 + | mut self,
|
426 + | input: impl ::std::convert::Into<
|
427 + | crate::constrained::MaybeConstrained<crate::model::ObjectKey>,
|
428 + | >,
|
429 + | ) -> Self {
|
430 + | self.key = Some(input.into());
|
431 + | self
|
432 + | }
|
433 + | #[allow(missing_docs)] // documentation missing in model
|
434 + | pub fn version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
435 + | self.version_id = input;
|
436 + | self
|
437 + | }
|
438 + | #[allow(missing_docs)] // documentation missing in model
|
439 + | pub(crate) fn set_version_id(
|
440 + | mut self,
|
441 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
442 + | ) -> Self {
|
443 + | self.version_id = input.map(|v| v.into());
|
444 + | self
|
445 + | }
|
446 + | #[allow(missing_docs)] // documentation missing in model
|
447 + | pub fn expected_bucket_owner(
|
448 + | mut self,
|
449 + | input: ::std::option::Option<::std::string::String>,
|
450 + | ) -> Self {
|
451 + | self.expected_bucket_owner = input;
|
452 + | self
|
453 + | }
|
454 + | #[allow(missing_docs)] // documentation missing in model
|
455 + | pub(crate) fn set_expected_bucket_owner(
|
456 + | mut self,
|
457 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
458 + | ) -> Self {
|
459 + | self.expected_bucket_owner = input.map(|v| v.into());
|
460 + | self
|
461 + | }
|
462 + | /// Consumes the builder and constructs a [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput).
|
463 + | ///
|
464 + | /// The builder fails to construct a [`DeleteObjectTaggingInput`](crate::input::DeleteObjectTaggingInput) if a [`ConstraintViolation`] occurs.
|
465 + | ///
|
466 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
467 + | pub fn build(self) -> Result<crate::input::DeleteObjectTaggingInput, ConstraintViolation> {
|
468 + | self.build_enforcing_all_constraints()
|
469 + | }
|
470 + | fn build_enforcing_all_constraints(
|
471 + | self,
|
472 + | ) -> Result<crate::input::DeleteObjectTaggingInput, ConstraintViolation> {
|
473 + | Ok(crate::input::DeleteObjectTaggingInput {
|
474 + | bucket: self.bucket.ok_or(ConstraintViolation::MissingBucket)?,
|
475 + | key: self
|
476 + | .key
|
477 + | .map(|v| match v {
|
478 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
479 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
480 + | })
|
481 + | .map(|res| res.map_err(ConstraintViolation::Key))
|
482 + | .transpose()?
|
483 + | .ok_or(ConstraintViolation::MissingKey)?,
|
484 + | version_id: self.version_id,
|
485 + | expected_bucket_owner: self.expected_bucket_owner,
|
486 + | })
|
487 + | }
|
488 + | }
|
489 + | }
|
490 + | /// See [`GetBucketLocationInput`](crate::input::GetBucketLocationInput).
|
491 + | pub mod get_bucket_location_input {
|
492 + |
|
493 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
494 + | /// Holds one variant for each of the ways the builder can fail.
|
495 + | #[non_exhaustive]
|
496 + | #[allow(clippy::enum_variant_names)]
|
497 + | pub enum ConstraintViolation {
|
498 + | /// `bucket` was not provided but it is required when building `GetBucketLocationInput`.
|
499 + | MissingBucket,
|
500 + | }
|
501 + | impl ::std::fmt::Display for ConstraintViolation {
|
502 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
503 + | match self {
|
504 + | ConstraintViolation::MissingBucket => write!(f, "`bucket` was not provided but it is required when building `GetBucketLocationInput`"),
|
505 + | }
|
506 + | }
|
507 + | }
|
508 + | impl ::std::error::Error for ConstraintViolation {}
|
509 + | impl ConstraintViolation {
|
510 + | pub(crate) fn as_validation_exception_field(
|
511 + | self,
|
512 + | path: ::std::string::String,
|
513 + | ) -> crate::model::ValidationExceptionField {
|
514 + | match self {
|
515 + | ConstraintViolation::MissingBucket => crate::model::ValidationExceptionField {
|
516 + | message: format!("Value at '{}/Bucket' failed to satisfy constraint: Member must not be null", path),
|
517 + | path: path + "/Bucket",
|
518 + | },
|
519 + | }
|
520 + | }
|
521 + | }
|
522 + | impl ::std::convert::From<ConstraintViolation>
|
523 + | for ::aws_smithy_legacy_http_server::protocol::rest_xml::rejection::RequestRejection
|
524 + | {
|
525 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
526 + | let first_validation_exception_field =
|
527 + | constraint_violation.as_validation_exception_field("".to_owned());
|
528 + | let validation_exception = crate::error::ValidationException {
|
529 + | message: format!(
|
530 + | "1 validation error detected. {}",
|
531 + | &first_validation_exception_field.message
|
532 + | ),
|
533 + | field_list: Some(vec![first_validation_exception_field]),
|
534 + | };
|
535 + | Self::ConstraintViolation(
|
536 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
537 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
538 + | )
|
539 + | }
|
540 + | }
|
541 + | impl ::std::convert::From<Builder>
|
542 + | for crate::constrained::MaybeConstrained<crate::input::GetBucketLocationInput>
|
543 + | {
|
544 + | fn from(builder: Builder) -> Self {
|
545 + | Self::Unconstrained(builder)
|
546 + | }
|
547 + | }
|
548 + | impl ::std::convert::TryFrom<Builder> for crate::input::GetBucketLocationInput {
|
549 + | type Error = ConstraintViolation;
|
550 + |
|
551 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
552 + | builder.build()
|
553 + | }
|
554 + | }
|
555 + | /// A builder for [`GetBucketLocationInput`](crate::input::GetBucketLocationInput).
|
556 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
557 + | pub struct Builder {
|
558 + | pub(crate) bucket: ::std::option::Option<::std::string::String>,
|
559 + | }
|
560 + | impl Builder {
|
561 + | #[allow(missing_docs)] // documentation missing in model
|
562 + | pub fn bucket(mut self, input: ::std::string::String) -> Self {
|
563 + | self.bucket = Some(input);
|
564 + | self
|
565 + | }
|
566 + | #[allow(missing_docs)] // documentation missing in model
|
567 + | pub(crate) fn set_bucket(
|
568 + | mut self,
|
569 + | input: impl ::std::convert::Into<::std::string::String>,
|
570 + | ) -> Self {
|
571 + | self.bucket = Some(input.into());
|
572 + | self
|
573 + | }
|
574 + | /// Consumes the builder and constructs a [`GetBucketLocationInput`](crate::input::GetBucketLocationInput).
|
575 + | ///
|
576 + | /// The builder fails to construct a [`GetBucketLocationInput`](crate::input::GetBucketLocationInput) if a [`ConstraintViolation`] occurs.
|
577 + | ///
|
578 + | pub fn build(self) -> Result<crate::input::GetBucketLocationInput, ConstraintViolation> {
|
579 + | self.build_enforcing_all_constraints()
|
580 + | }
|
581 + | fn build_enforcing_all_constraints(
|
582 + | self,
|
583 + | ) -> Result<crate::input::GetBucketLocationInput, ConstraintViolation> {
|
584 + | Ok(crate::input::GetBucketLocationInput {
|
585 + | bucket: self.bucket.ok_or(ConstraintViolation::MissingBucket)?,
|
586 + | })
|
587 + | }
|
588 + | }
|
589 + | }
|
590 + | /// See [`ListObjectsV2Input`](crate::input::ListObjectsV2Input).
|
591 + | pub mod list_objects_v2_input {
|
592 + |
|
593 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
594 + | /// Holds one variant for each of the ways the builder can fail.
|
595 + | #[non_exhaustive]
|
596 + | #[allow(clippy::enum_variant_names)]
|
597 + | pub enum ConstraintViolation {
|
598 + | /// `bucket` was not provided but it is required when building `ListObjectsV2Input`.
|
599 + | MissingBucket,
|
600 + | /// Constraint violation occurred building member `encoding_type` when building `ListObjectsV2Input`.
|
601 + | #[doc(hidden)]
|
602 + | EncodingType(crate::model::encoding_type::ConstraintViolation),
|
603 + | /// Constraint violation occurred building member `request_payer` when building `ListObjectsV2Input`.
|
604 + | #[doc(hidden)]
|
605 + | RequestPayer(crate::model::request_payer::ConstraintViolation),
|
606 + | }
|
607 + | impl ::std::fmt::Display for ConstraintViolation {
|
608 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
609 + | match self {
|
610 + | ConstraintViolation::MissingBucket => write!(f, "`bucket` was not provided but it is required when building `ListObjectsV2Input`"),
|
611 + | ConstraintViolation::EncodingType(_) => write!(f, "constraint violation occurred building member `encoding_type` when building `ListObjectsV2Input`"),
|
612 + | ConstraintViolation::RequestPayer(_) => write!(f, "constraint violation occurred building member `request_payer` when building `ListObjectsV2Input`"),
|
613 + | }
|
614 + | }
|
615 + | }
|
616 + | impl ::std::error::Error for ConstraintViolation {}
|
617 + | impl ConstraintViolation {
|
618 + | pub(crate) fn as_validation_exception_field(
|
619 + | self,
|
620 + | path: ::std::string::String,
|
621 + | ) -> crate::model::ValidationExceptionField {
|
622 + | match self {
|
623 + | ConstraintViolation::MissingBucket => crate::model::ValidationExceptionField {
|
624 + | message: format!("Value at '{}/Bucket' failed to satisfy constraint: Member must not be null", path),
|
625 + | path: path + "/Bucket",
|
626 + | },
|
627 + | ConstraintViolation::EncodingType(inner) => inner.as_validation_exception_field(path + "/EncodingType"),
|
628 + | ConstraintViolation::RequestPayer(inner) => inner.as_validation_exception_field(path + "/RequestPayer"),
|
629 + | }
|
630 + | }
|
631 + | }
|
632 + | impl ::std::convert::From<ConstraintViolation>
|
633 + | for ::aws_smithy_legacy_http_server::protocol::rest_xml::rejection::RequestRejection
|
634 + | {
|
635 + | fn from(constraint_violation: ConstraintViolation) -> Self {
|
636 + | let first_validation_exception_field =
|
637 + | constraint_violation.as_validation_exception_field("".to_owned());
|
638 + | let validation_exception = crate::error::ValidationException {
|
639 + | message: format!(
|
640 + | "1 validation error detected. {}",
|
641 + | &first_validation_exception_field.message
|
642 + | ),
|
643 + | field_list: Some(vec![first_validation_exception_field]),
|
644 + | };
|
645 + | Self::ConstraintViolation(
|
646 + | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
647 + | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
648 + | )
|
649 + | }
|
650 + | }
|
651 + | impl ::std::convert::From<Builder>
|
652 + | for crate::constrained::MaybeConstrained<crate::input::ListObjectsV2Input>
|
653 + | {
|
654 + | fn from(builder: Builder) -> Self {
|
655 + | Self::Unconstrained(builder)
|
656 + | }
|
657 + | }
|
658 + | impl ::std::convert::TryFrom<Builder> for crate::input::ListObjectsV2Input {
|
659 + | type Error = ConstraintViolation;
|
660 + |
|
661 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
662 + | builder.build()
|
663 + | }
|
664 + | }
|
665 + | /// A builder for [`ListObjectsV2Input`](crate::input::ListObjectsV2Input).
|
666 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
667 + | pub struct Builder {
|
668 + | pub(crate) bucket: ::std::option::Option<::std::string::String>,
|
669 + | pub(crate) delimiter: ::std::option::Option<::std::string::String>,
|
670 + | pub(crate) encoding_type:
|
671 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::EncodingType>>,
|
672 + | pub(crate) max_keys: ::std::option::Option<i32>,
|
673 + | pub(crate) prefix: ::std::option::Option<::std::string::String>,
|
674 + | pub(crate) continuation_token: ::std::option::Option<::std::string::String>,
|
675 + | pub(crate) fetch_owner: ::std::option::Option<bool>,
|
676 + | pub(crate) start_after: ::std::option::Option<::std::string::String>,
|
677 + | pub(crate) request_payer:
|
678 + | ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::RequestPayer>>,
|
679 + | pub(crate) expected_bucket_owner: ::std::option::Option<::std::string::String>,
|
680 + | }
|
681 + | impl Builder {
|
682 + | #[allow(missing_docs)] // documentation missing in model
|
683 + | pub fn bucket(mut self, input: ::std::string::String) -> Self {
|
684 + | self.bucket = Some(input);
|
685 + | self
|
686 + | }
|
687 + | #[allow(missing_docs)] // documentation missing in model
|
688 + | pub(crate) fn set_bucket(
|
689 + | mut self,
|
690 + | input: impl ::std::convert::Into<::std::string::String>,
|
691 + | ) -> Self {
|
692 + | self.bucket = Some(input.into());
|
693 + | self
|
694 + | }
|
695 + | #[allow(missing_docs)] // documentation missing in model
|
696 + | pub fn delimiter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
697 + | self.delimiter = input;
|
698 + | self
|
699 + | }
|
700 + | #[allow(missing_docs)] // documentation missing in model
|
701 + | pub(crate) fn set_delimiter(
|
702 + | mut self,
|
703 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
704 + | ) -> Self {
|
705 + | self.delimiter = input.map(|v| v.into());
|
706 + | self
|
707 + | }
|
708 + | #[allow(missing_docs)] // documentation missing in model
|
709 + | pub fn encoding_type(
|
710 + | mut self,
|
711 + | input: ::std::option::Option<crate::model::EncodingType>,
|
712 + | ) -> Self {
|
713 + | self.encoding_type = input.map(crate::constrained::MaybeConstrained::Constrained);
|
714 + | self
|
715 + | }
|
716 + | #[allow(missing_docs)] // documentation missing in model
|
717 + | pub(crate) fn set_encoding_type(
|
718 + | mut self,
|
719 + | input: Option<
|
720 + | impl ::std::convert::Into<
|
721 + | crate::constrained::MaybeConstrained<crate::model::EncodingType>,
|
722 + | >,
|
723 + | >,
|
724 + | ) -> Self {
|
725 + | self.encoding_type = input.map(|v| v.into());
|
726 + | self
|
727 + | }
|
728 + | #[allow(missing_docs)] // documentation missing in model
|
729 + | pub fn max_keys(mut self, input: ::std::option::Option<i32>) -> Self {
|
730 + | self.max_keys = input;
|
731 + | self
|
732 + | }
|
733 + | #[allow(missing_docs)] // documentation missing in model
|
734 + | pub(crate) fn set_max_keys(
|
735 + | mut self,
|
736 + | input: Option<impl ::std::convert::Into<i32>>,
|
737 + | ) -> Self {
|
738 + | self.max_keys = input.map(|v| v.into());
|
739 + | self
|
740 + | }
|
741 + | #[allow(missing_docs)] // documentation missing in model
|
742 + | pub fn prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
743 + | self.prefix = input;
|
744 + | self
|
745 + | }
|
746 + | #[allow(missing_docs)] // documentation missing in model
|
747 + | pub(crate) fn set_prefix(
|
748 + | mut self,
|
749 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
750 + | ) -> Self {
|
751 + | self.prefix = input.map(|v| v.into());
|
752 + | self
|
753 + | }
|
754 + | #[allow(missing_docs)] // documentation missing in model
|
755 + | pub fn continuation_token(
|
756 + | mut self,
|
757 + | input: ::std::option::Option<::std::string::String>,
|
758 + | ) -> Self {
|
759 + | self.continuation_token = input;
|
760 + | self
|
761 + | }
|
762 + | #[allow(missing_docs)] // documentation missing in model
|
763 + | pub(crate) fn set_continuation_token(
|
764 + | mut self,
|
765 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
766 + | ) -> Self {
|
767 + | self.continuation_token = input.map(|v| v.into());
|
768 + | self
|
769 + | }
|
770 + | #[allow(missing_docs)] // documentation missing in model
|
771 + | pub fn fetch_owner(mut self, input: ::std::option::Option<bool>) -> Self {
|
772 + | self.fetch_owner = input;
|
773 + | self
|
774 + | }
|
775 + | #[allow(missing_docs)] // documentation missing in model
|
776 + | pub(crate) fn set_fetch_owner(
|
777 + | mut self,
|
778 + | input: Option<impl ::std::convert::Into<bool>>,
|
779 + | ) -> Self {
|
780 + | self.fetch_owner = input.map(|v| v.into());
|
781 + | self
|
782 + | }
|
783 + | #[allow(missing_docs)] // documentation missing in model
|
784 + | pub fn start_after(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
785 + | self.start_after = input;
|
786 + | self
|
787 + | }
|
788 + | #[allow(missing_docs)] // documentation missing in model
|
789 + | pub(crate) fn set_start_after(
|
790 + | mut self,
|
791 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
792 + | ) -> Self {
|
793 + | self.start_after = input.map(|v| v.into());
|
794 + | self
|
795 + | }
|
796 + | #[allow(missing_docs)] // documentation missing in model
|
797 + | pub fn request_payer(
|
798 + | mut self,
|
799 + | input: ::std::option::Option<crate::model::RequestPayer>,
|
800 + | ) -> Self {
|
801 + | self.request_payer = input.map(crate::constrained::MaybeConstrained::Constrained);
|
802 + | self
|
803 + | }
|
804 + | #[allow(missing_docs)] // documentation missing in model
|
805 + | pub(crate) fn set_request_payer(
|
806 + | mut self,
|
807 + | input: Option<
|
808 + | impl ::std::convert::Into<
|
809 + | crate::constrained::MaybeConstrained<crate::model::RequestPayer>,
|
810 + | >,
|
811 + | >,
|
812 + | ) -> Self {
|
813 + | self.request_payer = input.map(|v| v.into());
|
814 + | self
|
815 + | }
|
816 + | #[allow(missing_docs)] // documentation missing in model
|
817 + | pub fn expected_bucket_owner(
|
818 + | mut self,
|
819 + | input: ::std::option::Option<::std::string::String>,
|
820 + | ) -> Self {
|
821 + | self.expected_bucket_owner = input;
|
822 + | self
|
823 + | }
|
824 + | #[allow(missing_docs)] // documentation missing in model
|
825 + | pub(crate) fn set_expected_bucket_owner(
|
826 + | mut self,
|
827 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
828 + | ) -> Self {
|
829 + | self.expected_bucket_owner = input.map(|v| v.into());
|
830 + | self
|
831 + | }
|
832 + | /// Consumes the builder and constructs a [`ListObjectsV2Input`](crate::input::ListObjectsV2Input).
|
833 + | ///
|
834 + | /// The builder fails to construct a [`ListObjectsV2Input`](crate::input::ListObjectsV2Input) if a [`ConstraintViolation`] occurs.
|
835 + | ///
|
836 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
837 + | pub fn build(self) -> Result<crate::input::ListObjectsV2Input, ConstraintViolation> {
|
838 + | self.build_enforcing_all_constraints()
|
839 + | }
|
840 + | fn build_enforcing_all_constraints(
|
841 + | self,
|
842 + | ) -> Result<crate::input::ListObjectsV2Input, ConstraintViolation> {
|
843 + | Ok(crate::input::ListObjectsV2Input {
|
844 + | bucket: self.bucket.ok_or(ConstraintViolation::MissingBucket)?,
|
845 + | delimiter: self.delimiter,
|
846 + | encoding_type: self
|
847 + | .encoding_type
|
848 + | .map(|v| match v {
|
849 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
850 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
851 + | })
|
852 + | .map(|res| res.map_err(ConstraintViolation::EncodingType))
|
853 + | .transpose()?,
|
854 + | max_keys: self.max_keys,
|
855 + | prefix: self.prefix,
|
856 + | continuation_token: self.continuation_token,
|
857 + | fetch_owner: self.fetch_owner,
|
858 + | start_after: self.start_after,
|
859 + | request_payer: self
|
860 + | .request_payer
|
861 + | .map(|v| match v {
|
862 + | crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
|
863 + | crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
|
864 + | })
|
865 + | .map(|res| res.map_err(ConstraintViolation::RequestPayer))
|
866 + | .transpose()?,
|
867 + | expected_bucket_owner: self.expected_bucket_owner,
|
868 + | })
|
869 + | }
|
870 + | }
|
871 + | }
|