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 APT 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>
47#[derive(::std::clone::Clone, ::std::fmt::Debug)]
48pub struct RenameObjectFluentBuilder {
49    handle: ::std::sync::Arc<crate::client::Handle>,
50    inner: crate::operation::rename_object::builders::RenameObjectInputBuilder,
51    config_override: ::std::option::Option<crate::config::Builder>,
52}
53impl
54    crate::client::customize::internal::CustomizableSend<
55        crate::operation::rename_object::RenameObjectOutput,
56        crate::operation::rename_object::RenameObjectError,
57    > for RenameObjectFluentBuilder
58{
59    fn send(
60        self,
61        config_override: crate::config::Builder,
62    ) -> crate::client::customize::internal::BoxFuture<
63        crate::client::customize::internal::SendResult<
64            crate::operation::rename_object::RenameObjectOutput,
65            crate::operation::rename_object::RenameObjectError,
66        >,
67    > {
68        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
69    }
70}
71impl RenameObjectFluentBuilder {
72    /// Creates a new `RenameObjectFluentBuilder`.
73    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
74        Self {
75            handle,
76            inner: ::std::default::Default::default(),
77            config_override: ::std::option::Option::None,
78        }
79    }
80    /// Access the RenameObject as a reference.
81    pub fn as_input(&self) -> &crate::operation::rename_object::builders::RenameObjectInputBuilder {
82        &self.inner
83    }
84    /// Sends the request and returns the response.
85    ///
86    /// If an error occurs, an `SdkError` will be returned with additional details that
87    /// can be matched against.
88    ///
89    /// By default, any retryable failures will be retried twice. Retry behavior
90    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
91    /// set when configuring the client.
92    pub async fn send(
93        self,
94    ) -> ::std::result::Result<
95        crate::operation::rename_object::RenameObjectOutput,
96        ::aws_smithy_runtime_api::client::result::SdkError<
97            crate::operation::rename_object::RenameObjectError,
98            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
99        >,
100    > {
101        let input = self
102            .inner
103            .build()
104            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
105        let runtime_plugins = crate::operation::rename_object::RenameObject::operation_runtime_plugins(
106            self.handle.runtime_plugins.clone(),
107            &self.handle.conf,
108            self.config_override,
109        );
110        crate::operation::rename_object::RenameObject::orchestrate(&runtime_plugins, input).await
111    }
112
113    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
114    pub fn customize(
115        self,
116    ) -> crate::client::customize::CustomizableOperation<
117        crate::operation::rename_object::RenameObjectOutput,
118        crate::operation::rename_object::RenameObjectError,
119        Self,
120    > {
121        crate::client::customize::CustomizableOperation::new(self)
122    }
123    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124        self.set_config_override(::std::option::Option::Some(config_override.into()));
125        self
126    }
127
128    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
129        self.config_override = config_override;
130        self
131    }
132    /// <p>The bucket name of the directory bucket containing the object.</p>
133    /// <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>
134    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.bucket(input.into());
136        self
137    }
138    /// <p>The bucket name of the directory bucket containing the object.</p>
139    /// <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>
140    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_bucket(input);
142        self
143    }
144    /// <p>The bucket name of the directory bucket containing the object.</p>
145    /// <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>
146    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
147        self.inner.get_bucket()
148    }
149    /// <p>Key name of the object to rename.</p>
150    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.key(input.into());
152        self
153    }
154    /// <p>Key name of the object to rename.</p>
155    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.inner = self.inner.set_key(input);
157        self
158    }
159    /// <p>Key name of the object to rename.</p>
160    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
161        self.inner.get_key()
162    }
163    /// <p>Specifies the source for the rename operation. The value must be URL encoded.</p>
164    pub fn rename_source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.inner = self.inner.rename_source(input.into());
166        self
167    }
168    /// <p>Specifies the source for the rename operation. The value must be URL encoded.</p>
169    pub fn set_rename_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170        self.inner = self.inner.set_rename_source(input);
171        self
172    }
173    /// <p>Specifies the source for the rename operation. The value must be URL encoded.</p>
174    pub fn get_rename_source(&self) -> &::std::option::Option<::std::string::String> {
175        self.inner.get_rename_source()
176    }
177    /// <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>
178    /// <p>Expects the ETag value as a string.</p>
179    pub fn destination_if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180        self.inner = self.inner.destination_if_match(input.into());
181        self
182    }
183    /// <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>
184    /// <p>Expects the ETag value as a string.</p>
185    pub fn set_destination_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.inner = self.inner.set_destination_if_match(input);
187        self
188    }
189    /// <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>
190    /// <p>Expects the ETag value as a string.</p>
191    pub fn get_destination_if_match(&self) -> &::std::option::Option<::std::string::String> {
192        self.inner.get_destination_if_match()
193    }
194    /// <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>
195    /// <p>Expects the <code>*</code> character (asterisk).</p>
196    pub fn destination_if_none_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        self.inner = self.inner.destination_if_none_match(input.into());
198        self
199    }
200    /// <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>
201    /// <p>Expects the <code>*</code> character (asterisk).</p>
202    pub fn set_destination_if_none_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
203        self.inner = self.inner.set_destination_if_none_match(input);
204        self
205    }
206    /// <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>
207    /// <p>Expects the <code>*</code> character (asterisk).</p>
208    pub fn get_destination_if_none_match(&self) -> &::std::option::Option<::std::string::String> {
209        self.inner.get_destination_if_none_match()
210    }
211    /// <p>Renames the object if the destination exists and if it has been modified since the specified time.</p>
212    pub fn destination_if_modified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
213        self.inner = self.inner.destination_if_modified_since(input);
214        self
215    }
216    /// <p>Renames the object if the destination exists and if it has been modified since the specified time.</p>
217    pub fn set_destination_if_modified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
218        self.inner = self.inner.set_destination_if_modified_since(input);
219        self
220    }
221    /// <p>Renames the object if the destination exists and if it has been modified since the specified time.</p>
222    pub fn get_destination_if_modified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
223        self.inner.get_destination_if_modified_since()
224    }
225    /// <p>Renames the object if it hasn't been modified since the specified time.</p>
226    pub fn destination_if_unmodified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
227        self.inner = self.inner.destination_if_unmodified_since(input);
228        self
229    }
230    /// <p>Renames the object if it hasn't been modified since the specified time.</p>
231    pub fn set_destination_if_unmodified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
232        self.inner = self.inner.set_destination_if_unmodified_since(input);
233        self
234    }
235    /// <p>Renames the object if it hasn't been modified since the specified time.</p>
236    pub fn get_destination_if_unmodified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
237        self.inner.get_destination_if_unmodified_since()
238    }
239    /// <p>Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.</p>
240    pub fn source_if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
241        self.inner = self.inner.source_if_match(input.into());
242        self
243    }
244    /// <p>Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.</p>
245    pub fn set_source_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
246        self.inner = self.inner.set_source_if_match(input);
247        self
248    }
249    /// <p>Renames the object if the source exists and if its entity tag (ETag) matches the specified ETag.</p>
250    pub fn get_source_if_match(&self) -> &::std::option::Option<::std::string::String> {
251        self.inner.get_source_if_match()
252    }
253    /// <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>
254    pub fn source_if_none_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
255        self.inner = self.inner.source_if_none_match(input.into());
256        self
257    }
258    /// <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>
259    pub fn set_source_if_none_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
260        self.inner = self.inner.set_source_if_none_match(input);
261        self
262    }
263    /// <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>
264    pub fn get_source_if_none_match(&self) -> &::std::option::Option<::std::string::String> {
265        self.inner.get_source_if_none_match()
266    }
267    /// <p>Renames the object if the source exists and if it has been modified since the specified time.</p>
268    pub fn source_if_modified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
269        self.inner = self.inner.source_if_modified_since(input);
270        self
271    }
272    /// <p>Renames the object if the source exists and if it has been modified since the specified time.</p>
273    pub fn set_source_if_modified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
274        self.inner = self.inner.set_source_if_modified_since(input);
275        self
276    }
277    /// <p>Renames the object if the source exists and if it has been modified since the specified time.</p>
278    pub fn get_source_if_modified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
279        self.inner.get_source_if_modified_since()
280    }
281    /// <p>Renames the object if the source exists and hasn't been modified since the specified time.</p>
282    pub fn source_if_unmodified_since(mut self, input: ::aws_smithy_types::DateTime) -> Self {
283        self.inner = self.inner.source_if_unmodified_since(input);
284        self
285    }
286    /// <p>Renames the object if the source exists and hasn't been modified since the specified time.</p>
287    pub fn set_source_if_unmodified_since(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
288        self.inner = self.inner.set_source_if_unmodified_since(input);
289        self
290    }
291    /// <p>Renames the object if the source exists and hasn't been modified since the specified time.</p>
292    pub fn get_source_if_unmodified_since(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
293        self.inner.get_source_if_unmodified_since()
294    }
295    /// <p>A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126. <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>
296    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
297        self.inner = self.inner.client_token(input.into());
298        self
299    }
300    /// <p>A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126. <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>
301    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
302        self.inner = self.inner.set_client_token(input);
303        self
304    }
305    /// <p>A unique string with a max of 64 ASCII characters in the ASCII range of 33 - 126. <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    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
307        self.inner.get_client_token()
308    }
309}