aws_sdk_s3/operation/get_bucket_website/
_get_bucket_website_output.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 GetBucketWebsiteOutput {
6    /// <p>Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.</p>
7    pub redirect_all_requests_to: ::std::option::Option<crate::types::RedirectAllRequestsTo>,
8    /// <p>The name of the index document for the website (for example <code>index.html</code>).</p>
9    pub index_document: ::std::option::Option<crate::types::IndexDocument>,
10    /// <p>The object key name of the website error document to use for 4XX class errors.</p>
11    pub error_document: ::std::option::Option<crate::types::ErrorDocument>,
12    /// <p>Rules that define when a redirect is applied and the redirect behavior.</p>
13    pub routing_rules: ::std::option::Option<::std::vec::Vec<crate::types::RoutingRule>>,
14    _extended_request_id: Option<String>,
15    _request_id: Option<String>,
16}
17impl GetBucketWebsiteOutput {
18    /// <p>Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.</p>
19    pub fn redirect_all_requests_to(&self) -> ::std::option::Option<&crate::types::RedirectAllRequestsTo> {
20        self.redirect_all_requests_to.as_ref()
21    }
22    /// <p>The name of the index document for the website (for example <code>index.html</code>).</p>
23    pub fn index_document(&self) -> ::std::option::Option<&crate::types::IndexDocument> {
24        self.index_document.as_ref()
25    }
26    /// <p>The object key name of the website error document to use for 4XX class errors.</p>
27    pub fn error_document(&self) -> ::std::option::Option<&crate::types::ErrorDocument> {
28        self.error_document.as_ref()
29    }
30    /// <p>Rules that define when a redirect is applied and the redirect behavior.</p>
31    ///
32    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.routing_rules.is_none()`.
33    pub fn routing_rules(&self) -> &[crate::types::RoutingRule] {
34        self.routing_rules.as_deref().unwrap_or_default()
35    }
36}
37impl crate::s3_request_id::RequestIdExt for GetBucketWebsiteOutput {
38    fn extended_request_id(&self) -> Option<&str> {
39        self._extended_request_id.as_deref()
40    }
41}
42impl ::aws_types::request_id::RequestId for GetBucketWebsiteOutput {
43    fn request_id(&self) -> Option<&str> {
44        self._request_id.as_deref()
45    }
46}
47impl GetBucketWebsiteOutput {
48    /// Creates a new builder-style object to manufacture [`GetBucketWebsiteOutput`](crate::operation::get_bucket_website::GetBucketWebsiteOutput).
49    pub fn builder() -> crate::operation::get_bucket_website::builders::GetBucketWebsiteOutputBuilder {
50        crate::operation::get_bucket_website::builders::GetBucketWebsiteOutputBuilder::default()
51    }
52}
53
54/// A builder for [`GetBucketWebsiteOutput`](crate::operation::get_bucket_website::GetBucketWebsiteOutput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct GetBucketWebsiteOutputBuilder {
58    pub(crate) redirect_all_requests_to: ::std::option::Option<crate::types::RedirectAllRequestsTo>,
59    pub(crate) index_document: ::std::option::Option<crate::types::IndexDocument>,
60    pub(crate) error_document: ::std::option::Option<crate::types::ErrorDocument>,
61    pub(crate) routing_rules: ::std::option::Option<::std::vec::Vec<crate::types::RoutingRule>>,
62    _extended_request_id: Option<String>,
63    _request_id: Option<String>,
64}
65impl GetBucketWebsiteOutputBuilder {
66    /// <p>Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.</p>
67    pub fn redirect_all_requests_to(mut self, input: crate::types::RedirectAllRequestsTo) -> Self {
68        self.redirect_all_requests_to = ::std::option::Option::Some(input);
69        self
70    }
71    /// <p>Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.</p>
72    pub fn set_redirect_all_requests_to(mut self, input: ::std::option::Option<crate::types::RedirectAllRequestsTo>) -> Self {
73        self.redirect_all_requests_to = input;
74        self
75    }
76    /// <p>Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.</p>
77    pub fn get_redirect_all_requests_to(&self) -> &::std::option::Option<crate::types::RedirectAllRequestsTo> {
78        &self.redirect_all_requests_to
79    }
80    /// <p>The name of the index document for the website (for example <code>index.html</code>).</p>
81    pub fn index_document(mut self, input: crate::types::IndexDocument) -> Self {
82        self.index_document = ::std::option::Option::Some(input);
83        self
84    }
85    /// <p>The name of the index document for the website (for example <code>index.html</code>).</p>
86    pub fn set_index_document(mut self, input: ::std::option::Option<crate::types::IndexDocument>) -> Self {
87        self.index_document = input;
88        self
89    }
90    /// <p>The name of the index document for the website (for example <code>index.html</code>).</p>
91    pub fn get_index_document(&self) -> &::std::option::Option<crate::types::IndexDocument> {
92        &self.index_document
93    }
94    /// <p>The object key name of the website error document to use for 4XX class errors.</p>
95    pub fn error_document(mut self, input: crate::types::ErrorDocument) -> Self {
96        self.error_document = ::std::option::Option::Some(input);
97        self
98    }
99    /// <p>The object key name of the website error document to use for 4XX class errors.</p>
100    pub fn set_error_document(mut self, input: ::std::option::Option<crate::types::ErrorDocument>) -> Self {
101        self.error_document = input;
102        self
103    }
104    /// <p>The object key name of the website error document to use for 4XX class errors.</p>
105    pub fn get_error_document(&self) -> &::std::option::Option<crate::types::ErrorDocument> {
106        &self.error_document
107    }
108    /// Appends an item to `routing_rules`.
109    ///
110    /// To override the contents of this collection use [`set_routing_rules`](Self::set_routing_rules).
111    ///
112    /// <p>Rules that define when a redirect is applied and the redirect behavior.</p>
113    pub fn routing_rules(mut self, input: crate::types::RoutingRule) -> Self {
114        let mut v = self.routing_rules.unwrap_or_default();
115        v.push(input);
116        self.routing_rules = ::std::option::Option::Some(v);
117        self
118    }
119    /// <p>Rules that define when a redirect is applied and the redirect behavior.</p>
120    pub fn set_routing_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RoutingRule>>) -> Self {
121        self.routing_rules = input;
122        self
123    }
124    /// <p>Rules that define when a redirect is applied and the redirect behavior.</p>
125    pub fn get_routing_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RoutingRule>> {
126        &self.routing_rules
127    }
128    pub(crate) fn _extended_request_id(mut self, extended_request_id: impl Into<String>) -> Self {
129        self._extended_request_id = Some(extended_request_id.into());
130        self
131    }
132
133    pub(crate) fn _set_extended_request_id(&mut self, extended_request_id: Option<String>) -> &mut Self {
134        self._extended_request_id = extended_request_id;
135        self
136    }
137    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
138        self._request_id = Some(request_id.into());
139        self
140    }
141
142    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
143        self._request_id = request_id;
144        self
145    }
146    /// Consumes the builder and constructs a [`GetBucketWebsiteOutput`](crate::operation::get_bucket_website::GetBucketWebsiteOutput).
147    pub fn build(self) -> crate::operation::get_bucket_website::GetBucketWebsiteOutput {
148        crate::operation::get_bucket_website::GetBucketWebsiteOutput {
149            redirect_all_requests_to: self.redirect_all_requests_to,
150            index_document: self.index_document,
151            error_document: self.error_document,
152            routing_rules: self.routing_rules,
153            _extended_request_id: self._extended_request_id,
154            _request_id: self._request_id,
155        }
156    }
157}