aws_sdk_s3/operation/put_bucket_inventory_configuration/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_bucket_inventory_configuration::_put_bucket_inventory_configuration_output::PutBucketInventoryConfigurationOutputBuilder;
3
4pub use crate::operation::put_bucket_inventory_configuration::_put_bucket_inventory_configuration_input::PutBucketInventoryConfigurationInputBuilder;
5
6impl crate::operation::put_bucket_inventory_configuration::builders::PutBucketInventoryConfigurationInputBuilder {
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_inventory_configuration::PutBucketInventoryConfigurationOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfigurationError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.put_bucket_inventory_configuration();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PutBucketInventoryConfiguration`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>This implementation of the <code>PUT</code> action adds an S3 Inventory configuration (identified by the inventory ID) to the bucket. You can have up to 1,000 inventory configurations per bucket.</p>
29/// <p>Amazon S3 inventory generates inventories of the objects in the bucket on a daily or weekly basis, and the results are published to a flat file. The bucket that is inventoried is called the <i>source</i> bucket, and the bucket where the inventory flat file is stored is called the <i>destination</i> bucket. The <i>destination</i> bucket must be in the same Amazon Web Services Region as the <i>source</i> bucket.</p>
30/// <p>When you configure an inventory for a <i>source</i> bucket, you specify the <i>destination</i> bucket where you want the inventory to be stored, and whether to generate the inventory daily or weekly. You can also configure what object metadata to include and whether to inventory all object versions or only current versions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html">Amazon S3 Inventory</a> in the Amazon S3 User Guide.</p><important>
31/// <p>You must create a bucket policy on the <i>destination</i> bucket to grant permissions to Amazon S3 to write objects to the bucket in the defined location. For an example policy, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-9"> Granting Permissions for Amazon S3 Inventory and Storage Class Analysis</a>.</p>
32/// </important>
33/// <dl>
34/// <dt>
35/// Permissions
36/// </dt>
37/// <dd>
38/// <p>To use this operation, you must have permission to perform the <code>s3:PutInventoryConfiguration</code> action. The bucket owner has this permission by default and can grant this permission to others.</p>
39/// <p>The <code>s3:PutInventoryConfiguration</code> permission allows a user to create an <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-inventory.html">S3 Inventory</a> report that includes all object metadata fields available and to specify the destination bucket to store the inventory. A user with read access to objects in the destination bucket can also access all object metadata fields that are available in the inventory report.</p>
40/// <p>To restrict access to an inventory report, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html#example-bucket-policies-use-case-10">Restricting access to an Amazon S3 Inventory report</a> in the <i>Amazon S3 User Guide</i>. For more information about the metadata fields available in S3 Inventory, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-inventory.html#storage-inventory-contents">Amazon S3 Inventory lists</a> in the <i>Amazon S3 User Guide</i>. For more information about permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources">Permissions related to bucket subresource operations</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html">Identity and access management in Amazon S3</a> in the <i>Amazon S3 User Guide</i>.</p>
41/// </dd>
42/// </dl>
43/// <p><code>PutBucketInventoryConfiguration</code> has the following special errors:</p>
44/// <dl>
45/// <dt>
46/// HTTP 400 Bad Request Error
47/// </dt>
48/// <dd>
49/// <p><i>Code:</i> InvalidArgument</p>
50/// <p><i>Cause:</i> Invalid Argument</p>
51/// </dd>
52/// <dt>
53/// HTTP 400 Bad Request Error
54/// </dt>
55/// <dd>
56/// <p><i>Code:</i> TooManyConfigurations</p>
57/// <p><i>Cause:</i> You are attempting to create a new configuration but have already reached the 1,000-configuration limit.</p>
58/// </dd>
59/// <dt>
60/// HTTP 403 Forbidden Error
61/// </dt>
62/// <dd>
63/// <p><i>Cause:</i> You are not the owner of the specified bucket, or you do not have the <code>s3:PutInventoryConfiguration</code> bucket permission to set the configuration on the bucket.</p>
64/// </dd>
65/// </dl>
66/// <p>The following operations are related to <code>PutBucketInventoryConfiguration</code>:</p>
67/// <ul>
68/// <li>
69/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketInventoryConfiguration.html">GetBucketInventoryConfiguration</a></p></li>
70/// <li>
71/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketInventoryConfiguration.html">DeleteBucketInventoryConfiguration</a></p></li>
72/// <li>
73/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketInventoryConfigurations.html">ListBucketInventoryConfigurations</a></p></li>
74/// </ul><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 PutBucketInventoryConfigurationFluentBuilder {
79 handle: ::std::sync::Arc<crate::client::Handle>,
80 inner: crate::operation::put_bucket_inventory_configuration::builders::PutBucketInventoryConfigurationInputBuilder,
81 config_override: ::std::option::Option<crate::config::Builder>,
82}
83impl
84 crate::client::customize::internal::CustomizableSend<
85 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfigurationOutput,
86 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfigurationError,
87 > for PutBucketInventoryConfigurationFluentBuilder
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::put_bucket_inventory_configuration::PutBucketInventoryConfigurationOutput,
95 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfigurationError,
96 >,
97 > {
98 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
99 }
100}
101impl PutBucketInventoryConfigurationFluentBuilder {
102 /// Creates a new `PutBucketInventoryConfigurationFluentBuilder`.
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 PutBucketInventoryConfiguration as a reference.
111 pub fn as_input(&self) -> &crate::operation::put_bucket_inventory_configuration::builders::PutBucketInventoryConfigurationInputBuilder {
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::put_bucket_inventory_configuration::PutBucketInventoryConfigurationOutput,
126 ::aws_smithy_runtime_api::client::result::SdkError<
127 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfigurationError,
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::put_bucket_inventory_configuration::PutBucketInventoryConfiguration::operation_runtime_plugins(
136 self.handle.runtime_plugins.clone(),
137 &self.handle.conf,
138 self.config_override,
139 );
140 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfiguration::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::put_bucket_inventory_configuration::PutBucketInventoryConfigurationOutput,
148 crate::operation::put_bucket_inventory_configuration::PutBucketInventoryConfigurationError,
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 name of the bucket where the inventory configuration will be stored.</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 name of the bucket where the inventory configuration will be stored.</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 name of the bucket where the inventory configuration will be stored.</p>
173 pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
174 self.inner.get_bucket()
175 }
176 /// <p>The ID used to identify the inventory configuration.</p>
177 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178 self.inner = self.inner.id(input.into());
179 self
180 }
181 /// <p>The ID used to identify the inventory configuration.</p>
182 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183 self.inner = self.inner.set_id(input);
184 self
185 }
186 /// <p>The ID used to identify the inventory configuration.</p>
187 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
188 self.inner.get_id()
189 }
190 /// <p>Specifies the inventory configuration.</p>
191 pub fn inventory_configuration(mut self, input: crate::types::InventoryConfiguration) -> Self {
192 self.inner = self.inner.inventory_configuration(input);
193 self
194 }
195 /// <p>Specifies the inventory configuration.</p>
196 pub fn set_inventory_configuration(mut self, input: ::std::option::Option<crate::types::InventoryConfiguration>) -> Self {
197 self.inner = self.inner.set_inventory_configuration(input);
198 self
199 }
200 /// <p>Specifies the inventory configuration.</p>
201 pub fn get_inventory_configuration(&self) -> &::std::option::Option<crate::types::InventoryConfiguration> {
202 self.inner.get_inventory_configuration()
203 }
204 /// <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>
205 pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206 self.inner = self.inner.expected_bucket_owner(input.into());
207 self
208 }
209 /// <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>
210 pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
211 self.inner = self.inner.set_expected_bucket_owner(input);
212 self
213 }
214 /// <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>
215 pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
216 self.inner.get_expected_bucket_owner()
217 }
218}