aws_sdk_s3/operation/put_object_retention/
_put_object_retention_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct PutObjectRetentionInput {
6    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
7    /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
8    pub bucket: ::std::option::Option<::std::string::String>,
9    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
10    pub key: ::std::option::Option<::std::string::String>,
11    /// <p>The container element for the Object Retention configuration.</p>
12    pub retention: ::std::option::Option<crate::types::ObjectLockRetention>,
13    /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
14    /// <p>This functionality is not supported for directory buckets.</p>
15    /// </note>
16    pub request_payer: ::std::option::Option<crate::types::RequestPayer>,
17    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
18    pub version_id: ::std::option::Option<::std::string::String>,
19    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
20    pub bypass_governance_retention: ::std::option::Option<bool>,
21    /// <p>The MD5 hash for the request body.</p>
22    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
23    pub content_md5: ::std::option::Option<::std::string::String>,
24    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. 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>
25    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
26    pub checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
27    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
28    pub expected_bucket_owner: ::std::option::Option<::std::string::String>,
29}
30impl PutObjectRetentionInput {
31    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
32    /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
33    pub fn bucket(&self) -> ::std::option::Option<&str> {
34        self.bucket.as_deref()
35    }
36    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
37    pub fn key(&self) -> ::std::option::Option<&str> {
38        self.key.as_deref()
39    }
40    /// <p>The container element for the Object Retention configuration.</p>
41    pub fn retention(&self) -> ::std::option::Option<&crate::types::ObjectLockRetention> {
42        self.retention.as_ref()
43    }
44    /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
45    /// <p>This functionality is not supported for directory buckets.</p>
46    /// </note>
47    pub fn request_payer(&self) -> ::std::option::Option<&crate::types::RequestPayer> {
48        self.request_payer.as_ref()
49    }
50    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
51    pub fn version_id(&self) -> ::std::option::Option<&str> {
52        self.version_id.as_deref()
53    }
54    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
55    pub fn bypass_governance_retention(&self) -> ::std::option::Option<bool> {
56        self.bypass_governance_retention
57    }
58    /// <p>The MD5 hash for the request body.</p>
59    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
60    pub fn content_md5(&self) -> ::std::option::Option<&str> {
61        self.content_md5.as_deref()
62    }
63    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. 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>
64    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
65    pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::types::ChecksumAlgorithm> {
66        self.checksum_algorithm.as_ref()
67    }
68    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
69    pub fn expected_bucket_owner(&self) -> ::std::option::Option<&str> {
70        self.expected_bucket_owner.as_deref()
71    }
72}
73impl PutObjectRetentionInput {
74    /// Creates a new builder-style object to manufacture [`PutObjectRetentionInput`](crate::operation::put_object_retention::PutObjectRetentionInput).
75    pub fn builder() -> crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder {
76        crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder::default()
77    }
78}
79
80/// A builder for [`PutObjectRetentionInput`](crate::operation::put_object_retention::PutObjectRetentionInput).
81#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
82#[non_exhaustive]
83pub struct PutObjectRetentionInputBuilder {
84    pub(crate) bucket: ::std::option::Option<::std::string::String>,
85    pub(crate) key: ::std::option::Option<::std::string::String>,
86    pub(crate) retention: ::std::option::Option<crate::types::ObjectLockRetention>,
87    pub(crate) request_payer: ::std::option::Option<crate::types::RequestPayer>,
88    pub(crate) version_id: ::std::option::Option<::std::string::String>,
89    pub(crate) bypass_governance_retention: ::std::option::Option<bool>,
90    pub(crate) content_md5: ::std::option::Option<::std::string::String>,
91    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
92    pub(crate) expected_bucket_owner: ::std::option::Option<::std::string::String>,
93}
94impl PutObjectRetentionInputBuilder {
95    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
96    /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
97    /// This field is required.
98    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.bucket = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
103    /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
104    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105        self.bucket = input;
106        self
107    }
108    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
109    /// <p><b>Access points</b> - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
110    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
111        &self.bucket
112    }
113    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
114    /// This field is required.
115    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.key = ::std::option::Option::Some(input.into());
117        self
118    }
119    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
120    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.key = input;
122        self
123    }
124    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
125    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
126        &self.key
127    }
128    /// <p>The container element for the Object Retention configuration.</p>
129    pub fn retention(mut self, input: crate::types::ObjectLockRetention) -> Self {
130        self.retention = ::std::option::Option::Some(input);
131        self
132    }
133    /// <p>The container element for the Object Retention configuration.</p>
134    pub fn set_retention(mut self, input: ::std::option::Option<crate::types::ObjectLockRetention>) -> Self {
135        self.retention = input;
136        self
137    }
138    /// <p>The container element for the Object Retention configuration.</p>
139    pub fn get_retention(&self) -> &::std::option::Option<crate::types::ObjectLockRetention> {
140        &self.retention
141    }
142    /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
143    /// <p>This functionality is not supported for directory buckets.</p>
144    /// </note>
145    pub fn request_payer(mut self, input: crate::types::RequestPayer) -> Self {
146        self.request_payer = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
150    /// <p>This functionality is not supported for directory buckets.</p>
151    /// </note>
152    pub fn set_request_payer(mut self, input: ::std::option::Option<crate::types::RequestPayer>) -> Self {
153        self.request_payer = input;
154        self
155    }
156    /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
157    /// <p>This functionality is not supported for directory buckets.</p>
158    /// </note>
159    pub fn get_request_payer(&self) -> &::std::option::Option<crate::types::RequestPayer> {
160        &self.request_payer
161    }
162    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
163    pub fn version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.version_id = ::std::option::Option::Some(input.into());
165        self
166    }
167    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
168    pub fn set_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.version_id = input;
170        self
171    }
172    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
173    pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
174        &self.version_id
175    }
176    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
177    pub fn bypass_governance_retention(mut self, input: bool) -> Self {
178        self.bypass_governance_retention = ::std::option::Option::Some(input);
179        self
180    }
181    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
182    pub fn set_bypass_governance_retention(mut self, input: ::std::option::Option<bool>) -> Self {
183        self.bypass_governance_retention = input;
184        self
185    }
186    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
187    pub fn get_bypass_governance_retention(&self) -> &::std::option::Option<bool> {
188        &self.bypass_governance_retention
189    }
190    /// <p>The MD5 hash for the request body.</p>
191    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
192    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.content_md5 = ::std::option::Option::Some(input.into());
194        self
195    }
196    /// <p>The MD5 hash for the request body.</p>
197    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
198    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199        self.content_md5 = input;
200        self
201    }
202    /// <p>The MD5 hash for the request body.</p>
203    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
204    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
205        &self.content_md5
206    }
207    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. 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>
208    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
209    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
210        self.checksum_algorithm = ::std::option::Option::Some(input);
211        self
212    }
213    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. 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>
214    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
215    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
216        self.checksum_algorithm = input;
217        self
218    }
219    /// <p>Indicates the algorithm used to create the checksum for the object when you use the SDK. This header will not provide any additional functionality if you don't use the SDK. When you send this header, there must be a corresponding <code>x-amz-checksum</code> or <code>x-amz-trailer</code> header sent. Otherwise, Amazon S3 fails the request with the HTTP status code <code>400 Bad Request</code>. 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>
220    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
221    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
222        &self.checksum_algorithm
223    }
224    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
225    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
226        self.expected_bucket_owner = ::std::option::Option::Some(input.into());
227        self
228    }
229    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
230    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
231        self.expected_bucket_owner = input;
232        self
233    }
234    /// <p>The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code <code>403 Forbidden</code> (access denied).</p>
235    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
236        &self.expected_bucket_owner
237    }
238    /// Consumes the builder and constructs a [`PutObjectRetentionInput`](crate::operation::put_object_retention::PutObjectRetentionInput).
239    pub fn build(
240        self,
241    ) -> ::std::result::Result<crate::operation::put_object_retention::PutObjectRetentionInput, ::aws_smithy_types::error::operation::BuildError>
242    {
243        ::std::result::Result::Ok(crate::operation::put_object_retention::PutObjectRetentionInput {
244            bucket: self.bucket,
245            key: self.key,
246            retention: self.retention,
247            request_payer: self.request_payer,
248            version_id: self.version_id,
249            bypass_governance_retention: self.bypass_governance_retention,
250            content_md5: self.content_md5,
251            checksum_algorithm: self.checksum_algorithm,
252            expected_bucket_owner: self.expected_bucket_owner,
253        })
254    }
255}