aws_sdk_s3/operation/put_object_legal_hold/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_object_legal_hold::_put_object_legal_hold_output::PutObjectLegalHoldOutputBuilder;
3
4pub use crate::operation::put_object_legal_hold::_put_object_legal_hold_input::PutObjectLegalHoldInputBuilder;
5
6impl crate::operation::put_object_legal_hold::builders::PutObjectLegalHoldInputBuilder {
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_legal_hold::PutObjectLegalHoldOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_object_legal_hold();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutObjectLegalHold`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Applies a legal hold configuration to the specified object. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Locking Objects</a>.</p>
29/// <p>This functionality is not supported for Amazon S3 on Outposts.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct PutObjectLegalHoldFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::put_object_legal_hold::builders::PutObjectLegalHoldInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::put_object_legal_hold::PutObjectLegalHoldOutput,
39        crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
40    > for PutObjectLegalHoldFluentBuilder
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_legal_hold::PutObjectLegalHoldOutput,
48            crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl PutObjectLegalHoldFluentBuilder {
55    /// Creates a new `PutObjectLegalHoldFluentBuilder`.
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 PutObjectLegalHold as a reference.
64    pub fn as_input(&self) -> &crate::operation::put_object_legal_hold::builders::PutObjectLegalHoldInputBuilder {
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_legal_hold::PutObjectLegalHoldOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
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_legal_hold::PutObjectLegalHold::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::put_object_legal_hold::PutObjectLegalHold::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_legal_hold::PutObjectLegalHoldOutput,
101        crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
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 containing the object that you want to place a legal hold on.</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 containing the object that you want to place a legal hold on.</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 containing the object that you want to place a legal hold on.</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 place a legal hold on.</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 place a legal hold on.</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 place a legal hold on.</p>
143    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
144        self.inner.get_key()
145    }
146    /// <p>Container element for the legal hold configuration you want to apply to the specified object.</p>
147    pub fn legal_hold(mut self, input: crate::types::ObjectLockLegalHold) -> Self {
148        self.inner = self.inner.legal_hold(input);
149        self
150    }
151    /// <p>Container element for the legal hold configuration you want to apply to the specified object.</p>
152    pub fn set_legal_hold(mut self, input: ::std::option::Option<crate::types::ObjectLockLegalHold>) -> Self {
153        self.inner = self.inner.set_legal_hold(input);
154        self
155    }
156    /// <p>Container element for the legal hold configuration you want to apply to the specified object.</p>
157    pub fn get_legal_hold(&self) -> &::std::option::Option<crate::types::ObjectLockLegalHold> {
158        self.inner.get_legal_hold()
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 of the object that you want to place a legal hold on.</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 of the object that you want to place a legal hold on.</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 of the object that you want to place a legal hold on.</p>
191    pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
192        self.inner.get_version_id()
193    }
194    /// <p>The MD5 hash for the request body.</p>
195    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
196    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        self.inner = self.inner.content_md5(input.into());
198        self
199    }
200    /// <p>The MD5 hash for the request body.</p>
201    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
202    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
203        self.inner = self.inner.set_content_md5(input);
204        self
205    }
206    /// <p>The MD5 hash for the request body.</p>
207    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
208    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
209        self.inner.get_content_md5()
210    }
211    /// <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>
212    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
213    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
214        self.inner = self.inner.checksum_algorithm(input);
215        self
216    }
217    /// <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>
218    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
219    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
220        self.inner = self.inner.set_checksum_algorithm(input);
221        self
222    }
223    /// <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>
224    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
225    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
226        self.inner.get_checksum_algorithm()
227    }
228    /// <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>
229    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
230        self.inner = self.inner.expected_bucket_owner(input.into());
231        self
232    }
233    /// <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>
234    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
235        self.inner = self.inner.set_expected_bucket_owner(input);
236        self
237    }
238    /// <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>
239    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
240        self.inner.get_expected_bucket_owner()
241    }
242}