aws_sdk_s3/operation/list_buckets/
_list_buckets_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 ListBucketsOutput {
6    /// <p>The list of buckets owned by the requester.</p>
7    pub buckets: ::std::option::Option<::std::vec::Vec<crate::types::Bucket>>,
8    /// <p>The owner of the buckets listed.</p>
9    pub owner: ::std::option::Option<crate::types::Owner>,
10    /// <p><code>ContinuationToken</code> is included in the response when there are more buckets that can be listed with pagination. The next <code>ListBuckets</code> request to Amazon S3 can be continued with this <code>ContinuationToken</code>. <code>ContinuationToken</code> is obfuscated and is not a real bucket.</p>
11    pub continuation_token: ::std::option::Option<::std::string::String>,
12    /// <p>If <code>Prefix</code> was sent with the request, it is included in the response.</p>
13    /// <p>All bucket names in the response begin with the specified bucket name prefix.</p>
14    pub prefix: ::std::option::Option<::std::string::String>,
15    _extended_request_id: Option<String>,
16    _request_id: Option<String>,
17}
18impl ListBucketsOutput {
19    /// <p>The list of buckets owned by the requester.</p>
20    ///
21    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.buckets.is_none()`.
22    pub fn buckets(&self) -> &[crate::types::Bucket] {
23        self.buckets.as_deref().unwrap_or_default()
24    }
25    /// <p>The owner of the buckets listed.</p>
26    pub fn owner(&self) -> ::std::option::Option<&crate::types::Owner> {
27        self.owner.as_ref()
28    }
29    /// <p><code>ContinuationToken</code> is included in the response when there are more buckets that can be listed with pagination. The next <code>ListBuckets</code> request to Amazon S3 can be continued with this <code>ContinuationToken</code>. <code>ContinuationToken</code> is obfuscated and is not a real bucket.</p>
30    pub fn continuation_token(&self) -> ::std::option::Option<&str> {
31        self.continuation_token.as_deref()
32    }
33    /// <p>If <code>Prefix</code> was sent with the request, it is included in the response.</p>
34    /// <p>All bucket names in the response begin with the specified bucket name prefix.</p>
35    pub fn prefix(&self) -> ::std::option::Option<&str> {
36        self.prefix.as_deref()
37    }
38}
39impl crate::s3_request_id::RequestIdExt for ListBucketsOutput {
40    fn extended_request_id(&self) -> Option<&str> {
41        self._extended_request_id.as_deref()
42    }
43}
44impl ::aws_types::request_id::RequestId for ListBucketsOutput {
45    fn request_id(&self) -> Option<&str> {
46        self._request_id.as_deref()
47    }
48}
49impl ListBucketsOutput {
50    /// Creates a new builder-style object to manufacture [`ListBucketsOutput`](crate::operation::list_buckets::ListBucketsOutput).
51    pub fn builder() -> crate::operation::list_buckets::builders::ListBucketsOutputBuilder {
52        crate::operation::list_buckets::builders::ListBucketsOutputBuilder::default()
53    }
54}
55
56/// A builder for [`ListBucketsOutput`](crate::operation::list_buckets::ListBucketsOutput).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct ListBucketsOutputBuilder {
60    pub(crate) buckets: ::std::option::Option<::std::vec::Vec<crate::types::Bucket>>,
61    pub(crate) owner: ::std::option::Option<crate::types::Owner>,
62    pub(crate) continuation_token: ::std::option::Option<::std::string::String>,
63    pub(crate) prefix: ::std::option::Option<::std::string::String>,
64    _extended_request_id: Option<String>,
65    _request_id: Option<String>,
66}
67impl ListBucketsOutputBuilder {
68    /// Appends an item to `buckets`.
69    ///
70    /// To override the contents of this collection use [`set_buckets`](Self::set_buckets).
71    ///
72    /// <p>The list of buckets owned by the requester.</p>
73    pub fn buckets(mut self, input: crate::types::Bucket) -> Self {
74        let mut v = self.buckets.unwrap_or_default();
75        v.push(input);
76        self.buckets = ::std::option::Option::Some(v);
77        self
78    }
79    /// <p>The list of buckets owned by the requester.</p>
80    pub fn set_buckets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Bucket>>) -> Self {
81        self.buckets = input;
82        self
83    }
84    /// <p>The list of buckets owned by the requester.</p>
85    pub fn get_buckets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Bucket>> {
86        &self.buckets
87    }
88    /// <p>The owner of the buckets listed.</p>
89    pub fn owner(mut self, input: crate::types::Owner) -> Self {
90        self.owner = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>The owner of the buckets listed.</p>
94    pub fn set_owner(mut self, input: ::std::option::Option<crate::types::Owner>) -> Self {
95        self.owner = input;
96        self
97    }
98    /// <p>The owner of the buckets listed.</p>
99    pub fn get_owner(&self) -> &::std::option::Option<crate::types::Owner> {
100        &self.owner
101    }
102    /// <p><code>ContinuationToken</code> is included in the response when there are more buckets that can be listed with pagination. The next <code>ListBuckets</code> request to Amazon S3 can be continued with this <code>ContinuationToken</code>. <code>ContinuationToken</code> is obfuscated and is not a real bucket.</p>
103    pub fn continuation_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.continuation_token = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p><code>ContinuationToken</code> is included in the response when there are more buckets that can be listed with pagination. The next <code>ListBuckets</code> request to Amazon S3 can be continued with this <code>ContinuationToken</code>. <code>ContinuationToken</code> is obfuscated and is not a real bucket.</p>
108    pub fn set_continuation_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.continuation_token = input;
110        self
111    }
112    /// <p><code>ContinuationToken</code> is included in the response when there are more buckets that can be listed with pagination. The next <code>ListBuckets</code> request to Amazon S3 can be continued with this <code>ContinuationToken</code>. <code>ContinuationToken</code> is obfuscated and is not a real bucket.</p>
113    pub fn get_continuation_token(&self) -> &::std::option::Option<::std::string::String> {
114        &self.continuation_token
115    }
116    /// <p>If <code>Prefix</code> was sent with the request, it is included in the response.</p>
117    /// <p>All bucket names in the response begin with the specified bucket name prefix.</p>
118    pub fn prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.prefix = ::std::option::Option::Some(input.into());
120        self
121    }
122    /// <p>If <code>Prefix</code> was sent with the request, it is included in the response.</p>
123    /// <p>All bucket names in the response begin with the specified bucket name prefix.</p>
124    pub fn set_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.prefix = input;
126        self
127    }
128    /// <p>If <code>Prefix</code> was sent with the request, it is included in the response.</p>
129    /// <p>All bucket names in the response begin with the specified bucket name prefix.</p>
130    pub fn get_prefix(&self) -> &::std::option::Option<::std::string::String> {
131        &self.prefix
132    }
133    pub(crate) fn _extended_request_id(mut self, extended_request_id: impl Into<String>) -> Self {
134        self._extended_request_id = Some(extended_request_id.into());
135        self
136    }
137
138    pub(crate) fn _set_extended_request_id(&mut self, extended_request_id: Option<String>) -> &mut Self {
139        self._extended_request_id = extended_request_id;
140        self
141    }
142    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
143        self._request_id = Some(request_id.into());
144        self
145    }
146
147    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
148        self._request_id = request_id;
149        self
150    }
151    /// Consumes the builder and constructs a [`ListBucketsOutput`](crate::operation::list_buckets::ListBucketsOutput).
152    pub fn build(self) -> crate::operation::list_buckets::ListBucketsOutput {
153        crate::operation::list_buckets::ListBucketsOutput {
154            buckets: self.buckets,
155            owner: self.owner,
156            continuation_token: self.continuation_token,
157            prefix: self.prefix,
158            _extended_request_id: self._extended_request_id,
159            _request_id: self._request_id,
160        }
161    }
162}