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><important>
60/// <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>
61/// </important>
62#[derive(::std::clone::Clone, ::std::fmt::Debug)]
63pub struct PutBucketReplicationFluentBuilder {
64 handle: ::std::sync::Arc<crate::client::Handle>,
65 inner: crate::operation::put_bucket_replication::builders::PutBucketReplicationInputBuilder,
66 config_override: ::std::option::Option<crate::config::Builder>,
67}
68impl
69 crate::client::customize::internal::CustomizableSend<
70 crate::operation::put_bucket_replication::PutBucketReplicationOutput,
71 crate::operation::put_bucket_replication::PutBucketReplicationError,
72 > for PutBucketReplicationFluentBuilder
73{
74 fn send(
75 self,
76 config_override: crate::config::Builder,
77 ) -> crate::client::customize::internal::BoxFuture<
78 crate::client::customize::internal::SendResult<
79 crate::operation::put_bucket_replication::PutBucketReplicationOutput,
80 crate::operation::put_bucket_replication::PutBucketReplicationError,
81 >,
82 > {
83 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
84 }
85}
86impl PutBucketReplicationFluentBuilder {
87 /// Creates a new `PutBucketReplicationFluentBuilder`.
88 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
89 Self {
90 handle,
91 inner: ::std::default::Default::default(),
92 config_override: ::std::option::Option::None,
93 }
94 }
95 /// Access the PutBucketReplication as a reference.
96 pub fn as_input(&self) -> &crate::operation::put_bucket_replication::builders::PutBucketReplicationInputBuilder {
97 &self.inner
98 }
99 /// Sends the request and returns the response.
100 ///
101 /// If an error occurs, an `SdkError` will be returned with additional details that
102 /// can be matched against.
103 ///
104 /// By default, any retryable failures will be retried twice. Retry behavior
105 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
106 /// set when configuring the client.
107 pub async fn send(
108 self,
109 ) -> ::std::result::Result<
110 crate::operation::put_bucket_replication::PutBucketReplicationOutput,
111 ::aws_smithy_runtime_api::client::result::SdkError<
112 crate::operation::put_bucket_replication::PutBucketReplicationError,
113 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
114 >,
115 > {
116 let input = self
117 .inner
118 .build()
119 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
120 let runtime_plugins = crate::operation::put_bucket_replication::PutBucketReplication::operation_runtime_plugins(
121 self.handle.runtime_plugins.clone(),
122 &self.handle.conf,
123 self.config_override,
124 );
125 crate::operation::put_bucket_replication::PutBucketReplication::orchestrate(&runtime_plugins, input).await
126 }
127
128 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
129 pub fn customize(
130 self,
131 ) -> crate::client::customize::CustomizableOperation<
132 crate::operation::put_bucket_replication::PutBucketReplicationOutput,
133 crate::operation::put_bucket_replication::PutBucketReplicationError,
134 Self,
135 > {
136 crate::client::customize::CustomizableOperation::new(self)
137 }
138 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
139 self.set_config_override(::std::option::Option::Some(config_override.into()));
140 self
141 }
142
143 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
144 self.config_override = config_override;
145 self
146 }
147 /// <p>The name of the bucket</p>
148 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149 self.inner = self.inner.bucket(input.into());
150 self
151 }
152 /// <p>The name of the bucket</p>
153 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154 self.inner = self.inner.set_bucket(input);
155 self
156 }
157 /// <p>The name of the bucket</p>
158 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
159 self.inner.get_bucket()
160 }
161 /// <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>
162 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
163 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164 self.inner = self.inner.content_md5(input.into());
165 self
166 }
167 /// <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>
168 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
169 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170 self.inner = self.inner.set_content_md5(input);
171 self
172 }
173 /// <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>
174 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
175 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
176 self.inner.get_content_md5()
177 }
178 /// <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>
179 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
180 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
181 self.inner = self.inner.checksum_algorithm(input);
182 self
183 }
184 /// <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>
185 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
186 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
187 self.inner = self.inner.set_checksum_algorithm(input);
188 self
189 }
190 /// <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>
191 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
192 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
193 self.inner.get_checksum_algorithm()
194 }
195 /// <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>
196 pub fn replication_configuration(mut self, input: crate::types::ReplicationConfiguration) -> Self {
197 self.inner = self.inner.replication_configuration(input);
198 self
199 }
200 /// <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>
201 pub fn set_replication_configuration(mut self, input: ::std::option::Option<crate::types::ReplicationConfiguration>) -> Self {
202 self.inner = self.inner.set_replication_configuration(input);
203 self
204 }
205 /// <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>
206 pub fn get_replication_configuration(&self) -> &::std::option::Option<crate::types::ReplicationConfiguration> {
207 self.inner.get_replication_configuration()
208 }
209 /// <p>A token to allow Object Lock to be enabled for an existing bucket.</p>
210 pub fn token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211 self.inner = self.inner.token(input.into());
212 self
213 }
214 /// <p>A token to allow Object Lock to be enabled for an existing bucket.</p>
215 pub fn set_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
216 self.inner = self.inner.set_token(input);
217 self
218 }
219 /// <p>A token to allow Object Lock to be enabled for an existing bucket.</p>
220 pub fn get_token(&self) -> &::std::option::Option<::std::string::String> {
221 self.inner.get_token()
222 }
223 /// <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>
224 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
225 self.inner = self.inner.expected_bucket_owner(input.into());
226 self
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 set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
230 self.inner = self.inner.set_expected_bucket_owner(input);
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 get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
235 self.inner.get_expected_bucket_owner()
236 }
237}