aws_sdk_s3/operation/put_object_retention/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_object_retention::_put_object_retention_output::PutObjectRetentionOutputBuilder;
3
4pub use crate::operation::put_object_retention::_put_object_retention_input::PutObjectRetentionInputBuilder;
5
6impl crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::put_object_retention::PutObjectRetentionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_object_retention::PutObjectRetentionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_object_retention();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutObjectRetention`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Places an Object Retention configuration on an object. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Locking Objects</a>. Users or accounts require the <code>s3:PutObjectRetention</code> permission in order to place an Object Retention configuration on objects. Bypassing a Governance Retention configuration requires the <code>s3:BypassGovernanceRetention</code> permission.</p>
29/// <p>This functionality is not supported for Amazon S3 on Outposts.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct PutObjectRetentionFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::put_object_retention::PutObjectRetentionOutput,
39        crate::operation::put_object_retention::PutObjectRetentionError,
40    > for PutObjectRetentionFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::put_object_retention::PutObjectRetentionOutput,
48            crate::operation::put_object_retention::PutObjectRetentionError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl PutObjectRetentionFluentBuilder {
55    /// Creates a new `PutObjectRetentionFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the PutObjectRetention as a reference.
64    pub fn as_input(&self) -> &crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::put_object_retention::PutObjectRetentionOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::put_object_retention::PutObjectRetentionError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::put_object_retention::PutObjectRetention::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::put_object_retention::PutObjectRetention::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::put_object_retention::PutObjectRetentionOutput,
101        crate::operation::put_object_retention::PutObjectRetentionError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
116    /// <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>
117    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.bucket(input.into());
119        self
120    }
121    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
122    /// <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>
123    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.inner = self.inner.set_bucket(input);
125        self
126    }
127    /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
128    /// <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>
129    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
130        self.inner.get_bucket()
131    }
132    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
133    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134        self.inner = self.inner.key(input.into());
135        self
136    }
137    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
138    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.inner = self.inner.set_key(input);
140        self
141    }
142    /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
143    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_key()
145    }
146    /// <p>The container element for the Object Retention configuration.</p>
147    pub fn retention(mut self, input: crate::types::ObjectLockRetention) -> Self {
148        self.inner = self.inner.retention(input);
149        self
150    }
151    /// <p>The container element for the Object Retention configuration.</p>
152    pub fn set_retention(mut self, input: ::std::option::Option<crate::types::ObjectLockRetention>) -> Self {
153        self.inner = self.inner.set_retention(input);
154        self
155    }
156    /// <p>The container element for the Object Retention configuration.</p>
157    pub fn get_retention(&self) -> &::std::option::Option<crate::types::ObjectLockRetention> {
158        self.inner.get_retention()
159    }
160    /// <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>
161    /// <p>This functionality is not supported for directory buckets.</p>
162    /// </note>
163    pub fn request_payer(mut self, input: crate::types::RequestPayer) -> Self {
164        self.inner = self.inner.request_payer(input);
165        self
166    }
167    /// <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>
168    /// <p>This functionality is not supported for directory buckets.</p>
169    /// </note>
170    pub fn set_request_payer(mut self, input: ::std::option::Option<crate::types::RequestPayer>) -> Self {
171        self.inner = self.inner.set_request_payer(input);
172        self
173    }
174    /// <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>
175    /// <p>This functionality is not supported for directory buckets.</p>
176    /// </note>
177    pub fn get_request_payer(&self) -> &::std::option::Option<crate::types::RequestPayer> {
178        self.inner.get_request_payer()
179    }
180    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
181    pub fn version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
182        self.inner = self.inner.version_id(input.into());
183        self
184    }
185    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
186    pub fn set_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
187        self.inner = self.inner.set_version_id(input);
188        self
189    }
190    /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
191    pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
192        self.inner.get_version_id()
193    }
194    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
195    pub fn bypass_governance_retention(mut self, input: bool) -> Self {
196        self.inner = self.inner.bypass_governance_retention(input);
197        self
198    }
199    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
200    pub fn set_bypass_governance_retention(mut self, input: ::std::option::Option<bool>) -> Self {
201        self.inner = self.inner.set_bypass_governance_retention(input);
202        self
203    }
204    /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
205    pub fn get_bypass_governance_retention(&self) -> &::std::option::Option<bool> {
206        self.inner.get_bypass_governance_retention()
207    }
208    /// <p>The MD5 hash for the request body.</p>
209    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
210    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211        self.inner = self.inner.content_md5(input.into());
212        self
213    }
214    /// <p>The MD5 hash for the request body.</p>
215    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
216    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
217        self.inner = self.inner.set_content_md5(input);
218        self
219    }
220    /// <p>The MD5 hash for the request body.</p>
221    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
222    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
223        self.inner.get_content_md5()
224    }
225    /// <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>
226    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
227    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
228        self.inner = self.inner.checksum_algorithm(input);
229        self
230    }
231    /// <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>
232    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
233    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
234        self.inner = self.inner.set_checksum_algorithm(input);
235        self
236    }
237    /// <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>
238    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
239    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
240        self.inner.get_checksum_algorithm()
241    }
242    /// <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>
243    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
244        self.inner = self.inner.expected_bucket_owner(input.into());
245        self
246    }
247    /// <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>
248    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
249        self.inner = self.inner.set_expected_bucket_owner(input);
250        self
251    }
252    /// <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>
253    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
254        self.inner.get_expected_bucket_owner()
255    }
256}