aws_sdk_s3/operation/rename_object/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::rename_object::_rename_object_output::RenameObjectOutputBuilder;
3
4pub use crate::operation::rename_object::_rename_object_input::RenameObjectInputBuilder;
5
6impl crate::operation::rename_object::builders::RenameObjectInputBuilder {
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::rename_object::RenameObjectOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::rename_object::RenameObjectError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.rename_object();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `RenameObject`.
24///
25/// <p>Renames an existing object in a directory bucket that uses the S3 Express One Zone storage class. You can use <code>RenameObject</code> by specifying an existing object’s name as the source and the new name of the object as the destination within the same directory bucket.</p><note>
26/// <p><code>RenameObject</code> is only supported for objects stored in the S3 Express One Zone storage class.</p>
27/// </note>
28/// <p>To prevent overwriting an object, you can use the <code>If-None-Match</code> conditional header.</p>
29/// <ul>
30/// <li>
31/// <p><b>If-None-Match</b> - Renames the object only if an object with the specified name does not already exist in the directory bucket. If you don't want to overwrite an existing object, you can add the <code>If-None-Match</code> conditional header with the value <code>‘*’</code> in the <code>RenameObject</code> request. Amazon S3 then returns a <code>412 Precondition Failed</code> error if the object with the specified name already exists. For more information, see <a href="https://datatracker.ietf.org/doc/rfc7232/">RFC 7232</a>.</p></li>
32/// </ul>
33/// <dl>
34/// <dt>
35/// Permissions
36/// </dt>
37/// <dd>
38/// <p>To grant access to the <code>RenameObject</code> operation on a directory bucket, we recommend that you use the <code>CreateSession</code> operation for session-based authorization. Specifically, you grant the <code>s3express:CreateSession</code> permission to the directory bucket in a bucket policy or an IAM identity-based policy. Then, you make the <code>CreateSession</code> API call on the directory bucket to obtain a session token. With the session token in your request header, you can make API requests to this operation. After the session token expires, you make another <code>CreateSession</code> API call to generate a new session token for use. The Amazon Web Services CLI and SDKs will create and manage your session including refreshing the session token automatically to avoid service interruptions when a session expires. In your bucket policy, you can specify the <code>s3express:SessionMode</code> condition key to control who can create a <code>ReadWrite</code> or <code>ReadOnly</code> session. A <code>ReadWrite</code> session is required for executing all the Zonal endpoint API operations, including <code>RenameObject</code>. For more information about authorization, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateSession.html"> <code>CreateSession</code> </a>. To learn more about Zonal endpoint API operations, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-create-session.html">Authorizing Zonal endpoint API operations with CreateSession</a> in the <i>Amazon S3 User Guide</i>.</p>
39/// </dd>
40/// <dt>
41/// HTTP Host header syntax
42/// </dt>
43/// <dd>
44/// <p><b>Directory buckets </b> - The HTTP Host header syntax is <code> <i>Bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</code>.</p>
45/// </dd>
46/// </dl><important>
47/// <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>
48/// </important>
49#[derive(::std::clone::Clone, ::std::fmt::Debug)]
50pub struct RenameObjectFluentBuilder {
51 handle: ::std::sync::Arc<crate::client::Handle>,
52 inner: crate::operation::rename_object::builders::RenameObjectInputBuilder,
53 config_override: ::std::option::Option<crate::config::Builder>,
54}
55impl
56 crate::client::customize::internal::CustomizableSend<
57 crate::operation::rename_object::RenameObjectOutput,
58 crate::operation::rename_object::RenameObjectError,
59 > for RenameObjectFluentBuilder
60{
61 fn send(
62 self,
63 config_override: crate::config::Builder,
64 ) -> crate::client::customize::internal::BoxFuture<
65 crate::client::customize::internal::SendResult<
66 crate::operation::rename_object::RenameObjectOutput,
67 crate::operation::rename_object::RenameObjectError,
68 >,
69 > {
70 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
71 }
72}
73impl RenameObjectFluentBuilder {
74 /// Creates a new `RenameObjectFluentBuilder`.
75 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
76 Self {
77 handle,
78 inner: ::std::default::Default::default(),
79 config_override: ::std::option::Option::None,
80 }
81 }
82 /// Access the RenameObject as a reference.
83 pub fn as_input(&self) -> &crate::operation::rename_object::builders::RenameObjectInputBuilder {
84 &self.inner
85 }
86 /// Sends the request and returns the response.
87 ///
88 /// If an error occurs, an `SdkError` will be returned with additional details that
89 /// can be matched against.
90 ///
91 /// By default, any retryable failures will be retried twice. Retry behavior
92 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
93 /// set when configuring the client.
94 pub async fn send(
95 self,
96 ) -> ::std::result::Result<
97 crate::operation::rename_object::RenameObjectOutput,
98 ::aws_smithy_runtime_api::client::result::SdkError<
99 crate::operation::rename_object::RenameObjectError,
100 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
101 >,
102 > {
103 let input = self
104 .inner
105 .build()
106 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
107 let runtime_plugins = crate::operation::rename_object::RenameObject::operation_runtime_plugins(
108 self.handle.runtime_plugins.clone(),
109 &self.handle.conf,
110 self.config_override,
111 );
112 crate::operation::rename_object::RenameObject::orchestrate(&runtime_plugins, input).await
113 }
114
115 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
116 pub fn customize(
117 self,
118 ) -> crate::client::customize::CustomizableOperation<
119 crate::operation::rename_object::RenameObjectOutput,
120 crate::operation::rename_object::RenameObjectError,
121 Self,
122 > {
123 crate::client::customize::CustomizableOperation::new(self)
124 }
125 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
126 self.set_config_override(::std::option::Option::Some(config_override.into()));
127 self
128 }
129
130 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
131 self.config_override = config_override;
132 self
133 }
134 /// <p>The bucket name of the directory bucket containing the object.</p>
135 /// <p>You must use virtual-hosted-style requests in the format <code>Bucket-name.s3express-zone-id.region-code.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the format <code>bucket-base-name--zone-id--x-s3 </code> (for example, <code>amzn-s3-demo-bucket--usw2-az1--x-s3</code>). For information about bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in the <i>Amazon S3 User Guide</i>.</p>
136 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137 self.inner = self.inner.bucket(input.into());
138 self
139 }
140 /// <p>The bucket name of the directory bucket containing the object.</p>
141 /// <p>You must use virtual-hosted-style requests in the format <code>Bucket-name.s3express-zone-id.region-code.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the format <code>bucket-base-name--zone-id--x-s3 </code> (for example, <code>amzn-s3-demo-bucket--usw2-az1--x-s3</code>). For information about bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in the <i>Amazon S3 User Guide</i>.</p>
142 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143 self.inner = self.inner.set_bucket(input);
144 self
145 }
146 /// <p>The bucket name of the directory bucket containing the object.</p>
147 /// <p>You must use virtual-hosted-style requests in the format <code>Bucket-name.s3express-zone-id.region-code.amazonaws.com</code>. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the format <code>bucket-base-name--zone-id--x-s3 </code> (for example, <code>amzn-s3-demo-bucket--usw2-az1--x-s3</code>). For information about bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in the <i>Amazon S3 User Guide</i>.</p>
148 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
149 self.inner.get_bucket()
150 }
151 /// <p>Key name of the object to rename.</p>
152 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153 self.inner = self.inner.key(input.into());
154 self
155 }
156 /// <p>Key name of the object to rename.</p>
157 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158 self.inner = self.inner.set_key(input);
159 self
160 }
161 /// <p>Key name of the object to rename.</p>
162 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
163 self.inner.get_key()
164 }
165 /// <p>Specifies the source for the rename operation. The value must be URL encoded.</p>
166 pub fn rename_source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167 self.inner = self.inner.rename_source(input.into());
168 self
169 }
170 /// <p>Specifies the source for the rename operation. The value must be URL encoded.</p>
171 pub fn set_rename_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172 self.inner = self.inner.set_rename_source(input);
173 self
174 }
175 /// <p>Specifies the source for the rename operation. The value must be URL encoded.</p>
176 pub fn get_rename_source(&self) -> &::std::option::Option<::std::string::String> {
177 self.inner.get_rename_source()
178 }
179 /// <p>Renames the object only if the ETag (entity tag) value provided during the operation matches the ETag of the object in S3. The <code>If-Match</code> header field makes the request method conditional on ETags. If the ETag values do not match, the operation returns a <code>412 Precondition Failed</code> error.</p>
180 /// <p>Expects the ETag value as a string.</p>
181 pub fn destination_if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
182 self.inner = self.inner.destination_if_match(input.into());
183 self
184 }
185 /// <p>Renames the object only if the ETag (entity tag) value provided during the operation matches the ETag of the object in S3. The <code>If-Match</code> header field makes the request method conditional on ETags. If the ETag values do not match, the operation returns a <code>412 Precondition Failed</code> error.</p>
186 /// <p>Expects the ETag value as a string.</p>
187 pub fn set_destination_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
188 self.inner = self.inner.set_destination_if_match(input);
189 self
190 }
191 /// <p>Renames the object only if the ETag (entity tag) value provided during the operation matches the ETag of the object in S3. The <code>If-Match</code> header field makes the request method conditional on ETags. If the ETag values do not match, the operation returns a <code>412 Precondition Failed</code> error.</p>
192 /// <p>Expects the ETag value as a string.</p>
193 pub fn get_destination_if_match(&self) -> &::std::option::Option<::std::string::String> {
194 self.inner.get_destination_if_match()
195 }
196 /// <p>Renames the object only if the destination does not already exist in the specified directory bucket. If the object does exist when you send a request with <code>If-None-Match:*</code>, the S3 API will return a <code>412 Precondition Failed</code> error, preventing an overwrite. The <code>If-None-Match</code> header prevents overwrites of existing data by validating that there's not an object with the same key name already in your directory bucket.</p>
197 /// <p>Expects the <code>*</code> character (asterisk).</p>
198 pub fn destination_if_none_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199 self.inner = self.inner.destination_if_none_match(input.into());
200 self
201 }
202 /// <p>Renames the object only if the destination does not already exist in the specified directory bucket. If the object does exist when you send a request with <code>If-None-Match:*</code>, the S3 API will return a <code>412 Precondition Failed</code> error, preventing an overwrite. The <code>If-None-Match</code> header prevents overwrites of existing data by validating that there's not an object with the same key name already in your directory bucket.</p>
203 /// <p>Expects the <code>*</code> character (asterisk).</p>
204 pub fn set_destination_if_none_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
205 self.inner = self.inner.set_destination_if_none_match(input);
206 self
207 }
208 /// <p>Renames the object only if the destination does not already exist in the specified directory bucket. If the object does exist when you send a request with <code>If-None-Match:*</code>, the S3 API will return a <code>412 Precondition Failed</code> error, preventing an overwrite. The <code>If-None-Match</code> header prevents overwrites of existing data by validating that there's not an object with the same key name already in your directory bucket.</p>
209 /// <p>Expects the <code>*</code> character (asterisk).</p>
210 pub fn get_destination_if_none_match(&self) -> &::std::option::Option<::std::string::String> {
211 self.inner.get_destination_if_none_match()
212 }
213 /// <p>Renames the object if the destination exists and if it has been modified since the specified time.</p>
214 pub fn destination_if_modified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
215 self.inner = self.inner.destination_if_modified_since(input);
216 self
217 }
218 /// <p>Renames the object if the destination exists and if it has been modified since the specified time.</p>
219 pub fn set_destination_if_modified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
220 self.inner = self.inner.set_destination_if_modified_since(input);
221 self
222 }
223 /// <p>Renames the object if the destination exists and if it has been modified since the specified time.</p>
224 pub fn get_destination_if_modified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
225 self.inner.get_destination_if_modified_since()
226 }
227 /// <p>Renames the object if it hasn't been modified since the specified time.</p>
228 pub fn destination_if_unmodified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
229 self.inner = self.inner.destination_if_unmodified_since(input);
230 self
231 }
232 /// <p>Renames the object if it hasn't been modified since the specified time.</p>
233 pub fn set_destination_if_unmodified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
234 self.inner = self.inner.set_destination_if_unmodified_since(input);
235 self
236 }
237 /// <p>Renames the object if it hasn't been modified since the specified time.</p>
238 pub fn get_destination_if_unmodified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
239 self.inner.get_destination_if_unmodified_since()
240 }
241 /// <p>Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.</p>
242 pub fn source_if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
243 self.inner = self.inner.source_if_match(input.into());
244 self
245 }
246 /// <p>Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.</p>
247 pub fn set_source_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
248 self.inner = self.inner.set_source_if_match(input);
249 self
250 }
251 /// <p>Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.</p>
252 pub fn get_source_if_match(&self) -> &::std::option::Option<::std::string::String> {
253 self.inner.get_source_if_match()
254 }
255 /// <p>Renames the object if the source exists and if its entity tag (ETag) is different than the specified ETag. If an asterisk (<code>*</code>) character is provided, the operation will fail and return a <code>412 Precondition Failed</code> error.</p>
256 pub fn source_if_none_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
257 self.inner = self.inner.source_if_none_match(input.into());
258 self
259 }
260 /// <p>Renames the object if the source exists and if its entity tag (ETag) is different than the specified ETag. If an asterisk (<code>*</code>) character is provided, the operation will fail and return a <code>412 Precondition Failed</code> error.</p>
261 pub fn set_source_if_none_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
262 self.inner = self.inner.set_source_if_none_match(input);
263 self
264 }
265 /// <p>Renames the object if the source exists and if its entity tag (ETag) is different than the specified ETag. If an asterisk (<code>*</code>) character is provided, the operation will fail and return a <code>412 Precondition Failed</code> error.</p>
266 pub fn get_source_if_none_match(&self) -> &::std::option::Option<::std::string::String> {
267 self.inner.get_source_if_none_match()
268 }
269 /// <p>Renames the object if the source exists and if it has been modified since the specified time.</p>
270 pub fn source_if_modified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
271 self.inner = self.inner.source_if_modified_since(input);
272 self
273 }
274 /// <p>Renames the object if the source exists and if it has been modified since the specified time.</p>
275 pub fn set_source_if_modified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
276 self.inner = self.inner.set_source_if_modified_since(input);
277 self
278 }
279 /// <p>Renames the object if the source exists and if it has been modified since the specified time.</p>
280 pub fn get_source_if_modified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
281 self.inner.get_source_if_modified_since()
282 }
283 /// <p>Renames the object if the source exists and hasn't been modified since the specified time.</p>
284 pub fn source_if_unmodified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
285 self.inner = self.inner.source_if_unmodified_since(input);
286 self
287 }
288 /// <p>Renames the object if the source exists and hasn't been modified since the specified time.</p>
289 pub fn set_source_if_unmodified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
290 self.inner = self.inner.set_source_if_unmodified_since(input);
291 self
292 }
293 /// <p>Renames the object if the source exists and hasn't been modified since the specified time.</p>
294 pub fn get_source_if_unmodified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
295 self.inner.get_source_if_unmodified_since()
296 }
297 /// <p>A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126.</p><note>
298 /// <p><code>RenameObject</code> supports idempotency using a client token. To make an idempotent API request using <code>RenameObject</code>, specify a client token in the request. You should not reuse the same client token for other API requests. If you retry a request that completed successfully using the same client token and the same parameters, the retry succeeds without performing any further actions. If you retry a successful request using the same client token, but one or more of the parameters are different, the retry fails and an <code>IdempotentParameterMismatch</code> error is returned.</p>
299 /// </note>
300 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
301 self.inner = self.inner.client_token(input.into());
302 self
303 }
304 /// <p>A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126.</p><note>
305 /// <p><code>RenameObject</code> supports idempotency using a client token. To make an idempotent API request using <code>RenameObject</code>, specify a client token in the request. You should not reuse the same client token for other API requests. If you retry a request that completed successfully using the same client token and the same parameters, the retry succeeds without performing any further actions. If you retry a successful request using the same client token, but one or more of the parameters are different, the retry fails and an <code>IdempotentParameterMismatch</code> error is returned.</p>
306 /// </note>
307 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
308 self.inner = self.inner.set_client_token(input);
309 self
310 }
311 /// <p>A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126.</p><note>
312 /// <p><code>RenameObject</code> supports idempotency using a client token. To make an idempotent API request using <code>RenameObject</code>, specify a client token in the request. You should not reuse the same client token for other API requests. If you retry a request that completed successfully using the same client token and the same parameters, the retry succeeds without performing any further actions. If you retry a successful request using the same client token, but one or more of the parameters are different, the retry fails and an <code>IdempotentParameterMismatch</code> error is returned.</p>
313 /// </note>
314 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
315 self.inner.get_client_token()
316 }
317}