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