aws_sdk_codecommit/operation/get_folder/
_get_folder_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 GetFolderOutput {
6    /// <p>The full commit ID used as a reference for the returned version of the folder content.</p>
7    pub commit_id: ::std::string::String,
8    /// <p>The fully qualified path of the folder whose contents are returned.</p>
9    pub folder_path: ::std::string::String,
10    /// <p>The full SHA-1 pointer of the tree information for the commit that contains the folder.</p>
11    pub tree_id: ::std::option::Option<::std::string::String>,
12    /// <p>The list of folders that exist under the specified folder, if any.</p>
13    pub sub_folders: ::std::option::Option<::std::vec::Vec<crate::types::Folder>>,
14    /// <p>The list of files in the specified folder, if any.</p>
15    pub files: ::std::option::Option<::std::vec::Vec<crate::types::File>>,
16    /// <p>The list of symbolic links to other files and folders in the specified folder, if any.</p>
17    pub symbolic_links: ::std::option::Option<::std::vec::Vec<crate::types::SymbolicLink>>,
18    /// <p>The list of submodules in the specified folder, if any.</p>
19    pub sub_modules: ::std::option::Option<::std::vec::Vec<crate::types::SubModule>>,
20    _request_id: Option<String>,
21}
22impl GetFolderOutput {
23    /// <p>The full commit ID used as a reference for the returned version of the folder content.</p>
24    pub fn commit_id(&self) -> &str {
25        use std::ops::Deref;
26        self.commit_id.deref()
27    }
28    /// <p>The fully qualified path of the folder whose contents are returned.</p>
29    pub fn folder_path(&self) -> &str {
30        use std::ops::Deref;
31        self.folder_path.deref()
32    }
33    /// <p>The full SHA-1 pointer of the tree information for the commit that contains the folder.</p>
34    pub fn tree_id(&self) -> ::std::option::Option<&str> {
35        self.tree_id.as_deref()
36    }
37    /// <p>The list of folders that exist under the specified folder, if any.</p>
38    ///
39    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.sub_folders.is_none()`.
40    pub fn sub_folders(&self) -> &[crate::types::Folder] {
41        self.sub_folders.as_deref().unwrap_or_default()
42    }
43    /// <p>The list of files in the specified folder, if any.</p>
44    ///
45    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.files.is_none()`.
46    pub fn files(&self) -> &[crate::types::File] {
47        self.files.as_deref().unwrap_or_default()
48    }
49    /// <p>The list of symbolic links to other files and folders in the specified folder, if any.</p>
50    ///
51    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.symbolic_links.is_none()`.
52    pub fn symbolic_links(&self) -> &[crate::types::SymbolicLink] {
53        self.symbolic_links.as_deref().unwrap_or_default()
54    }
55    /// <p>The list of submodules in the specified folder, if any.</p>
56    ///
57    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.sub_modules.is_none()`.
58    pub fn sub_modules(&self) -> &[crate::types::SubModule] {
59        self.sub_modules.as_deref().unwrap_or_default()
60    }
61}
62impl ::aws_types::request_id::RequestId for GetFolderOutput {
63    fn request_id(&self) -> Option<&str> {
64        self._request_id.as_deref()
65    }
66}
67impl GetFolderOutput {
68    /// Creates a new builder-style object to manufacture [`GetFolderOutput`](crate::operation::get_folder::GetFolderOutput).
69    pub fn builder() -> crate::operation::get_folder::builders::GetFolderOutputBuilder {
70        crate::operation::get_folder::builders::GetFolderOutputBuilder::default()
71    }
72}
73
74/// A builder for [`GetFolderOutput`](crate::operation::get_folder::GetFolderOutput).
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
76#[non_exhaustive]
77pub struct GetFolderOutputBuilder {
78    pub(crate) commit_id: ::std::option::Option<::std::string::String>,
79    pub(crate) folder_path: ::std::option::Option<::std::string::String>,
80    pub(crate) tree_id: ::std::option::Option<::std::string::String>,
81    pub(crate) sub_folders: ::std::option::Option<::std::vec::Vec<crate::types::Folder>>,
82    pub(crate) files: ::std::option::Option<::std::vec::Vec<crate::types::File>>,
83    pub(crate) symbolic_links: ::std::option::Option<::std::vec::Vec<crate::types::SymbolicLink>>,
84    pub(crate) sub_modules: ::std::option::Option<::std::vec::Vec<crate::types::SubModule>>,
85    _request_id: Option<String>,
86}
87impl GetFolderOutputBuilder {
88    /// <p>The full commit ID used as a reference for the returned version of the folder content.</p>
89    /// This field is required.
90    pub fn commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.commit_id = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>The full commit ID used as a reference for the returned version of the folder content.</p>
95    pub fn set_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.commit_id = input;
97        self
98    }
99    /// <p>The full commit ID used as a reference for the returned version of the folder content.</p>
100    pub fn get_commit_id(&self) -> &::std::option::Option<::std::string::String> {
101        &self.commit_id
102    }
103    /// <p>The fully qualified path of the folder whose contents are returned.</p>
104    /// This field is required.
105    pub fn folder_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106        self.folder_path = ::std::option::Option::Some(input.into());
107        self
108    }
109    /// <p>The fully qualified path of the folder whose contents are returned.</p>
110    pub fn set_folder_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111        self.folder_path = input;
112        self
113    }
114    /// <p>The fully qualified path of the folder whose contents are returned.</p>
115    pub fn get_folder_path(&self) -> &::std::option::Option<::std::string::String> {
116        &self.folder_path
117    }
118    /// <p>The full SHA-1 pointer of the tree information for the commit that contains the folder.</p>
119    pub fn tree_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.tree_id = ::std::option::Option::Some(input.into());
121        self
122    }
123    /// <p>The full SHA-1 pointer of the tree information for the commit that contains the folder.</p>
124    pub fn set_tree_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.tree_id = input;
126        self
127    }
128    /// <p>The full SHA-1 pointer of the tree information for the commit that contains the folder.</p>
129    pub fn get_tree_id(&self) -> &::std::option::Option<::std::string::String> {
130        &self.tree_id
131    }
132    /// Appends an item to `sub_folders`.
133    ///
134    /// To override the contents of this collection use [`set_sub_folders`](Self::set_sub_folders).
135    ///
136    /// <p>The list of folders that exist under the specified folder, if any.</p>
137    pub fn sub_folders(mut self, input: crate::types::Folder) -> Self {
138        let mut v = self.sub_folders.unwrap_or_default();
139        v.push(input);
140        self.sub_folders = ::std::option::Option::Some(v);
141        self
142    }
143    /// <p>The list of folders that exist under the specified folder, if any.</p>
144    pub fn set_sub_folders(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Folder>>) -> Self {
145        self.sub_folders = input;
146        self
147    }
148    /// <p>The list of folders that exist under the specified folder, if any.</p>
149    pub fn get_sub_folders(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Folder>> {
150        &self.sub_folders
151    }
152    /// Appends an item to `files`.
153    ///
154    /// To override the contents of this collection use [`set_files`](Self::set_files).
155    ///
156    /// <p>The list of files in the specified folder, if any.</p>
157    pub fn files(mut self, input: crate::types::File) -> Self {
158        let mut v = self.files.unwrap_or_default();
159        v.push(input);
160        self.files = ::std::option::Option::Some(v);
161        self
162    }
163    /// <p>The list of files in the specified folder, if any.</p>
164    pub fn set_files(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::File>>) -> Self {
165        self.files = input;
166        self
167    }
168    /// <p>The list of files in the specified folder, if any.</p>
169    pub fn get_files(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::File>> {
170        &self.files
171    }
172    /// Appends an item to `symbolic_links`.
173    ///
174    /// To override the contents of this collection use [`set_symbolic_links`](Self::set_symbolic_links).
175    ///
176    /// <p>The list of symbolic links to other files and folders in the specified folder, if any.</p>
177    pub fn symbolic_links(mut self, input: crate::types::SymbolicLink) -> Self {
178        let mut v = self.symbolic_links.unwrap_or_default();
179        v.push(input);
180        self.symbolic_links = ::std::option::Option::Some(v);
181        self
182    }
183    /// <p>The list of symbolic links to other files and folders in the specified folder, if any.</p>
184    pub fn set_symbolic_links(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SymbolicLink>>) -> Self {
185        self.symbolic_links = input;
186        self
187    }
188    /// <p>The list of symbolic links to other files and folders in the specified folder, if any.</p>
189    pub fn get_symbolic_links(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SymbolicLink>> {
190        &self.symbolic_links
191    }
192    /// Appends an item to `sub_modules`.
193    ///
194    /// To override the contents of this collection use [`set_sub_modules`](Self::set_sub_modules).
195    ///
196    /// <p>The list of submodules in the specified folder, if any.</p>
197    pub fn sub_modules(mut self, input: crate::types::SubModule) -> Self {
198        let mut v = self.sub_modules.unwrap_or_default();
199        v.push(input);
200        self.sub_modules = ::std::option::Option::Some(v);
201        self
202    }
203    /// <p>The list of submodules in the specified folder, if any.</p>
204    pub fn set_sub_modules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SubModule>>) -> Self {
205        self.sub_modules = input;
206        self
207    }
208    /// <p>The list of submodules in the specified folder, if any.</p>
209    pub fn get_sub_modules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SubModule>> {
210        &self.sub_modules
211    }
212    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
213        self._request_id = Some(request_id.into());
214        self
215    }
216
217    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
218        self._request_id = request_id;
219        self
220    }
221    /// Consumes the builder and constructs a [`GetFolderOutput`](crate::operation::get_folder::GetFolderOutput).
222    /// This method will fail if any of the following fields are not set:
223    /// - [`commit_id`](crate::operation::get_folder::builders::GetFolderOutputBuilder::commit_id)
224    /// - [`folder_path`](crate::operation::get_folder::builders::GetFolderOutputBuilder::folder_path)
225    pub fn build(self) -> ::std::result::Result<crate::operation::get_folder::GetFolderOutput, ::aws_smithy_types::error::operation::BuildError> {
226        ::std::result::Result::Ok(crate::operation::get_folder::GetFolderOutput {
227            commit_id: self.commit_id.ok_or_else(|| {
228                ::aws_smithy_types::error::operation::BuildError::missing_field(
229                    "commit_id",
230                    "commit_id was not specified but it is required when building GetFolderOutput",
231                )
232            })?,
233            folder_path: self.folder_path.ok_or_else(|| {
234                ::aws_smithy_types::error::operation::BuildError::missing_field(
235                    "folder_path",
236                    "folder_path was not specified but it is required when building GetFolderOutput",
237                )
238            })?,
239            tree_id: self.tree_id,
240            sub_folders: self.sub_folders,
241            files: self.files,
242            symbolic_links: self.symbolic_links,
243            sub_modules: self.sub_modules,
244            _request_id: self._request_id,
245        })
246    }
247}