aws_sdk_s3/operation/get_bucket_website/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_bucket_website::_get_bucket_website_output::GetBucketWebsiteOutputBuilder;
3
4pub use crate::operation::get_bucket_website::_get_bucket_website_input::GetBucketWebsiteInputBuilder;
5
6impl crate::operation::get_bucket_website::builders::GetBucketWebsiteInputBuilder {
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::get_bucket_website::GetBucketWebsiteOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_bucket_website::GetBucketWebsiteError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_bucket_website();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetBucketWebsite`.
24///
25/// <note>
26/// <p>This operation is not supported for directory buckets.</p>
27/// </note>
28/// <p>Returns the website configuration for a bucket. To host website on Amazon S3, you can configure a bucket as website by adding a website configuration. For more information about hosting websites, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">Hosting Websites on Amazon S3</a>.</p>
29/// <p>This GET action requires the <code>S3:GetBucketWebsite</code> permission. By default, only the bucket owner can read the bucket website configuration. However, bucket owners can allow other users to read the website configuration by writing a bucket policy granting them the <code>S3:GetBucketWebsite</code> permission.</p>
30/// <p>The following operations are related to <code>GetBucketWebsite</code>:</p>
31/// <ul>
32/// <li>
33/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketWebsite.html">DeleteBucketWebsite</a></p></li>
34/// <li>
35/// <p><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketWebsite.html">PutBucketWebsite</a></p></li>
36/// </ul><important>
37/// <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>
38/// </important>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct GetBucketWebsiteFluentBuilder {
41    handle: ::std::sync::Arc<crate::client::Handle>,
42    inner: crate::operation::get_bucket_website::builders::GetBucketWebsiteInputBuilder,
43    config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46    crate::client::customize::internal::CustomizableSend<
47        crate::operation::get_bucket_website::GetBucketWebsiteOutput,
48        crate::operation::get_bucket_website::GetBucketWebsiteError,
49    > for GetBucketWebsiteFluentBuilder
50{
51    fn send(
52        self,
53        config_override: crate::config::Builder,
54    ) -> crate::client::customize::internal::BoxFuture<
55        crate::client::customize::internal::SendResult<
56            crate::operation::get_bucket_website::GetBucketWebsiteOutput,
57            crate::operation::get_bucket_website::GetBucketWebsiteError,
58        >,
59    > {
60        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61    }
62}
63impl GetBucketWebsiteFluentBuilder {
64    /// Creates a new `GetBucketWebsiteFluentBuilder`.
65    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66        Self {
67            handle,
68            inner: ::std::default::Default::default(),
69            config_override: ::std::option::Option::None,
70        }
71    }
72    /// Access the GetBucketWebsite as a reference.
73    pub fn as_input(&self) -> &crate::operation::get_bucket_website::builders::GetBucketWebsiteInputBuilder {
74        &self.inner
75    }
76    /// Sends the request and returns the response.
77    ///
78    /// If an error occurs, an `SdkError` will be returned with additional details that
79    /// can be matched against.
80    ///
81    /// By default, any retryable failures will be retried twice. Retry behavior
82    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83    /// set when configuring the client.
84    pub async fn send(
85        self,
86    ) -> ::std::result::Result<
87        crate::operation::get_bucket_website::GetBucketWebsiteOutput,
88        ::aws_smithy_runtime_api::client::result::SdkError<
89            crate::operation::get_bucket_website::GetBucketWebsiteError,
90            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91        >,
92    > {
93        let input = self
94            .inner
95            .build()
96            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97        let runtime_plugins = crate::operation::get_bucket_website::GetBucketWebsite::operation_runtime_plugins(
98            self.handle.runtime_plugins.clone(),
99            &self.handle.conf,
100            self.config_override,
101        );
102        crate::operation::get_bucket_website::GetBucketWebsite::orchestrate(&runtime_plugins, input).await
103    }
104
105    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106    pub fn customize(
107        self,
108    ) -> crate::client::customize::CustomizableOperation<
109        crate::operation::get_bucket_website::GetBucketWebsiteOutput,
110        crate::operation::get_bucket_website::GetBucketWebsiteError,
111        Self,
112    > {
113        crate::client::customize::CustomizableOperation::new(self)
114    }
115    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116        self.set_config_override(::std::option::Option::Some(config_override.into()));
117        self
118    }
119
120    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121        self.config_override = config_override;
122        self
123    }
124    /// <p>The bucket name for which to get the website configuration.</p>
125    pub fn bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126        self.inner = self.inner.bucket(input.into());
127        self
128    }
129    /// <p>The bucket name for which to get the website configuration.</p>
130    pub fn set_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131        self.inner = self.inner.set_bucket(input);
132        self
133    }
134    /// <p>The bucket name for which to get the website configuration.</p>
135    pub fn get_bucket(&self) -> &::std::option::Option<::std::string::String> {
136        self.inner.get_bucket()
137    }
138    /// <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>
139    pub fn expected_bucket_owner(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.inner = self.inner.expected_bucket_owner(input.into());
141        self
142    }
143    /// <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>
144    pub fn set_expected_bucket_owner(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.inner = self.inner.set_expected_bucket_owner(input);
146        self
147    }
148    /// <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>
149    pub fn get_expected_bucket_owner(&self) -> &::std::option::Option<::std::string::String> {
150        self.inner.get_expected_bucket_owner()
151    }
152}