aws_sdk_s3/operation/put_object_retention/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_object_retention::_put_object_retention_output::PutObjectRetentionOutputBuilder;
3
4pub use crate::operation::put_object_retention::_put_object_retention_input::PutObjectRetentionInputBuilder;
5
6impl crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder {
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_object_retention::PutObjectRetentionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_object_retention::PutObjectRetentionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_object_retention();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutObjectRetention`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Places an Object Retention configuration on an object. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Locking Objects</a>. Users or accounts require the <code>s3:PutObjectRetention</code> permission in order to place an Object Retention configuration on objects. Bypassing a Governance Retention configuration requires the <code>s3:BypassGovernanceRetention</code> permission.</p>
29/// <p>This functionality is not supported for Amazon S3 on Outposts.</p><important>
30/// <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>
31/// </important>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct PutObjectRetentionFluentBuilder {
34 handle: ::std::sync::Arc<crate::client::Handle>,
35 inner: crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder,
36 config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39 crate::client::customize::internal::CustomizableSend<
40 crate::operation::put_object_retention::PutObjectRetentionOutput,
41 crate::operation::put_object_retention::PutObjectRetentionError,
42 > for PutObjectRetentionFluentBuilder
43{
44 fn send(
45 self,
46 config_override: crate::config::Builder,
47 ) -> crate::client::customize::internal::BoxFuture<
48 crate::client::customize::internal::SendResult<
49 crate::operation::put_object_retention::PutObjectRetentionOutput,
50 crate::operation::put_object_retention::PutObjectRetentionError,
51 >,
52 > {
53 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54 }
55}
56impl PutObjectRetentionFluentBuilder {
57 /// Creates a new `PutObjectRetentionFluentBuilder`.
58 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59 Self {
60 handle,
61 inner: ::std::default::Default::default(),
62 config_override: ::std::option::Option::None,
63 }
64 }
65 /// Access the PutObjectRetention as a reference.
66 pub fn as_input(&self) -> &crate::operation::put_object_retention::builders::PutObjectRetentionInputBuilder {
67 &self.inner
68 }
69 /// Sends the request and returns the response.
70 ///
71 /// If an error occurs, an `SdkError` will be returned with additional details that
72 /// can be matched against.
73 ///
74 /// By default, any retryable failures will be retried twice. Retry behavior
75 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76 /// set when configuring the client.
77 pub async fn send(
78 self,
79 ) -> ::std::result::Result<
80 crate::operation::put_object_retention::PutObjectRetentionOutput,
81 ::aws_smithy_runtime_api::client::result::SdkError<
82 crate::operation::put_object_retention::PutObjectRetentionError,
83 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84 >,
85 > {
86 let input = self
87 .inner
88 .build()
89 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90 let runtime_plugins = crate::operation::put_object_retention::PutObjectRetention::operation_runtime_plugins(
91 self.handle.runtime_plugins.clone(),
92 &self.handle.conf,
93 self.config_override,
94 );
95 crate::operation::put_object_retention::PutObjectRetention::orchestrate(&runtime_plugins, input).await
96 }
97
98 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99 pub fn customize(
100 self,
101 ) -> crate::client::customize::CustomizableOperation<
102 crate::operation::put_object_retention::PutObjectRetentionOutput,
103 crate::operation::put_object_retention::PutObjectRetentionError,
104 Self,
105 > {
106 crate::client::customize::CustomizableOperation::new(self)
107 }
108 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109 self.set_config_override(::std::option::Option::Some(config_override.into()));
110 self
111 }
112
113 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114 self.config_override = config_override;
115 self
116 }
117 /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
118 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
119 pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.inner = self.inner.bucket(input.into());
121 self
122 }
123 /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
124 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
125 pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126 self.inner = self.inner.set_bucket(input);
127 self
128 }
129 /// <p>The bucket name that contains the object you want to apply this Object Retention configuration to.</p>
130 /// <p><b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.</p>
131 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
132 self.inner.get_bucket()
133 }
134 /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
135 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136 self.inner = self.inner.key(input.into());
137 self
138 }
139 /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
140 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141 self.inner = self.inner.set_key(input);
142 self
143 }
144 /// <p>The key name for the object that you want to apply this Object Retention configuration to.</p>
145 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
146 self.inner.get_key()
147 }
148 /// <p>The container element for the Object Retention configuration.</p>
149 pub fn retention(mut self, input: crate::types::ObjectLockRetention) -> Self {
150 self.inner = self.inner.retention(input);
151 self
152 }
153 /// <p>The container element for the Object Retention configuration.</p>
154 pub fn set_retention(mut self, input: ::std::option::Option<crate::types::ObjectLockRetention>) -> Self {
155 self.inner = self.inner.set_retention(input);
156 self
157 }
158 /// <p>The container element for the Object Retention configuration.</p>
159 pub fn get_retention(&self) -> &::std::option::Option<crate::types::ObjectLockRetention> {
160 self.inner.get_retention()
161 }
162 /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
163 /// <p>This functionality is not supported for directory buckets.</p>
164 /// </note>
165 pub fn request_payer(mut self, input: crate::types::RequestPayer) -> Self {
166 self.inner = self.inner.request_payer(input);
167 self
168 }
169 /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
170 /// <p>This functionality is not supported for directory buckets.</p>
171 /// </note>
172 pub fn set_request_payer(mut self, input: ::std::option::Option<crate::types::RequestPayer>) -> Self {
173 self.inner = self.inner.set_request_payer(input);
174 self
175 }
176 /// <p>Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html">Downloading Objects in Requester Pays Buckets</a> in the <i>Amazon S3 User Guide</i>.</p><note>
177 /// <p>This functionality is not supported for directory buckets.</p>
178 /// </note>
179 pub fn get_request_payer(&self) -> &::std::option::Option<crate::types::RequestPayer> {
180 self.inner.get_request_payer()
181 }
182 /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
183 pub fn version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184 self.inner = self.inner.version_id(input.into());
185 self
186 }
187 /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
188 pub fn set_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189 self.inner = self.inner.set_version_id(input);
190 self
191 }
192 /// <p>The version ID for the object that you want to apply this Object Retention configuration to.</p>
193 pub fn get_version_id(&self) -> &::std::option::Option<::std::string::String> {
194 self.inner.get_version_id()
195 }
196 /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
197 pub fn bypass_governance_retention(mut self, input: bool) -> Self {
198 self.inner = self.inner.bypass_governance_retention(input);
199 self
200 }
201 /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
202 pub fn set_bypass_governance_retention(mut self, input: ::std::option::Option<bool>) -> Self {
203 self.inner = self.inner.set_bypass_governance_retention(input);
204 self
205 }
206 /// <p>Indicates whether this action should bypass Governance-mode restrictions.</p>
207 pub fn get_bypass_governance_retention(&self) -> &::std::option::Option<bool> {
208 self.inner.get_bypass_governance_retention()
209 }
210 /// <p>The MD5 hash for the request body.</p>
211 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
212 pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213 self.inner = self.inner.content_md5(input.into());
214 self
215 }
216 /// <p>The MD5 hash for the request body.</p>
217 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
218 pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219 self.inner = self.inner.set_content_md5(input);
220 self
221 }
222 /// <p>The MD5 hash for the request body.</p>
223 /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p>
224 pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
225 self.inner.get_content_md5()
226 }
227 /// <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</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>
228 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
229 pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
230 self.inner = self.inner.checksum_algorithm(input);
231 self
232 }
233 /// <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</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>
234 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
235 pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
236 self.inner = self.inner.set_checksum_algorithm(input);
237 self
238 }
239 /// <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</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>
240 /// <p>If you provide an individual checksum, Amazon S3 ignores any provided <code>ChecksumAlgorithm</code> parameter.</p>
241 pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
242 self.inner.get_checksum_algorithm()
243 }
244 /// <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>
245 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246 self.inner = self.inner.expected_bucket_owner(input.into());
247 self
248 }
249 /// <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>
250 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
251 self.inner = self.inner.set_expected_bucket_owner(input);
252 self
253 }
254 /// <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>
255 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
256 self.inner.get_expected_bucket_owner()
257 }
258}