aws_sdk_s3/operation/put_bucket_policy/
_put_bucket_policy_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct PutBucketPolicyInput {
6    /// <p>The name of the bucket.</p>
7    /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-BUCKET</i>--<i>usw2-az1</i>--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>
8    pub bucket: ::std::option::Option<::std::string::String>,
9    /// <p>The MD5 hash of the request body.</p>
10    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p><note>
11    /// <p>This functionality is not supported for directory buckets.</p>
12    /// </note>
13    pub content_md5: ::std::option::Option<::std::string::String>,
14    /// <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-<i>algorithm</i> </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>.</p>
15    /// <p>For the <code>x-amz-checksum-<i>algorithm</i> </code> header, replace <code> <i>algorithm</i> </code> with the supported algorithm from the following list:</p>
16    /// <ul>
17    /// <li>
18    /// <p><code>CRC32</code></p></li>
19    /// <li>
20    /// <p><code>CRC32C</code></p></li>
21    /// <li>
22    /// <p><code>CRC64NVME</code></p></li>
23    /// <li>
24    /// <p><code>SHA1</code></p></li>
25    /// <li>
26    /// <p><code>SHA256</code></p></li>
27    /// </ul>
28    /// <p>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>
29    /// <p>If the individual checksum value you provide through <code>x-amz-checksum-<i>algorithm</i> </code> doesn't match the checksum algorithm you set through <code>x-amz-sdk-checksum-algorithm</code>, Amazon S3 fails the request with a <code>BadDigest</code> error.</p><note>
30    /// <p>For directory buckets, when you use Amazon Web Services SDKs, <code>CRC32</code> is the default checksum algorithm that's used for performance.</p>
31    /// </note>
32    pub checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
33    /// <p>Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.</p><note>
34    /// <p>This functionality is not supported for directory buckets.</p>
35    /// </note>
36    pub confirm_remove_self_bucket_access: ::std::option::Option<bool>,
37    /// <p>The bucket policy as a JSON document.</p>
38    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
39    pub policy: ::std::option::Option<::std::string::String>,
40    /// <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><note>
41    /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
42    /// </note>
43    pub expected_bucket_owner: ::std::option::Option<::std::string::String>,
44}
45impl PutBucketPolicyInput {
46    /// <p>The name of the bucket.</p>
47    /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-BUCKET</i>--<i>usw2-az1</i>--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>
48    pub fn bucket(&self) -> ::std::option::Option<&str> {
49        self.bucket.as_deref()
50    }
51    /// <p>The MD5 hash of the request body.</p>
52    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p><note>
53    /// <p>This functionality is not supported for directory buckets.</p>
54    /// </note>
55    pub fn content_md5(&self) -> ::std::option::Option<&str> {
56        self.content_md5.as_deref()
57    }
58    /// <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-<i>algorithm</i> </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>.</p>
59    /// <p>For the <code>x-amz-checksum-<i>algorithm</i> </code> header, replace <code> <i>algorithm</i> </code> with the supported algorithm from the following list:</p>
60    /// <ul>
61    /// <li>
62    /// <p><code>CRC32</code></p></li>
63    /// <li>
64    /// <p><code>CRC32C</code></p></li>
65    /// <li>
66    /// <p><code>CRC64NVME</code></p></li>
67    /// <li>
68    /// <p><code>SHA1</code></p></li>
69    /// <li>
70    /// <p><code>SHA256</code></p></li>
71    /// </ul>
72    /// <p>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>
73    /// <p>If the individual checksum value you provide through <code>x-amz-checksum-<i>algorithm</i> </code> doesn't match the checksum algorithm you set through <code>x-amz-sdk-checksum-algorithm</code>, Amazon S3 fails the request with a <code>BadDigest</code> error.</p><note>
74    /// <p>For directory buckets, when you use Amazon Web Services SDKs, <code>CRC32</code> is the default checksum algorithm that's used for performance.</p>
75    /// </note>
76    pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::types::ChecksumAlgorithm> {
77        self.checksum_algorithm.as_ref()
78    }
79    /// <p>Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.</p><note>
80    /// <p>This functionality is not supported for directory buckets.</p>
81    /// </note>
82    pub fn confirm_remove_self_bucket_access(&self) -> ::std::option::Option<bool> {
83        self.confirm_remove_self_bucket_access
84    }
85    /// <p>The bucket policy as a JSON document.</p>
86    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
87    pub fn policy(&self) -> ::std::option::Option<&str> {
88        self.policy.as_deref()
89    }
90    /// <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><note>
91    /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
92    /// </note>
93    pub fn expected_bucket_owner(&self) -> ::std::option::Option<&str> {
94        self.expected_bucket_owner.as_deref()
95    }
96}
97impl PutBucketPolicyInput {
98    /// Creates a new builder-style object to manufacture [`PutBucketPolicyInput`](crate::operation::put_bucket_policy::PutBucketPolicyInput).
99    pub fn builder() -> crate::operation::put_bucket_policy::builders::PutBucketPolicyInputBuilder {
100        crate::operation::put_bucket_policy::builders::PutBucketPolicyInputBuilder::default()
101    }
102}
103
104/// A builder for [`PutBucketPolicyInput`](crate::operation::put_bucket_policy::PutBucketPolicyInput).
105#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
106#[non_exhaustive]
107pub struct PutBucketPolicyInputBuilder {
108    pub(crate) bucket: ::std::option::Option<::std::string::String>,
109    pub(crate) content_md5: ::std::option::Option<::std::string::String>,
110    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
111    pub(crate) confirm_remove_self_bucket_access: ::std::option::Option<bool>,
112    pub(crate) policy: ::std::option::Option<::std::string::String>,
113    pub(crate) expected_bucket_owner: ::std::option::Option<::std::string::String>,
114}
115impl PutBucketPolicyInputBuilder {
116    /// <p>The name of the bucket.</p>
117    /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-BUCKET</i>--<i>usw2-az1</i>--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>
118    /// This field is required.
119    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.bucket = ::std::option::Option::Some(input.into());
121        self
122    }
123    /// <p>The name of the bucket.</p>
124    /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-BUCKET</i>--<i>usw2-az1</i>--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>
125    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.bucket = input;
127        self
128    }
129    /// <p>The name of the bucket.</p>
130    /// <p><b>Directory buckets </b> - When you use this operation with a directory bucket, you must use path-style requests in the format <code>https://s3express-control.<i>region-code</i>.amazonaws.com/<i>bucket-name</i> </code>. Virtual-hosted-style requests aren't supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket names must also follow the format <code> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</code> (for example, <code> <i>DOC-EXAMPLE-BUCKET</i>--<i>usw2-az1</i>--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>
131    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
132        &self.bucket
133    }
134    /// <p>The MD5 hash of the request body.</p>
135    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p><note>
136    /// <p>This functionality is not supported for directory buckets.</p>
137    /// </note>
138    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.content_md5 = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The MD5 hash of the request body.</p>
143    /// <p>For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.</p><note>
144    /// <p>This functionality is not supported for directory buckets.</p>
145    /// </note>
146    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.content_md5 = input;
148        self
149    }
150    /// <p>The MD5 hash of the 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><note>
152    /// <p>This functionality is not supported for directory buckets.</p>
153    /// </note>
154    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
155        &self.content_md5
156    }
157    /// <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-<i>algorithm</i> </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>.</p>
158    /// <p>For the <code>x-amz-checksum-<i>algorithm</i> </code> header, replace <code> <i>algorithm</i> </code> with the supported algorithm from the following list:</p>
159    /// <ul>
160    /// <li>
161    /// <p><code>CRC32</code></p></li>
162    /// <li>
163    /// <p><code>CRC32C</code></p></li>
164    /// <li>
165    /// <p><code>CRC64NVME</code></p></li>
166    /// <li>
167    /// <p><code>SHA1</code></p></li>
168    /// <li>
169    /// <p><code>SHA256</code></p></li>
170    /// </ul>
171    /// <p>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>
172    /// <p>If the individual checksum value you provide through <code>x-amz-checksum-<i>algorithm</i> </code> doesn't match the checksum algorithm you set through <code>x-amz-sdk-checksum-algorithm</code>, Amazon S3 fails the request with a <code>BadDigest</code> error.</p><note>
173    /// <p>For directory buckets, when you use Amazon Web Services SDKs, <code>CRC32</code> is the default checksum algorithm that's used for performance.</p>
174    /// </note>
175    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
176        self.checksum_algorithm = ::std::option::Option::Some(input);
177        self
178    }
179    /// <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-<i>algorithm</i> </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>.</p>
180    /// <p>For the <code>x-amz-checksum-<i>algorithm</i> </code> header, replace <code> <i>algorithm</i> </code> with the supported algorithm from the following list:</p>
181    /// <ul>
182    /// <li>
183    /// <p><code>CRC32</code></p></li>
184    /// <li>
185    /// <p><code>CRC32C</code></p></li>
186    /// <li>
187    /// <p><code>CRC64NVME</code></p></li>
188    /// <li>
189    /// <p><code>SHA1</code></p></li>
190    /// <li>
191    /// <p><code>SHA256</code></p></li>
192    /// </ul>
193    /// <p>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>
194    /// <p>If the individual checksum value you provide through <code>x-amz-checksum-<i>algorithm</i> </code> doesn't match the checksum algorithm you set through <code>x-amz-sdk-checksum-algorithm</code>, Amazon S3 fails the request with a <code>BadDigest</code> error.</p><note>
195    /// <p>For directory buckets, when you use Amazon Web Services SDKs, <code>CRC32</code> is the default checksum algorithm that's used for performance.</p>
196    /// </note>
197    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
198        self.checksum_algorithm = input;
199        self
200    }
201    /// <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-<i>algorithm</i> </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>.</p>
202    /// <p>For the <code>x-amz-checksum-<i>algorithm</i> </code> header, replace <code> <i>algorithm</i> </code> with the supported algorithm from the following list:</p>
203    /// <ul>
204    /// <li>
205    /// <p><code>CRC32</code></p></li>
206    /// <li>
207    /// <p><code>CRC32C</code></p></li>
208    /// <li>
209    /// <p><code>CRC64NVME</code></p></li>
210    /// <li>
211    /// <p><code>SHA1</code></p></li>
212    /// <li>
213    /// <p><code>SHA256</code></p></li>
214    /// </ul>
215    /// <p>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>
216    /// <p>If the individual checksum value you provide through <code>x-amz-checksum-<i>algorithm</i> </code> doesn't match the checksum algorithm you set through <code>x-amz-sdk-checksum-algorithm</code>, Amazon S3 fails the request with a <code>BadDigest</code> error.</p><note>
217    /// <p>For directory buckets, when you use Amazon Web Services SDKs, <code>CRC32</code> is the default checksum algorithm that's used for performance.</p>
218    /// </note>
219    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
220        &self.checksum_algorithm
221    }
222    /// <p>Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.</p><note>
223    /// <p>This functionality is not supported for directory buckets.</p>
224    /// </note>
225    pub fn confirm_remove_self_bucket_access(mut self, input: bool) -> Self {
226        self.confirm_remove_self_bucket_access = ::std::option::Option::Some(input);
227        self
228    }
229    /// <p>Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.</p><note>
230    /// <p>This functionality is not supported for directory buckets.</p>
231    /// </note>
232    pub fn set_confirm_remove_self_bucket_access(mut self, input: ::std::option::Option<bool>) -> Self {
233        self.confirm_remove_self_bucket_access = input;
234        self
235    }
236    /// <p>Set this parameter to true to confirm that you want to remove your permissions to change this bucket policy in the future.</p><note>
237    /// <p>This functionality is not supported for directory buckets.</p>
238    /// </note>
239    pub fn get_confirm_remove_self_bucket_access(&self) -> &::std::option::Option<bool> {
240        &self.confirm_remove_self_bucket_access
241    }
242    /// <p>The bucket policy as a JSON document.</p>
243    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
244    /// This field is required.
245    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246        self.policy = ::std::option::Option::Some(input.into());
247        self
248    }
249    /// <p>The bucket policy as a JSON document.</p>
250    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
251    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252        self.policy = input;
253        self
254    }
255    /// <p>The bucket policy as a JSON document.</p>
256    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
257    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
258        &self.policy
259    }
260    /// <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><note>
261    /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
262    /// </note>
263    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
264        self.expected_bucket_owner = ::std::option::Option::Some(input.into());
265        self
266    }
267    /// <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><note>
268    /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
269    /// </note>
270    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
271        self.expected_bucket_owner = input;
272        self
273    }
274    /// <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><note>
275    /// <p>For directory buckets, this header is not supported in this API operation. If you specify this header, the request fails with the HTTP status code <code>501 Not Implemented</code>.</p>
276    /// </note>
277    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
278        &self.expected_bucket_owner
279    }
280    /// Consumes the builder and constructs a [`PutBucketPolicyInput`](crate::operation::put_bucket_policy::PutBucketPolicyInput).
281    pub fn build(
282        self,
283    ) -> ::std::result::Result<crate::operation::put_bucket_policy::PutBucketPolicyInput, ::aws_smithy_types::error::operation::BuildError> {
284        ::std::result::Result::Ok(crate::operation::put_bucket_policy::PutBucketPolicyInput {
285            bucket: self.bucket,
286            content_md5: self.content_md5,
287            checksum_algorithm: self.checksum_algorithm,
288            confirm_remove_self_bucket_access: self.confirm_remove_self_bucket_access,
289            policy: self.policy,
290            expected_bucket_owner: self.expected_bucket_owner,
291        })
292    }
293}