aws_sdk_s3/types/_delete.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Container for the objects to delete.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Delete {
7 /// <p>The object to delete.</p><note>
8 /// <p><b>Directory buckets</b> - For directory buckets, an object that's composed entirely of whitespace characters is not supported by the <code>DeleteObjects</code> API operation. The request will receive a <code>400 Bad Request</code> error and none of the objects in the request will be deleted.</p>
9 /// </note>
10 pub objects: ::std::vec::Vec<crate::types::ObjectIdentifier>,
11 /// <p>Element to enable quiet mode for the request. When you add this element, you must set its value to <code>true</code>.</p>
12 pub quiet: ::std::option::Option<bool>,
13}
14impl Delete {
15 /// <p>The object to delete.</p><note>
16 /// <p><b>Directory buckets</b> - For directory buckets, an object that's composed entirely of whitespace characters is not supported by the <code>DeleteObjects</code> API operation. The request will receive a <code>400 Bad Request</code> error and none of the objects in the request will be deleted.</p>
17 /// </note>
18 pub fn objects(&self) -> &[crate::types::ObjectIdentifier] {
19 use std::ops::Deref;
20 self.objects.deref()
21 }
22 /// <p>Element to enable quiet mode for the request. When you add this element, you must set its value to <code>true</code>.</p>
23 pub fn quiet(&self) -> ::std::option::Option<bool> {
24 self.quiet
25 }
26}
27impl Delete {
28 /// Creates a new builder-style object to manufacture [`Delete`](crate::types::Delete).
29 pub fn builder() -> crate::types::builders::DeleteBuilder {
30 crate::types::builders::DeleteBuilder::default()
31 }
32}
33
34/// A builder for [`Delete`](crate::types::Delete).
35#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
36#[non_exhaustive]
37pub struct DeleteBuilder {
38 pub(crate) objects: ::std::option::Option<::std::vec::Vec<crate::types::ObjectIdentifier>>,
39 pub(crate) quiet: ::std::option::Option<bool>,
40}
41impl DeleteBuilder {
42 /// Appends an item to `objects`.
43 ///
44 /// To override the contents of this collection use [`set_objects`](Self::set_objects).
45 ///
46 /// <p>The object to delete.</p><note>
47 /// <p><b>Directory buckets</b> - For directory buckets, an object that's composed entirely of whitespace characters is not supported by the <code>DeleteObjects</code> API operation. The request will receive a <code>400 Bad Request</code> error and none of the objects in the request will be deleted.</p>
48 /// </note>
49 pub fn objects(mut self, input: crate::types::ObjectIdentifier) -> Self {
50 let mut v = self.objects.unwrap_or_default();
51 v.push(input);
52 self.objects = ::std::option::Option::Some(v);
53 self
54 }
55 /// <p>The object to delete.</p><note>
56 /// <p><b>Directory buckets</b> - For directory buckets, an object that's composed entirely of whitespace characters is not supported by the <code>DeleteObjects</code> API operation. The request will receive a <code>400 Bad Request</code> error and none of the objects in the request will be deleted.</p>
57 /// </note>
58 pub fn set_objects(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ObjectIdentifier>>) -> Self {
59 self.objects = input;
60 self
61 }
62 /// <p>The object to delete.</p><note>
63 /// <p><b>Directory buckets</b> - For directory buckets, an object that's composed entirely of whitespace characters is not supported by the <code>DeleteObjects</code> API operation. The request will receive a <code>400 Bad Request</code> error and none of the objects in the request will be deleted.</p>
64 /// </note>
65 pub fn get_objects(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ObjectIdentifier>> {
66 &self.objects
67 }
68 /// <p>Element to enable quiet mode for the request. When you add this element, you must set its value to <code>true</code>.</p>
69 pub fn quiet(mut self, input: bool) -> Self {
70 self.quiet = ::std::option::Option::Some(input);
71 self
72 }
73 /// <p>Element to enable quiet mode for the request. When you add this element, you must set its value to <code>true</code>.</p>
74 pub fn set_quiet(mut self, input: ::std::option::Option<bool>) -> Self {
75 self.quiet = input;
76 self
77 }
78 /// <p>Element to enable quiet mode for the request. When you add this element, you must set its value to <code>true</code>.</p>
79 pub fn get_quiet(&self) -> &::std::option::Option<bool> {
80 &self.quiet
81 }
82 /// Consumes the builder and constructs a [`Delete`](crate::types::Delete).
83 /// This method will fail if any of the following fields are not set:
84 /// - [`objects`](crate::types::builders::DeleteBuilder::objects)
85 pub fn build(self) -> ::std::result::Result<crate::types::Delete, ::aws_smithy_types::error::operation::BuildError> {
86 ::std::result::Result::Ok(crate::types::Delete {
87 objects: self.objects.ok_or_else(|| {
88 ::aws_smithy_types::error::operation::BuildError::missing_field(
89 "objects",
90 "objects was not specified but it is required when building Delete",
91 )
92 })?,
93 quiet: self.quiet,
94 })
95 }
96}