aws_sdk_s3/operation/put_bucket_replication/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_replication::_put_bucket_replication_output::PutBucketReplicationOutputBuilder;
3
4pub use crate::operation::put_bucket_replication::_put_bucket_replication_input::PutBucketReplicationInputBuilder;
5
6impl crate::operation::put_bucket_replication::builders::PutBucketReplicationInputBuilder {
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_bucket_replication::PutBucketReplicationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_bucket_replication::PutBucketReplicationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_bucket_replication();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutBucketReplication`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Creates a replication configuration or replaces an existing one. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html">Replication</a> in the <i>Amazon S3 User Guide</i>.</p>
29/// <p>Specify the replication configuration in the request body. In the replication configuration, you provide the name of the destination bucket or buckets where you want Amazon S3 to replicate objects, the IAM role that Amazon S3 can assume to replicate objects on your behalf, and other relevant information. You can invoke this request for a specific Amazon Web Services Region by using the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requestedregion"> <code>aws:RequestedRegion</code> </a> condition key.</p>
30/// <p>A replication configuration must include at least one rule, and can contain a maximum of 1,000. Each rule identifies a subset of objects to replicate by filtering the objects in the source bucket. To choose additional subsets of objects to replicate, add a rule for each subset.</p>
31/// <p>To specify a subset of the objects in the source bucket to apply a replication rule to, add the Filter element as a child of the Rule element. You can filter objects based on an object key prefix, one or more object tags, or both. When you add the Filter element in the configuration, you must also add the following elements: <code>DeleteMarkerReplication</code>, <code>Status</code>, and <code>Priority</code>.</p><note>
32/// <p>If you are using an earlier version of the replication configuration, Amazon S3 handles replication of delete markers differently. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations">Backward Compatibility</a>.</p>
33/// </note>
34/// <p>For information about enabling versioning on a bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html">Using Versioning</a>.</p>
35/// <dl>
36/// <dt>
37/// Handling Replication of Encrypted Objects
38/// </dt>
39/// <dd>
40/// <p>By default, Amazon S3 doesn't replicate objects that are stored at rest using server-side encryption with KMS keys. To replicate Amazon Web Services KMS-encrypted objects, add the following: <code>SourceSelectionCriteria</code>, <code>SseKmsEncryptedObjects</code>, <code>Status</code>, <code>EncryptionConfiguration</code>, and <code>ReplicaKmsKeyID</code>. For information about replication configuration, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-config-for-kms-objects.html">Replicating Objects Created with SSE Using KMS keys</a>.</p>
41/// <p>For information on <code>PutBucketReplication</code> errors, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ReplicationErrorCodeList">List of replication-related error codes</a></p>
42/// </dd>
43/// <dt>
44/// Permissions
45/// </dt>
46/// <dd>
47/// <p>To create a <code>PutBucketReplication</code> request, you must have <code>s3:PutReplicationConfiguration</code> permissions for the bucket.</p>
48/// <p>By default, a resource owner, in this case the Amazon Web Services account that created the bucket, can perform this operation. The resource owner can also grant others permissions to perform the operation. For more information about permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html">Specifying Permissions in a Policy</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html">Managing Access Permissions to Your Amazon S3 Resources</a>.</p><note>
49/// <p>To perform this operation, the user or role performing the action must have the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html">iam:PassRole</a> permission.</p>
50/// </note>
51/// </dd>
52/// </dl>
53/// <p>The following operations are related to <code>PutBucketReplication</code>:</p>
54/// <ul>
55/// <li>
56/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketReplication.html">GetBucketReplication</a></p></li>
57/// <li>
58/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketReplication.html">DeleteBucketReplication</a></p></li>
59/// </ul>
60#[derive(::std::clone::Clone, ::std::fmt::Debug)]
61pub struct PutBucketReplicationFluentBuilder {
62    handle: ::std::sync::Arc<crate::client::Handle>,
63    inner: crate::operation::put_bucket_replication::builders::PutBucketReplicationInputBuilder,
64    config_override: ::std::option::Option<crate::config::Builder>,
65}
66impl
67    crate::client::customize::internal::CustomizableSend<
68        crate::operation::put_bucket_replication::PutBucketReplicationOutput,
69        crate::operation::put_bucket_replication::PutBucketReplicationError,
70    > for PutBucketReplicationFluentBuilder
71{
72    fn send(
73        self,
74        config_override: crate::config::Builder,
75    ) -> crate::client::customize::internal::BoxFuture<
76        crate::client::customize::internal::SendResult<
77            crate::operation::put_bucket_replication::PutBucketReplicationOutput,
78            crate::operation::put_bucket_replication::PutBucketReplicationError,
79        >,
80    > {
81        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
82    }
83}
84impl PutBucketReplicationFluentBuilder {
85    /// Creates a new `PutBucketReplicationFluentBuilder`.
86    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
87        Self {
88            handle,
89            inner: ::std::default::Default::default(),
90            config_override: ::std::option::Option::None,
91        }
92    }
93    /// Access the PutBucketReplication as a reference.
94    pub fn as_input(&self) -> &crate::operation::put_bucket_replication::builders::PutBucketReplicationInputBuilder {
95        &self.inner
96    }
97    /// Sends the request and returns the response.
98    ///
99    /// If an error occurs, an `SdkError` will be returned with additional details that
100    /// can be matched against.
101    ///
102    /// By default, any retryable failures will be retried twice. Retry behavior
103    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
104    /// set when configuring the client.
105    pub async fn send(
106        self,
107    ) -> ::std::result::Result<
108        crate::operation::put_bucket_replication::PutBucketReplicationOutput,
109        ::aws_smithy_runtime_api::client::result::SdkError<
110            crate::operation::put_bucket_replication::PutBucketReplicationError,
111            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
112        >,
113    > {
114        let input = self
115            .inner
116            .build()
117            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
118        let runtime_plugins = crate::operation::put_bucket_replication::PutBucketReplication::operation_runtime_plugins(
119            self.handle.runtime_plugins.clone(),
120            &self.handle.conf,
121            self.config_override,
122        );
123        crate::operation::put_bucket_replication::PutBucketReplication::orchestrate(&runtime_plugins, input).await
124    }
125
126    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
127    pub fn customize(
128        self,
129    ) -> crate::client::customize::CustomizableOperation<
130        crate::operation::put_bucket_replication::PutBucketReplicationOutput,
131        crate::operation::put_bucket_replication::PutBucketReplicationError,
132        Self,
133    > {
134        crate::client::customize::CustomizableOperation::new(self)
135    }
136    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
137        self.set_config_override(::std::option::Option::Some(config_override.into()));
138        self
139    }
140
141    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
142        self.config_override = config_override;
143        self
144    }
145    /// <p>The name of the bucket</p>
146    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.bucket(input.into());
148        self
149    }
150    /// <p>The name of the bucket</p>
151    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_bucket(input);
153        self
154    }
155    /// <p>The name of the bucket</p>
156    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_bucket()
158    }
159    /// <p>The Base64 encoded 128-bit <code>MD5</code> digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>.</p>
160    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
161    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.inner = self.inner.content_md5(input.into());
163        self
164    }
165    /// <p>The Base64 encoded 128-bit <code>MD5</code> digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>.</p>
166    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
167    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_content_md5(input);
169        self
170    }
171    /// <p>The Base64 encoded 128-bit <code>MD5</code> digest of the data. You must use this header as a message integrity check to verify that the request body was not corrupted in transit. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>.</p>
172    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
173    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_content_md5()
175    }
176    /// <p>Indicates the algorithm used to create the checksum for the request 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>
177    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
178    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
179        self.inner = self.inner.checksum_algorithm(input);
180        self
181    }
182    /// <p>Indicates the algorithm used to create the checksum for the request 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>
183    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
184    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
185        self.inner = self.inner.set_checksum_algorithm(input);
186        self
187    }
188    /// <p>Indicates the algorithm used to create the checksum for the request 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>
189    /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
190    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
191        self.inner.get_checksum_algorithm()
192    }
193    /// <p>A container for replication rules. You can add up to 1,000 rules. The maximum size of a replication configuration is 2 MB.</p>
194    pub fn replication_configuration(mut self, input: crate::types::ReplicationConfiguration) -> Self {
195        self.inner = self.inner.replication_configuration(input);
196        self
197    }
198    /// <p>A container for replication rules. You can add up to 1,000 rules. The maximum size of a replication configuration is 2 MB.</p>
199    pub fn set_replication_configuration(mut self, input: ::std::option::Option<crate::types::ReplicationConfiguration>) -> Self {
200        self.inner = self.inner.set_replication_configuration(input);
201        self
202    }
203    /// <p>A container for replication rules. You can add up to 1,000 rules. The maximum size of a replication configuration is 2 MB.</p>
204    pub fn get_replication_configuration(&self) -> &::std::option::Option<crate::types::ReplicationConfiguration> {
205        self.inner.get_replication_configuration()
206    }
207    /// <p>A token to allow Object Lock to be enabled for an existing bucket.</p>
208    pub fn token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.inner = self.inner.token(input.into());
210        self
211    }
212    /// <p>A token to allow Object Lock to be enabled for an existing bucket.</p>
213    pub fn set_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214        self.inner = self.inner.set_token(input);
215        self
216    }
217    /// <p>A token to allow Object Lock to be enabled for an existing bucket.</p>
218    pub fn get_token(&self) -> &::std::option::Option<::std::string::String> {
219        self.inner.get_token()
220    }
221    /// <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>
222    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
223        self.inner = self.inner.expected_bucket_owner(input.into());
224        self
225    }
226    /// <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>
227    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
228        self.inner = self.inner.set_expected_bucket_owner(input);
229        self
230    }
231    /// <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>
232    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
233        self.inner.get_expected_bucket_owner()
234    }
235}