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><important>
30/// <p>You must URL encode any signed header values that contain spaces. For example, if your header value is <code>my file.txt</code>, containing two spaces after <code>my</code>, you must URL encode this value to <code>my%20%20file.txt</code>.</p>
31/// </important>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct PutObjectLegalHoldFluentBuilder {
34 handle: ::std::sync::Arc<crate::client::Handle>,
35 inner: crate::operation::put_object_legal_hold::builders::PutObjectLegalHoldInputBuilder,
36 config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39 crate::client::customize::internal::CustomizableSend<
40 crate::operation::put_object_legal_hold::PutObjectLegalHoldOutput,
41 crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
42 > for PutObjectLegalHoldFluentBuilder
43{
44 fn send(
45 self,
46 config_override: crate::config::Builder,
47 ) -> crate::client::customize::internal::BoxFuture<
48 crate::client::customize::internal::SendResult<
49 crate::operation::put_object_legal_hold::PutObjectLegalHoldOutput,
50 crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
51 >,
52 > {
53 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54 }
55}
56impl PutObjectLegalHoldFluentBuilder {
57 /// Creates a new `PutObjectLegalHoldFluentBuilder`.
58 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59 Self {
60 handle,
61 inner: ::std::default::Default::default(),
62 config_override: ::std::option::Option::None,
63 }
64 }
65 /// Access the PutObjectLegalHold as a reference.
66 pub fn as_input(&self) -> &crate::operation::put_object_legal_hold::builders::PutObjectLegalHoldInputBuilder {
67 &self.inner
68 }
69 /// Sends the request and returns the response.
70 ///
71 /// If an error occurs, an `SdkError` will be returned with additional details that
72 /// can be matched against.
73 ///
74 /// By default, any retryable failures will be retried twice. Retry behavior
75 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76 /// set when configuring the client.
77 pub async fn send(
78 self,
79 ) -> ::std::result::Result<
80 crate::operation::put_object_legal_hold::PutObjectLegalHoldOutput,
81 ::aws_smithy_runtime_api::client::result::SdkError<
82 crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
83 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84 >,
85 > {
86 let input = self
87 .inner
88 .build()
89 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90 let runtime_plugins = crate::operation::put_object_legal_hold::PutObjectLegalHold::operation_runtime_plugins(
91 self.handle.runtime_plugins.clone(),
92 &self.handle.conf,
93 self.config_override,
94 );
95 crate::operation::put_object_legal_hold::PutObjectLegalHold::orchestrate(&runtime_plugins, input).await
96 }
97
98 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99 pub fn customize(
100 self,
101 ) -> crate::client::customize::CustomizableOperation<
102 crate::operation::put_object_legal_hold::PutObjectLegalHoldOutput,
103 crate::operation::put_object_legal_hold::PutObjectLegalHoldError,
104 Self,
105 > {
106 crate::client::customize::CustomizableOperation::new(self)
107 }
108 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109 self.set_config_override(::std::option::Option::Some(config_override.into()));
110 self
111 }
112
113 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114 self.config_override = config_override;
115 self
116 }
117 /// <p>The bucket name containing the object that you want to place a legal hold on.</p>
118 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. 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>
119 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.inner = self.inner.bucket(input.into());
121 self
122 }
123 /// <p>The bucket name containing the object that you want to place a legal hold on.</p>
124 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. 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>
125 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126 self.inner = self.inner.set_bucket(input);
127 self
128 }
129 /// <p>The bucket name containing the object that you want to place a legal hold on.</p>
130 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. 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>
131 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
132 self.inner.get_bucket()
133 }
134 /// <p>The key name for the object that you want to place a legal hold on.</p>
135 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.inner = self.inner.key(input.into());
137 self
138 }
139 /// <p>The key name for the object that you want to place a legal hold on.</p>
140 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141 self.inner = self.inner.set_key(input);
142 self
143 }
144 /// <p>The key name for the object that you want to place a legal hold on.</p>
145 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
146 self.inner.get_key()
147 }
148 /// <p>Container element for the legal hold configuration you want to apply to the specified object.</p>
149 pub fn legal_hold(mut self, input: crate::types::ObjectLockLegalHold) -> Self {
150 self.inner = self.inner.legal_hold(input);
151 self
152 }
153 /// <p>Container element for the legal hold configuration you want to apply to the specified object.</p>
154 pub fn set_legal_hold(mut self, input: ::std::option::Option<crate::types::ObjectLockLegalHold>) -> Self {
155 self.inner = self.inner.set_legal_hold(input);
156 self
157 }
158 /// <p>Container element for the legal hold configuration you want to apply to the specified object.</p>
159 pub fn get_legal_hold(&self) -> &::std::option::Option<crate::types::ObjectLockLegalHold> {
160 self.inner.get_legal_hold()
161 }
162 /// <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>
163 /// <p>This functionality is not supported for directory buckets.</p>
164 /// </note>
165 pub fn request_payer(mut self, input: crate::types::RequestPayer) -> Self {
166 self.inner = self.inner.request_payer(input);
167 self
168 }
169 /// <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>
170 /// <p>This functionality is not supported for directory buckets.</p>
171 /// </note>
172 pub fn set_request_payer(mut self, input: ::std::option::Option<crate::types::RequestPayer>) -> Self {
173 self.inner = self.inner.set_request_payer(input);
174 self
175 }
176 /// <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>
177 /// <p>This functionality is not supported for directory buckets.</p>
178 /// </note>
179 pub fn get_request_payer(&self) -> &::std::option::Option<crate::types::RequestPayer> {
180 self.inner.get_request_payer()
181 }
182 /// <p>The version ID of the object that you want to place a legal hold on.</p>
183 pub fn version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184 self.inner = self.inner.version_id(input.into());
185 self
186 }
187 /// <p>The version ID of the object that you want to place a legal hold on.</p>
188 pub fn set_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189 self.inner = self.inner.set_version_id(input);
190 self
191 }
192 /// <p>The version ID of the object that you want to place a legal hold on.</p>
193 pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
194 self.inner.get_version_id()
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 content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199 self.inner = self.inner.content_md5(input.into());
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 set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
205 self.inner = self.inner.set_content_md5(input);
206 self
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 get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
211 self.inner.get_content_md5()
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 checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
216 self.inner = self.inner.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 set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
222 self.inner = self.inner.set_checksum_algorithm(input);
223 self
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 get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
228 self.inner.get_checksum_algorithm()
229 }
230 /// <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>
231 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232 self.inner = self.inner.expected_bucket_owner(input.into());
233 self
234 }
235 /// <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>
236 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
237 self.inner = self.inner.set_expected_bucket_owner(input);
238 self
239 }
240 /// <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>
241 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
242 self.inner.get_expected_bucket_owner()
243 }
244}