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>Size in bytes of the object</p>
26    pub size: ::std::option::Option<i64>,
27    /// <p>The class of storage used to store the object.</p><note>
28    /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
29    /// </note>
30    pub storage_class: ::std::option::Option<crate::types::ObjectStorageClass>,
31    /// <p>The owner of the object</p><note>
32    /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
33    /// </note>
34    pub owner: ::std::option::Option<crate::types::Owner>,
35    /// <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>
36    /// <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>
37    /// </note>
38    pub restore_status: ::std::option::Option<crate::types::RestoreStatus>,
39}
40impl Object {
41    /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
42    pub fn key(&self) -> ::std::option::Option<&str> {
43        self.key.as_deref()
44    }
45    /// <p>Creation date of the object.</p>
46    pub fn last_modified(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
47        self.last_modified.as_ref()
48    }
49    /// <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>
50    /// <ul>
51    /// <li>
52    /// <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>
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-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.</p></li>
55    /// <li>
56    /// <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>
57    /// </ul><note>
58    /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
59    /// </note>
60    pub fn e_tag(&self) -> ::std::option::Option<&str> {
61        self.e_tag.as_deref()
62    }
63    /// <p>The algorithm that was used to create a checksum of the object.</p>
64    ///
65    /// 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()`.
66    pub fn checksum_algorithm(&self) -> &[crate::types::ChecksumAlgorithm] {
67        self.checksum_algorithm.as_deref().unwrap_or_default()
68    }
69    /// <p>Size in bytes of the object</p>
70    pub fn size(&self) -> ::std::option::Option<i64> {
71        self.size
72    }
73    /// <p>The class of storage used to store the object.</p><note>
74    /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
75    /// </note>
76    pub fn storage_class(&self) -> ::std::option::Option<&crate::types::ObjectStorageClass> {
77        self.storage_class.as_ref()
78    }
79    /// <p>The owner of the object</p><note>
80    /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
81    /// </note>
82    pub fn owner(&self) -> ::std::option::Option<&crate::types::Owner> {
83        self.owner.as_ref()
84    }
85    /// <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>
86    /// <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>
87    /// </note>
88    pub fn restore_status(&self) -> ::std::option::Option<&crate::types::RestoreStatus> {
89        self.restore_status.as_ref()
90    }
91}
92impl Object {
93    /// Creates a new builder-style object to manufacture [`Object`](crate::types::Object).
94    pub fn builder() -> crate::types::builders::ObjectBuilder {
95        crate::types::builders::ObjectBuilder::default()
96    }
97}
98
99/// A builder for [`Object`](crate::types::Object).
100#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
101#[non_exhaustive]
102pub struct ObjectBuilder {
103    pub(crate) key: ::std::option::Option<::std::string::String>,
104    pub(crate) last_modified: ::std::option::Option<::aws_smithy_types::DateTime>,
105    pub(crate) e_tag: ::std::option::Option<::std::string::String>,
106    pub(crate) checksum_algorithm: ::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>>,
107    pub(crate) size: ::std::option::Option<i64>,
108    pub(crate) storage_class: ::std::option::Option<crate::types::ObjectStorageClass>,
109    pub(crate) owner: ::std::option::Option<crate::types::Owner>,
110    pub(crate) restore_status: ::std::option::Option<crate::types::RestoreStatus>,
111}
112impl ObjectBuilder {
113    /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
114    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.key = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
119    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.key = input;
121        self
122    }
123    /// <p>The name that you assign to an object. You use the object key to retrieve the object.</p>
124    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
125        &self.key
126    }
127    /// <p>Creation date of the object.</p>
128    pub fn last_modified(mut self, input: ::aws_smithy_types::DateTime) -> Self {
129        self.last_modified = ::std::option::Option::Some(input);
130        self
131    }
132    /// <p>Creation date of the object.</p>
133    pub fn set_last_modified(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
134        self.last_modified = input;
135        self
136    }
137    /// <p>Creation date of the object.</p>
138    pub fn get_last_modified(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
139        &self.last_modified
140    }
141    /// <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>
142    /// <ul>
143    /// <li>
144    /// <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>
145    /// <li>
146    /// <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>
147    /// <li>
148    /// <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>
149    /// </ul><note>
150    /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
151    /// </note>
152    pub fn e_tag(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.e_tag = ::std::option::Option::Some(input.into());
154        self
155    }
156    /// <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>
157    /// <ul>
158    /// <li>
159    /// <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>
160    /// <li>
161    /// <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>
162    /// <li>
163    /// <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>
164    /// </ul><note>
165    /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
166    /// </note>
167    pub fn set_e_tag(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.e_tag = input;
169        self
170    }
171    /// <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>
172    /// <ul>
173    /// <li>
174    /// <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>
175    /// <li>
176    /// <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>
177    /// <li>
178    /// <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>
179    /// </ul><note>
180    /// <p><b>Directory buckets</b> - MD5 is not supported by directory buckets.</p>
181    /// </note>
182    pub fn get_e_tag(&self) -> &::std::option::Option<::std::string::String> {
183        &self.e_tag
184    }
185    /// Appends an item to `checksum_algorithm`.
186    ///
187    /// To override the contents of this collection use [`set_checksum_algorithm`](Self::set_checksum_algorithm).
188    ///
189    /// <p>The algorithm that was used to create a checksum of the object.</p>
190    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
191        let mut v = self.checksum_algorithm.unwrap_or_default();
192        v.push(input);
193        self.checksum_algorithm = ::std::option::Option::Some(v);
194        self
195    }
196    /// <p>The algorithm that was used to create a checksum of the object.</p>
197    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>>) -> Self {
198        self.checksum_algorithm = input;
199        self
200    }
201    /// <p>The algorithm that was used to create a checksum of the object.</p>
202    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ChecksumAlgorithm>> {
203        &self.checksum_algorithm
204    }
205    /// <p>Size in bytes of the object</p>
206    pub fn size(mut self, input: i64) -> Self {
207        self.size = ::std::option::Option::Some(input);
208        self
209    }
210    /// <p>Size in bytes of the object</p>
211    pub fn set_size(mut self, input: ::std::option::Option<i64>) -> Self {
212        self.size = input;
213        self
214    }
215    /// <p>Size in bytes of the object</p>
216    pub fn get_size(&self) -> &::std::option::Option<i64> {
217        &self.size
218    }
219    /// <p>The class of storage used to store the object.</p><note>
220    /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
221    /// </note>
222    pub fn storage_class(mut self, input: crate::types::ObjectStorageClass) -> Self {
223        self.storage_class = ::std::option::Option::Some(input);
224        self
225    }
226    /// <p>The class of storage used to store the object.</p><note>
227    /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
228    /// </note>
229    pub fn set_storage_class(mut self, input: ::std::option::Option<crate::types::ObjectStorageClass>) -> Self {
230        self.storage_class = input;
231        self
232    }
233    /// <p>The class of storage used to store the object.</p><note>
234    /// <p><b>Directory buckets</b> - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.</p>
235    /// </note>
236    pub fn get_storage_class(&self) -> &::std::option::Option<crate::types::ObjectStorageClass> {
237        &self.storage_class
238    }
239    /// <p>The owner of the object</p><note>
240    /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
241    /// </note>
242    pub fn owner(mut self, input: crate::types::Owner) -> Self {
243        self.owner = ::std::option::Option::Some(input);
244        self
245    }
246    /// <p>The owner of the object</p><note>
247    /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
248    /// </note>
249    pub fn set_owner(mut self, input: ::std::option::Option<crate::types::Owner>) -> Self {
250        self.owner = input;
251        self
252    }
253    /// <p>The owner of the object</p><note>
254    /// <p><b>Directory buckets</b> - The bucket owner is returned as the object owner.</p>
255    /// </note>
256    pub fn get_owner(&self) -> &::std::option::Option<crate::types::Owner> {
257        &self.owner
258    }
259    /// <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>
260    /// <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>
261    /// </note>
262    pub fn restore_status(mut self, input: crate::types::RestoreStatus) -> Self {
263        self.restore_status = ::std::option::Option::Some(input);
264        self
265    }
266    /// <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>
267    /// <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>
268    /// </note>
269    pub fn set_restore_status(mut self, input: ::std::option::Option<crate::types::RestoreStatus>) -> Self {
270        self.restore_status = input;
271        self
272    }
273    /// <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>
274    /// <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>
275    /// </note>
276    pub fn get_restore_status(&self) -> &::std::option::Option<crate::types::RestoreStatus> {
277        &self.restore_status
278    }
279    /// Consumes the builder and constructs a [`Object`](crate::types::Object).
280    pub fn build(self) -> crate::types::Object {
281        crate::types::Object {
282            key: self.key,
283            last_modified: self.last_modified,
284            e_tag: self.e_tag,
285            checksum_algorithm: self.checksum_algorithm,
286            size: self.size,
287            storage_class: self.storage_class,
288            owner: self.owner,
289            restore_status: self.restore_status,
290        }
291    }
292}