aws_sdk_s3/types/_object.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object consists of data and its descriptive metadata.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Object {
7 /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
8 pub key: ::std::option::Option<::std::string::String>,
9 /// <p>Creation date of the object.</p>
10 pub last_modified: ::std::option::Option<::aws_smithy_types::DateTime>,
11 /// <p>The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:</p>
12 /// <ul>
13 /// <li>
14 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.</p></li>
15 /// <li>
16 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p></li>
17 /// <li>
18 /// <p>If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption. If an object is larger than 16 MB, the Amazon Web Services Management Console will upload or copy that object as a Multipart Upload, and therefore the ETag will not be an MD5 digest.</p></li>
19 /// </ul><note>
20 /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
21 /// </note>
22 pub e_tag: ::std::option::Option<::std::string::String>,
23 /// <p>The algorithm that was used to create a checksum of the object.</p>
24 pub checksum_algorithm: ::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>>,
25 /// <p>The checksum type that is used to calculate the object’s checksum value. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
26 pub checksum_type: ::std::option::Option<crate::types::ChecksumType>,
27 /// <p>Size in bytes of the object</p>
28 pub size: ::std::option::Option<i64>,
29 /// <p>The class of storage used to store the object.</p><note>
30 /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
31 /// </note>
32 pub storage_class: ::std::option::Option<crate::types::ObjectStorageClass>,
33 /// <p>The owner of the object</p><note>
34 /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
35 /// </note>
36 pub owner: ::std::option::Option<crate::types::Owner>,
37 /// <p>Specifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html"> Working with archived objects</a> in the <i>Amazon S3 User Guide</i>.</p><note>
38 /// <p>This functionality is not supported for directory buckets. Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
39 /// </note>
40 pub restore_status: ::std::option::Option<crate::types::RestoreStatus>,
41}
42impl Object {
43 /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
44 pub fn key(&self) -> ::std::option::Option<&str> {
45 self.key.as_deref()
46 }
47 /// <p>Creation date of the object.</p>
48 pub fn last_modified(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
49 self.last_modified.as_ref()
50 }
51 /// <p>The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:</p>
52 /// <ul>
53 /// <li>
54 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.</p></li>
55 /// <li>
56 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p></li>
57 /// <li>
58 /// <p>If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption. If an object is larger than 16 MB, the Amazon Web Services Management Console will upload or copy that object as a Multipart Upload, and therefore the ETag will not be an MD5 digest.</p></li>
59 /// </ul><note>
60 /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
61 /// </note>
62 pub fn e_tag(&self) -> ::std::option::Option<&str> {
63 self.e_tag.as_deref()
64 }
65 /// <p>The algorithm that was used to create a checksum of the object.</p>
66 ///
67 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.checksum_algorithm.is_none()`.
68 pub fn checksum_algorithm(&self) -> &[crate::types::ChecksumAlgorithm] {
69 self.checksum_algorithm.as_deref().unwrap_or_default()
70 }
71 /// <p>The checksum type that is used to calculate the object’s checksum value. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
72 pub fn checksum_type(&self) -> ::std::option::Option<&crate::types::ChecksumType> {
73 self.checksum_type.as_ref()
74 }
75 /// <p>Size in bytes of the object</p>
76 pub fn size(&self) -> ::std::option::Option<i64> {
77 self.size
78 }
79 /// <p>The class of storage used to store the object.</p><note>
80 /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
81 /// </note>
82 pub fn storage_class(&self) -> ::std::option::Option<&crate::types::ObjectStorageClass> {
83 self.storage_class.as_ref()
84 }
85 /// <p>The owner of the object</p><note>
86 /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
87 /// </note>
88 pub fn owner(&self) -> ::std::option::Option<&crate::types::Owner> {
89 self.owner.as_ref()
90 }
91 /// <p>Specifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html"> Working with archived objects</a> in the <i>Amazon S3 User Guide</i>.</p><note>
92 /// <p>This functionality is not supported for directory buckets. Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
93 /// </note>
94 pub fn restore_status(&self) -> ::std::option::Option<&crate::types::RestoreStatus> {
95 self.restore_status.as_ref()
96 }
97}
98impl Object {
99 /// Creates a new builder-style object to manufacture [`Object`](crate::types::Object).
100 pub fn builder() -> crate::types::builders::ObjectBuilder {
101 crate::types::builders::ObjectBuilder::default()
102 }
103}
104
105/// A builder for [`Object`](crate::types::Object).
106#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
107#[non_exhaustive]
108pub struct ObjectBuilder {
109 pub(crate) key: ::std::option::Option<::std::string::String>,
110 pub(crate) last_modified: ::std::option::Option<::aws_smithy_types::DateTime>,
111 pub(crate) e_tag: ::std::option::Option<::std::string::String>,
112 pub(crate) checksum_algorithm: ::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>>,
113 pub(crate) checksum_type: ::std::option::Option<crate::types::ChecksumType>,
114 pub(crate) size: ::std::option::Option<i64>,
115 pub(crate) storage_class: ::std::option::Option<crate::types::ObjectStorageClass>,
116 pub(crate) owner: ::std::option::Option<crate::types::Owner>,
117 pub(crate) restore_status: ::std::option::Option<crate::types::RestoreStatus>,
118}
119impl ObjectBuilder {
120 /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
121 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122 self.key = ::std::option::Option::Some(input.into());
123 self
124 }
125 /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
126 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127 self.key = input;
128 self
129 }
130 /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
131 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
132 &self.key
133 }
134 /// <p>Creation date of the object.</p>
135 pub fn last_modified(mut self, input: ::aws_smithy_types::DateTime) -> Self {
136 self.last_modified = ::std::option::Option::Some(input);
137 self
138 }
139 /// <p>Creation date of the object.</p>
140 pub fn set_last_modified(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
141 self.last_modified = input;
142 self
143 }
144 /// <p>Creation date of the object.</p>
145 pub fn get_last_modified(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
146 &self.last_modified
147 }
148 /// <p>The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:</p>
149 /// <ul>
150 /// <li>
151 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.</p></li>
152 /// <li>
153 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p></li>
154 /// <li>
155 /// <p>If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption. If an object is larger than 16 MB, the Amazon Web Services Management Console will upload or copy that object as a Multipart Upload, and therefore the ETag will not be an MD5 digest.</p></li>
156 /// </ul><note>
157 /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
158 /// </note>
159 pub fn e_tag(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160 self.e_tag = ::std::option::Option::Some(input.into());
161 self
162 }
163 /// <p>The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:</p>
164 /// <ul>
165 /// <li>
166 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.</p></li>
167 /// <li>
168 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p></li>
169 /// <li>
170 /// <p>If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption. If an object is larger than 16 MB, the Amazon Web Services Management Console will upload or copy that object as a Multipart Upload, and therefore the ETag will not be an MD5 digest.</p></li>
171 /// </ul><note>
172 /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
173 /// </note>
174 pub fn set_e_tag(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175 self.e_tag = input;
176 self
177 }
178 /// <p>The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:</p>
179 /// <ul>
180 /// <li>
181 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.</p></li>
182 /// <li>
183 /// <p>Objects created by the PUT Object, POST Object, or Copy operation, or through the Amazon Web Services Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p></li>
184 /// <li>
185 /// <p>If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption. If an object is larger than 16 MB, the Amazon Web Services Management Console will upload or copy that object as a Multipart Upload, and therefore the ETag will not be an MD5 digest.</p></li>
186 /// </ul><note>
187 /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
188 /// </note>
189 pub fn get_e_tag(&self) -> &::std::option::Option<::std::string::String> {
190 &self.e_tag
191 }
192 /// Appends an item to `checksum_algorithm`.
193 ///
194 /// To override the contents of this collection use [`set_checksum_algorithm`](Self::set_checksum_algorithm).
195 ///
196 /// <p>The algorithm that was used to create a checksum of the object.</p>
197 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
198 let mut v = self.checksum_algorithm.unwrap_or_default();
199 v.push(input);
200 self.checksum_algorithm = ::std::option::Option::Some(v);
201 self
202 }
203 /// <p>The algorithm that was used to create a checksum of the object.</p>
204 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>>) -> Self {
205 self.checksum_algorithm = input;
206 self
207 }
208 /// <p>The algorithm that was used to create a checksum of the object.</p>
209 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>> {
210 &self.checksum_algorithm
211 }
212 /// <p>The checksum type that is used to calculate the object’s checksum value. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
213 pub fn checksum_type(mut self, input: crate::types::ChecksumType) -> Self {
214 self.checksum_type = ::std::option::Option::Some(input);
215 self
216 }
217 /// <p>The checksum type that is used to calculate the object’s checksum value. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
218 pub fn set_checksum_type(mut self, input: ::std::option::Option<crate::types::ChecksumType>) -> Self {
219 self.checksum_type = input;
220 self
221 }
222 /// <p>The checksum type that is used to calculate the object’s checksum value. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html">Checking object integrity</a> in the <i>Amazon S3 User Guide</i>.</p>
223 pub fn get_checksum_type(&self) -> &::std::option::Option<crate::types::ChecksumType> {
224 &self.checksum_type
225 }
226 /// <p>Size in bytes of the object</p>
227 pub fn size(mut self, input: i64) -> Self {
228 self.size = ::std::option::Option::Some(input);
229 self
230 }
231 /// <p>Size in bytes of the object</p>
232 pub fn set_size(mut self, input: ::std::option::Option<i64>) -> Self {
233 self.size = input;
234 self
235 }
236 /// <p>Size in bytes of the object</p>
237 pub fn get_size(&self) -> &::std::option::Option<i64> {
238 &self.size
239 }
240 /// <p>The class of storage used to store the object.</p><note>
241 /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
242 /// </note>
243 pub fn storage_class(mut self, input: crate::types::ObjectStorageClass) -> Self {
244 self.storage_class = ::std::option::Option::Some(input);
245 self
246 }
247 /// <p>The class of storage used to store the object.</p><note>
248 /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
249 /// </note>
250 pub fn set_storage_class(mut self, input: ::std::option::Option<crate::types::ObjectStorageClass>) -> Self {
251 self.storage_class = input;
252 self
253 }
254 /// <p>The class of storage used to store the object.</p><note>
255 /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
256 /// </note>
257 pub fn get_storage_class(&self) -> &::std::option::Option<crate::types::ObjectStorageClass> {
258 &self.storage_class
259 }
260 /// <p>The owner of the object</p><note>
261 /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
262 /// </note>
263 pub fn owner(mut self, input: crate::types::Owner) -> Self {
264 self.owner = ::std::option::Option::Some(input);
265 self
266 }
267 /// <p>The owner of the object</p><note>
268 /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
269 /// </note>
270 pub fn set_owner(mut self, input: ::std::option::Option<crate::types::Owner>) -> Self {
271 self.owner = input;
272 self
273 }
274 /// <p>The owner of the object</p><note>
275 /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
276 /// </note>
277 pub fn get_owner(&self) -> &::std::option::Option<crate::types::Owner> {
278 &self.owner
279 }
280 /// <p>Specifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html"> Working with archived objects</a> in the <i>Amazon S3 User Guide</i>.</p><note>
281 /// <p>This functionality is not supported for directory buckets. Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
282 /// </note>
283 pub fn restore_status(mut self, input: crate::types::RestoreStatus) -> Self {
284 self.restore_status = ::std::option::Option::Some(input);
285 self
286 }
287 /// <p>Specifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html"> Working with archived objects</a> in the <i>Amazon S3 User Guide</i>.</p><note>
288 /// <p>This functionality is not supported for directory buckets. Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
289 /// </note>
290 pub fn set_restore_status(mut self, input: ::std::option::Option<crate::types::RestoreStatus>) -> Self {
291 self.restore_status = input;
292 self
293 }
294 /// <p>Specifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html"> Working with archived objects</a> in the <i>Amazon S3 User Guide</i>.</p><note>
295 /// <p>This functionality is not supported for directory buckets. Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
296 /// </note>
297 pub fn get_restore_status(&self) -> &::std::option::Option<crate::types::RestoreStatus> {
298 &self.restore_status
299 }
300 /// Consumes the builder and constructs a [`Object`](crate::types::Object).
301 pub fn build(self) -> crate::types::Object {
302 crate::types::Object {
303 key: self.key,
304 last_modified: self.last_modified,
305 e_tag: self.e_tag,
306 checksum_algorithm: self.checksum_algorithm,
307 checksum_type: self.checksum_type,
308 size: self.size,
309 storage_class: self.storage_class,
310 owner: self.owner,
311 restore_status: self.restore_status,
312 }
313 }
314}