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 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> 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>SHA1</code></p></li>
23    /// <li>
24    /// <p><code>SHA256</code></p></li>
25    /// </ul>
26    /// <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>
27    /// <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 ignores any provided <code>ChecksumAlgorithm</code> parameter and uses the checksum algorithm that matches the provided value in <code>x-amz-checksum-<i>algorithm</i> </code>.</p><note>
28    /// <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>
29    /// </note>
30    pub checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
31    /// <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>
32    /// <p>This functionality is not supported for directory buckets.</p>
33    /// </note>
34    pub confirm_remove_self_bucket_access: ::std::option::Option<bool>,
35    /// <p>The bucket policy as a JSON document.</p>
36    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
37    pub policy: ::std::option::Option<::std::string::String>,
38    /// <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>
39    /// <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>
40    /// </note>
41    pub expected_bucket_owner: ::std::option::Option<::std::string::String>,
42}
43impl PutBucketPolicyInput {
44    /// <p>The name of the bucket.</p>
45    /// <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>
46    pub fn bucket(&self) -> ::std::option::Option<&str> {
47        self.bucket.as_deref()
48    }
49    /// <p>The MD5 hash of the request body.</p>
50    /// <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>
51    /// <p>This functionality is not supported for directory buckets.</p>
52    /// </note>
53    pub fn content_md5(&self) -> ::std::option::Option<&str> {
54        self.content_md5.as_deref()
55    }
56    /// <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> 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>
57    /// <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>
58    /// <ul>
59    /// <li>
60    /// <p><code>CRC32</code></p></li>
61    /// <li>
62    /// <p><code>CRC32C</code></p></li>
63    /// <li>
64    /// <p><code>SHA1</code></p></li>
65    /// <li>
66    /// <p><code>SHA256</code></p></li>
67    /// </ul>
68    /// <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>
69    /// <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 ignores any provided <code>ChecksumAlgorithm</code> parameter and uses the checksum algorithm that matches the provided value in <code>x-amz-checksum-<i>algorithm</i> </code>.</p><note>
70    /// <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>
71    /// </note>
72    pub fn checksum_algorithm(&self) -> ::std::option::Option<&crate::types::ChecksumAlgorithm> {
73        self.checksum_algorithm.as_ref()
74    }
75    /// <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>
76    /// <p>This functionality is not supported for directory buckets.</p>
77    /// </note>
78    pub fn confirm_remove_self_bucket_access(&self) -> ::std::option::Option<bool> {
79        self.confirm_remove_self_bucket_access
80    }
81    /// <p>The bucket policy as a JSON document.</p>
82    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
83    pub fn policy(&self) -> ::std::option::Option<&str> {
84        self.policy.as_deref()
85    }
86    /// <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>
87    /// <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>
88    /// </note>
89    pub fn expected_bucket_owner(&self) -> ::std::option::Option<&str> {
90        self.expected_bucket_owner.as_deref()
91    }
92}
93impl PutBucketPolicyInput {
94    /// Creates a new builder-style object to manufacture [`PutBucketPolicyInput`](crate::operation::put_bucket_policy::PutBucketPolicyInput).
95    pub fn builder() -> crate::operation::put_bucket_policy::builders::PutBucketPolicyInputBuilder {
96        crate::operation::put_bucket_policy::builders::PutBucketPolicyInputBuilder::default()
97    }
98}
99
100/// A builder for [`PutBucketPolicyInput`](crate::operation::put_bucket_policy::PutBucketPolicyInput).
101#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
102#[non_exhaustive]
103pub struct PutBucketPolicyInputBuilder {
104    pub(crate) bucket: ::std::option::Option<::std::string::String>,
105    pub(crate) content_md5: ::std::option::Option<::std::string::String>,
106    pub(crate) checksum_algorithm: ::std::option::Option<crate::types::ChecksumAlgorithm>,
107    pub(crate) confirm_remove_self_bucket_access: ::std::option::Option<bool>,
108    pub(crate) policy: ::std::option::Option<::std::string::String>,
109    pub(crate) expected_bucket_owner: ::std::option::Option<::std::string::String>,
110}
111impl PutBucketPolicyInputBuilder {
112    /// <p>The name of the bucket.</p>
113    /// <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>
114    /// This field is required.
115    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.bucket = ::std::option::Option::Some(input.into());
117        self
118    }
119    /// <p>The name of the bucket.</p>
120    /// <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>
121    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.bucket = input;
123        self
124    }
125    /// <p>The name of the bucket.</p>
126    /// <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>
127    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
128        &self.bucket
129    }
130    /// <p>The MD5 hash of the request body.</p>
131    /// <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>
132    /// <p>This functionality is not supported for directory buckets.</p>
133    /// </note>
134    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.content_md5 = ::std::option::Option::Some(input.into());
136        self
137    }
138    /// <p>The MD5 hash of the 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><note>
140    /// <p>This functionality is not supported for directory buckets.</p>
141    /// </note>
142    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.content_md5 = input;
144        self
145    }
146    /// <p>The MD5 hash of the request body.</p>
147    /// <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>
148    /// <p>This functionality is not supported for directory buckets.</p>
149    /// </note>
150    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
151        &self.content_md5
152    }
153    /// <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> 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>
154    /// <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>
155    /// <ul>
156    /// <li>
157    /// <p><code>CRC32</code></p></li>
158    /// <li>
159    /// <p><code>CRC32C</code></p></li>
160    /// <li>
161    /// <p><code>SHA1</code></p></li>
162    /// <li>
163    /// <p><code>SHA256</code></p></li>
164    /// </ul>
165    /// <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>
166    /// <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 ignores any provided <code>ChecksumAlgorithm</code> parameter and uses the checksum algorithm that matches the provided value in <code>x-amz-checksum-<i>algorithm</i> </code>.</p><note>
167    /// <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>
168    /// </note>
169    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
170        self.checksum_algorithm = ::std::option::Option::Some(input);
171        self
172    }
173    /// <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> 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>
174    /// <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>
175    /// <ul>
176    /// <li>
177    /// <p><code>CRC32</code></p></li>
178    /// <li>
179    /// <p><code>CRC32C</code></p></li>
180    /// <li>
181    /// <p><code>SHA1</code></p></li>
182    /// <li>
183    /// <p><code>SHA256</code></p></li>
184    /// </ul>
185    /// <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>
186    /// <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 ignores any provided <code>ChecksumAlgorithm</code> parameter and uses the checksum algorithm that matches the provided value in <code>x-amz-checksum-<i>algorithm</i> </code>.</p><note>
187    /// <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>
188    /// </note>
189    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
190        self.checksum_algorithm = input;
191        self
192    }
193    /// <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> 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>
194    /// <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>
195    /// <ul>
196    /// <li>
197    /// <p><code>CRC32</code></p></li>
198    /// <li>
199    /// <p><code>CRC32C</code></p></li>
200    /// <li>
201    /// <p><code>SHA1</code></p></li>
202    /// <li>
203    /// <p><code>SHA256</code></p></li>
204    /// </ul>
205    /// <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>
206    /// <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 ignores any provided <code>ChecksumAlgorithm</code> parameter and uses the checksum algorithm that matches the provided value in <code>x-amz-checksum-<i>algorithm</i> </code>.</p><note>
207    /// <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>
208    /// </note>
209    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
210        &self.checksum_algorithm
211    }
212    /// <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>
213    /// <p>This functionality is not supported for directory buckets.</p>
214    /// </note>
215    pub fn confirm_remove_self_bucket_access(mut self, input: bool) -> Self {
216        self.confirm_remove_self_bucket_access = ::std::option::Option::Some(input);
217        self
218    }
219    /// <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>
220    /// <p>This functionality is not supported for directory buckets.</p>
221    /// </note>
222    pub fn set_confirm_remove_self_bucket_access(mut self, input: ::std::option::Option<bool>) -> Self {
223        self.confirm_remove_self_bucket_access = input;
224        self
225    }
226    /// <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>
227    /// <p>This functionality is not supported for directory buckets.</p>
228    /// </note>
229    pub fn get_confirm_remove_self_bucket_access(&self) -> &::std::option::Option<bool> {
230        &self.confirm_remove_self_bucket_access
231    }
232    /// <p>The bucket policy as a JSON document.</p>
233    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
234    /// This field is required.
235    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
236        self.policy = ::std::option::Option::Some(input.into());
237        self
238    }
239    /// <p>The bucket policy as a JSON document.</p>
240    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
241    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
242        self.policy = input;
243        self
244    }
245    /// <p>The bucket policy as a JSON document.</p>
246    /// <p>For directory buckets, the only IAM action supported in the bucket policy is <code>s3express:CreateSession</code>.</p>
247    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
248        &self.policy
249    }
250    /// <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>
251    /// <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>
252    /// </note>
253    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
254        self.expected_bucket_owner = ::std::option::Option::Some(input.into());
255        self
256    }
257    /// <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>
258    /// <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>
259    /// </note>
260    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
261        self.expected_bucket_owner = input;
262        self
263    }
264    /// <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>
265    /// <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>
266    /// </note>
267    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
268        &self.expected_bucket_owner
269    }
270    /// Consumes the builder and constructs a [`PutBucketPolicyInput`](crate::operation::put_bucket_policy::PutBucketPolicyInput).
271    pub fn build(
272        self,
273    ) -> ::std::result::Result<crate::operation::put_bucket_policy::PutBucketPolicyInput, ::aws_smithy_types::error::operation::BuildError> {
274        ::std::result::Result::Ok(crate::operation::put_bucket_policy::PutBucketPolicyInput {
275            bucket: self.bucket,
276            content_md5: self.content_md5,
277            checksum_algorithm: self.checksum_algorithm,
278            confirm_remove_self_bucket_access: self.confirm_remove_self_bucket_access,
279            policy: self.policy,
280            expected_bucket_owner: self.expected_bucket_owner,
281        })
282    }
283}