aws_sdk_s3/operation/put_bucket_ownership_controls/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_ownership_controls::_put_bucket_ownership_controls_output::PutBucketOwnershipControlsOutputBuilder;
3
4pub use crate::operation::put_bucket_ownership_controls::_put_bucket_ownership_controls_input::PutBucketOwnershipControlsInputBuilder;
5
6impl crate::operation::put_bucket_ownership_controls::builders::PutBucketOwnershipControlsInputBuilder {
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_ownership_controls::PutBucketOwnershipControlsOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_bucket_ownership_controls();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutBucketOwnershipControls`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Creates or modifies <code>OwnershipControls</code> for an Amazon S3 bucket. To use this operation, you must have the <code>s3:PutBucketOwnershipControls</code> permission. For more information about Amazon S3 permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/using-with-s3-actions.html">Specifying permissions in a policy</a>.</p>
29/// <p>For information about Amazon S3 Object Ownership, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/user-guide/about-object-ownership.html">Using object ownership</a>.</p>
30/// <p>The following operations are related to <code>PutBucketOwnershipControls</code>:</p>
31/// <ul>
32/// <li>
33/// <p><code>GetBucketOwnershipControls</code></p></li>
34/// <li>
35/// <p><code>DeleteBucketOwnershipControls</code></p></li>
36/// </ul><important>
37/// <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>
38/// </important>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct PutBucketOwnershipControlsFluentBuilder {
41 handle: ::std::sync::Arc<crate::client::Handle>,
42 inner: crate::operation::put_bucket_ownership_controls::builders::PutBucketOwnershipControlsInputBuilder,
43 config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46 crate::client::customize::internal::CustomizableSend<
47 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsOutput,
48 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsError,
49 > for PutBucketOwnershipControlsFluentBuilder
50{
51 fn send(
52 self,
53 config_override: crate::config::Builder,
54 ) -> crate::client::customize::internal::BoxFuture<
55 crate::client::customize::internal::SendResult<
56 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsOutput,
57 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsError,
58 >,
59 > {
60 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61 }
62}
63impl PutBucketOwnershipControlsFluentBuilder {
64 /// Creates a new `PutBucketOwnershipControlsFluentBuilder`.
65 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66 Self {
67 handle,
68 inner: ::std::default::Default::default(),
69 config_override: ::std::option::Option::None,
70 }
71 }
72 /// Access the PutBucketOwnershipControls as a reference.
73 pub fn as_input(&self) -> &crate::operation::put_bucket_ownership_controls::builders::PutBucketOwnershipControlsInputBuilder {
74 &self.inner
75 }
76 /// Sends the request and returns the response.
77 ///
78 /// If an error occurs, an `SdkError` will be returned with additional details that
79 /// can be matched against.
80 ///
81 /// By default, any retryable failures will be retried twice. Retry behavior
82 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83 /// set when configuring the client.
84 pub async fn send(
85 self,
86 ) -> ::std::result::Result<
87 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsOutput,
88 ::aws_smithy_runtime_api::client::result::SdkError<
89 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsError,
90 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91 >,
92 > {
93 let input = self
94 .inner
95 .build()
96 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97 let runtime_plugins = crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControls::operation_runtime_plugins(
98 self.handle.runtime_plugins.clone(),
99 &self.handle.conf,
100 self.config_override,
101 );
102 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControls::orchestrate(&runtime_plugins, input).await
103 }
104
105 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106 pub fn customize(
107 self,
108 ) -> crate::client::customize::CustomizableOperation<
109 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsOutput,
110 crate::operation::put_bucket_ownership_controls::PutBucketOwnershipControlsError,
111 Self,
112 > {
113 crate::client::customize::CustomizableOperation::new(self)
114 }
115 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116 self.set_config_override(::std::option::Option::Some(config_override.into()));
117 self
118 }
119
120 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121 self.config_override = config_override;
122 self
123 }
124 /// <p>The name of the Amazon S3 bucket whose <code>OwnershipControls</code> you want to set.</p>
125 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126 self.inner = self.inner.bucket(input.into());
127 self
128 }
129 /// <p>The name of the Amazon S3 bucket whose <code>OwnershipControls</code> you want to set.</p>
130 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131 self.inner = self.inner.set_bucket(input);
132 self
133 }
134 /// <p>The name of the Amazon S3 bucket whose <code>OwnershipControls</code> you want to set.</p>
135 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_bucket()
137 }
138 /// <p>The MD5 hash of the <code>OwnershipControls</code> request body.</p>
139 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
140 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141 self.inner = self.inner.content_md5(input.into());
142 self
143 }
144 /// <p>The MD5 hash of the <code>OwnershipControls</code> request body.</p>
145 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
146 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147 self.inner = self.inner.set_content_md5(input);
148 self
149 }
150 /// <p>The MD5 hash of the <code>OwnershipControls</code> request body.</p>
151 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
152 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
153 self.inner.get_content_md5()
154 }
155 /// <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>
156 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157 self.inner = self.inner.expected_bucket_owner(input.into());
158 self
159 }
160 /// <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>
161 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162 self.inner = self.inner.set_expected_bucket_owner(input);
163 self
164 }
165 /// <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>
166 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
167 self.inner.get_expected_bucket_owner()
168 }
169 /// <p>The <code>OwnershipControls</code> (BucketOwnerEnforced, BucketOwnerPreferred, or ObjectWriter) that you want to apply to this Amazon S3 bucket.</p>
170 pub fn ownership_controls(mut self, input: crate::types::OwnershipControls) -> Self {
171 self.inner = self.inner.ownership_controls(input);
172 self
173 }
174 /// <p>The <code>OwnershipControls</code> (BucketOwnerEnforced, BucketOwnerPreferred, or ObjectWriter) that you want to apply to this Amazon S3 bucket.</p>
175 pub fn set_ownership_controls(mut self, input: ::std::option::Option<crate::types::OwnershipControls>) -> Self {
176 self.inner = self.inner.set_ownership_controls(input);
177 self
178 }
179 /// <p>The <code>OwnershipControls</code> (BucketOwnerEnforced, BucketOwnerPreferred, or ObjectWriter) that you want to apply to this Amazon S3 bucket.</p>
180 pub fn get_ownership_controls(&self) -> &::std::option::Option<crate::types::OwnershipControls> {
181 self.inner.get_ownership_controls()
182 }
183 /// <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-<i>algorithm</i> </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>
184 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
185 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
186 self.inner = self.inner.checksum_algorithm(input);
187 self
188 }
189 /// <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-<i>algorithm</i> </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>
190 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
191 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
192 self.inner = self.inner.set_checksum_algorithm(input);
193 self
194 }
195 /// <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-<i>algorithm</i> </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>
196 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
197 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
198 self.inner.get_checksum_algorithm()
199 }
200}