Skip to main content

aws_sdk_s3/operation/create_bucket_metadata_configuration/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_bucket_metadata_configuration::_create_bucket_metadata_configuration_input::CreateBucketMetadataConfigurationInputBuilder;
3
4pub use crate::operation::create_bucket_metadata_configuration::_create_bucket_metadata_configuration_output::CreateBucketMetadataConfigurationOutputBuilder;
5
6impl crate::operation::create_bucket_metadata_configuration::builders::CreateBucketMetadataConfigurationInputBuilder {
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::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_bucket_metadata_configuration();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateBucketMetadataConfiguration`.
24///
25/// <p>Creates an S3 Metadata V2 metadata configuration for a general purpose bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-overview.html">Accelerating data discovery with S3 Metadata</a> in the <i>Amazon S3 User Guide</i>.</p>
26/// <dl>
27/// <dt>
28/// Permissions
29/// </dt>
30/// <dd>
31/// <p>To use this operation, you must have the following permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-permissions.html">Setting up permissions for configuring metadata tables</a> in the <i>Amazon S3 User Guide</i>.</p>
32/// <p>If you want to encrypt your metadata tables with server-side encryption with Key Management Service (KMS) keys (SSE-KMS), you need additional permissions in your KMS key policy. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-permissions.html"> Setting up permissions for configuring metadata tables</a> in the <i>Amazon S3 User Guide</i>.</p>
33/// <p>If you also want to integrate your table bucket with Amazon Web Services analytics services so that you can query your metadata table, you need additional permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-integrating-aws.html"> Integrating Amazon S3 Tables with Amazon Web Services analytics services</a> in the <i>Amazon S3 User Guide</i>.</p>
34/// <p>To query your metadata tables, you need additional permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-bucket-query-permissions.html"> Permissions for querying metadata tables</a> in the <i>Amazon S3 User Guide</i>.</p>
35/// <ul>
36/// <li>
37/// <p><code>s3:CreateBucketMetadataTableConfiguration</code></p><note>
38/// <p>The IAM policy action name is the same for the V1 and V2 API operations.</p>
39/// </note></li>
40/// <li>
41/// <p><code>s3tables:CreateTableBucket</code></p></li>
42/// <li>
43/// <p><code>s3tables:CreateNamespace</code></p></li>
44/// <li>
45/// <p><code>s3tables:GetTable</code></p></li>
46/// <li>
47/// <p><code>s3tables:CreateTable</code></p></li>
48/// <li>
49/// <p><code>s3tables:PutTablePolicy</code></p></li>
50/// <li>
51/// <p><code>s3tables:PutTableBucketPolicy</code></p></li>
52/// <li>
53/// <p><code>s3tables:PutTableEncryption</code></p></li>
54/// <li>
55/// <p><code>kms:DescribeKey</code></p></li>
56/// <li>
57/// <p><code>iam:PassRole</code> - required if you include an <code>AnnotationTableConfiguration</code> with an IAM role.</p></li>
58/// </ul>
59/// </dd>
60/// </dl>
61/// <p>The following operations are related to <code>CreateBucketMetadataConfiguration</code>:</p>
62/// <ul>
63/// <li>
64/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetadataConfiguration.html">DeleteBucketMetadataConfiguration</a></p></li>
65/// <li>
66/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketMetadataConfiguration.html">GetBucketMetadataConfiguration</a></p></li>
67/// <li>
68/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataInventoryTableConfiguration.html">UpdateBucketMetadataInventoryTableConfiguration</a></p></li>
69/// <li>
70/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataJournalTableConfiguration.html">UpdateBucketMetadataJournalTableConfiguration</a></p></li>
71/// <li>
72/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataAnnotationTableConfiguration.html">UpdateBucketMetadataAnnotationTableConfiguration</a></p></li>
73/// </ul>
74/// <p>If you include an <code>AnnotationTableConfiguration</code> with an IAM role, the role must have a trust policy that allows the Amazon S3 metadata service to assume it, and a permissions policy that grants the actions needed to read annotations from your bucket. The following examples show a trust policy and a permissions policy that you can adapt for your bucket and account.</p><important>
75/// <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>
76/// </important>
77#[derive(::std::clone::Clone, ::std::fmt::Debug)]
78pub struct CreateBucketMetadataConfigurationFluentBuilder {
79    handle: ::std::sync::Arc<crate::client::Handle>,
80    inner: crate::operation::create_bucket_metadata_configuration::builders::CreateBucketMetadataConfigurationInputBuilder,
81    config_override: ::std::option::Option<crate::config::Builder>,
82}
83impl
84    crate::client::customize::internal::CustomizableSend<
85        crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationOutput,
86        crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationError,
87    > for CreateBucketMetadataConfigurationFluentBuilder
88{
89    fn send(
90        self,
91        config_override: crate::config::Builder,
92    ) -> crate::client::customize::internal::BoxFuture<
93        crate::client::customize::internal::SendResult<
94            crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationOutput,
95            crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationError,
96        >,
97    > {
98        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
99    }
100}
101impl CreateBucketMetadataConfigurationFluentBuilder {
102    /// Creates a new `CreateBucketMetadataConfigurationFluentBuilder`.
103    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
104        Self {
105            handle,
106            inner: ::std::default::Default::default(),
107            config_override: ::std::option::Option::None,
108        }
109    }
110    /// Access the CreateBucketMetadataConfiguration as a reference.
111    pub fn as_input(&self) -> &crate::operation::create_bucket_metadata_configuration::builders::CreateBucketMetadataConfigurationInputBuilder {
112        &self.inner
113    }
114    /// Sends the request and returns the response.
115    ///
116    /// If an error occurs, an `SdkError` will be returned with additional details that
117    /// can be matched against.
118    ///
119    /// By default, any retryable failures will be retried twice. Retry behavior
120    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
121    /// set when configuring the client.
122    pub async fn send(
123        self,
124    ) -> ::std::result::Result<
125        crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationOutput,
126        ::aws_smithy_runtime_api::client::result::SdkError<
127            crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationError,
128            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
129        >,
130    > {
131        let input = self
132            .inner
133            .build()
134            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
135        let runtime_plugins = crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfiguration::operation_runtime_plugins(
136            self.handle.runtime_plugins.clone(),
137            &self.handle.conf,
138            self.config_override,
139        );
140        crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfiguration::orchestrate(&runtime_plugins, input).await
141    }
142
143    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
144    pub fn customize(
145        self,
146    ) -> crate::client::customize::CustomizableOperation<
147        crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationOutput,
148        crate::operation::create_bucket_metadata_configuration::CreateBucketMetadataConfigurationError,
149        Self,
150    > {
151        crate::client::customize::CustomizableOperation::new(self)
152    }
153    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
154        self.set_config_override(::std::option::Option::Some(config_override.into()));
155        self
156    }
157
158    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
159        self.config_override = config_override;
160        self
161    }
162    /// <p>The general purpose bucket that you want to create the metadata configuration for.</p>
163    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.inner = self.inner.bucket(input.into());
165        self
166    }
167    /// <p>The general purpose bucket that you want to create the metadata configuration for.</p>
168    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.inner = self.inner.set_bucket(input);
170        self
171    }
172    /// <p>The general purpose bucket that you want to create the metadata configuration for.</p>
173    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_bucket()
175    }
176    /// <p>The <code>Content-MD5</code> header for the metadata configuration.</p>
177    pub fn content_md5(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178        self.inner = self.inner.content_md5(input.into());
179        self
180    }
181    /// <p>The <code>Content-MD5</code> header for the metadata configuration.</p>
182    pub fn set_content_md5(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.inner = self.inner.set_content_md5(input);
184        self
185    }
186    /// <p>The <code>Content-MD5</code> header for the metadata configuration.</p>
187    pub fn get_content_md5(&self) -> &::std::option::Option<::std::string::String> {
188        self.inner.get_content_md5()
189    }
190    /// <p>The checksum algorithm to use with your metadata configuration.</p>
191    pub fn checksum_algorithm(mut self, input: crate::types::ChecksumAlgorithm) -> Self {
192        self.inner = self.inner.checksum_algorithm(input);
193        self
194    }
195    /// <p>The checksum algorithm to use with your metadata configuration.</p>
196    pub fn set_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::ChecksumAlgorithm>) -> Self {
197        self.inner = self.inner.set_checksum_algorithm(input);
198        self
199    }
200    /// <p>The checksum algorithm to use with your metadata configuration.</p>
201    pub fn get_checksum_algorithm(&self) -> &::std::option::Option<crate::types::ChecksumAlgorithm> {
202        self.inner.get_checksum_algorithm()
203    }
204    /// <p>The contents of your metadata configuration.</p>
205    pub fn metadata_configuration(mut self, input: crate::types::MetadataConfiguration) -> Self {
206        self.inner = self.inner.metadata_configuration(input);
207        self
208    }
209    /// <p>The contents of your metadata configuration.</p>
210    pub fn set_metadata_configuration(mut self, input: ::std::option::Option<crate::types::MetadataConfiguration>) -> Self {
211        self.inner = self.inner.set_metadata_configuration(input);
212        self
213    }
214    /// <p>The contents of your metadata configuration.</p>
215    pub fn get_metadata_configuration(&self) -> &::std::option::Option<crate::types::MetadataConfiguration> {
216        self.inner.get_metadata_configuration()
217    }
218    /// <p>The expected owner of the general purpose bucket that corresponds to your metadata configuration.</p>
219    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
220        self.inner = self.inner.expected_bucket_owner(input.into());
221        self
222    }
223    /// <p>The expected owner of the general purpose bucket that corresponds to your metadata configuration.</p>
224    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
225        self.inner = self.inner.set_expected_bucket_owner(input);
226        self
227    }
228    /// <p>The expected owner of the general purpose bucket that corresponds to your metadata configuration.</p>
229    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
230        self.inner.get_expected_bucket_owner()
231    }
232}