aws_sdk_codecommit/operation/create_commit/
_create_commit_input.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 CreateCommitInput {
6    /// <p>The name of the repository where you create the commit.</p>
7    pub repository_name: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the branch where you create the commit.</p>
9    pub branch_name: ::std::option::Option<::std::string::String>,
10    /// <p>The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.</p>
11    pub parent_commit_id: ::std::option::Option<::std::string::String>,
12    /// <p>The name of the author who created the commit. This information is used as both the author and committer for the commit.</p>
13    pub author_name: ::std::option::Option<::std::string::String>,
14    /// <p>The email address of the person who created the commit.</p>
15    pub email: ::std::option::Option<::std::string::String>,
16    /// <p>The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.</p>
17    pub commit_message: ::std::option::Option<::std::string::String>,
18    /// <p>If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.</p>
19    pub keep_empty_folders: ::std::option::Option<bool>,
20    /// <p>The files to add or update in this commit.</p>
21    pub put_files: ::std::option::Option<::std::vec::Vec<crate::types::PutFileEntry>>,
22    /// <p>The files to delete in this commit. These files still exist in earlier commits.</p>
23    pub delete_files: ::std::option::Option<::std::vec::Vec<crate::types::DeleteFileEntry>>,
24    /// <p>The file modes to update for files in this commit.</p>
25    pub set_file_modes: ::std::option::Option<::std::vec::Vec<crate::types::SetFileModeEntry>>,
26}
27impl CreateCommitInput {
28    /// <p>The name of the repository where you create the commit.</p>
29    pub fn repository_name(&self) -> ::std::option::Option<&str> {
30        self.repository_name.as_deref()
31    }
32    /// <p>The name of the branch where you create the commit.</p>
33    pub fn branch_name(&self) -> ::std::option::Option<&str> {
34        self.branch_name.as_deref()
35    }
36    /// <p>The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.</p>
37    pub fn parent_commit_id(&self) -> ::std::option::Option<&str> {
38        self.parent_commit_id.as_deref()
39    }
40    /// <p>The name of the author who created the commit. This information is used as both the author and committer for the commit.</p>
41    pub fn author_name(&self) -> ::std::option::Option<&str> {
42        self.author_name.as_deref()
43    }
44    /// <p>The email address of the person who created the commit.</p>
45    pub fn email(&self) -> ::std::option::Option<&str> {
46        self.email.as_deref()
47    }
48    /// <p>The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.</p>
49    pub fn commit_message(&self) -> ::std::option::Option<&str> {
50        self.commit_message.as_deref()
51    }
52    /// <p>If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.</p>
53    pub fn keep_empty_folders(&self) -> ::std::option::Option<bool> {
54        self.keep_empty_folders
55    }
56    /// <p>The files to add or update in this commit.</p>
57    ///
58    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.put_files.is_none()`.
59    pub fn put_files(&self) -> &[crate::types::PutFileEntry] {
60        self.put_files.as_deref().unwrap_or_default()
61    }
62    /// <p>The files to delete in this commit. These files still exist in earlier commits.</p>
63    ///
64    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.delete_files.is_none()`.
65    pub fn delete_files(&self) -> &[crate::types::DeleteFileEntry] {
66        self.delete_files.as_deref().unwrap_or_default()
67    }
68    /// <p>The file modes to update for files in this commit.</p>
69    ///
70    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.set_file_modes.is_none()`.
71    pub fn set_file_modes(&self) -> &[crate::types::SetFileModeEntry] {
72        self.set_file_modes.as_deref().unwrap_or_default()
73    }
74}
75impl CreateCommitInput {
76    /// Creates a new builder-style object to manufacture [`CreateCommitInput`](crate::operation::create_commit::CreateCommitInput).
77    pub fn builder() -> crate::operation::create_commit::builders::CreateCommitInputBuilder {
78        crate::operation::create_commit::builders::CreateCommitInputBuilder::default()
79    }
80}
81
82/// A builder for [`CreateCommitInput`](crate::operation::create_commit::CreateCommitInput).
83#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
84#[non_exhaustive]
85pub struct CreateCommitInputBuilder {
86    pub(crate) repository_name: ::std::option::Option<::std::string::String>,
87    pub(crate) branch_name: ::std::option::Option<::std::string::String>,
88    pub(crate) parent_commit_id: ::std::option::Option<::std::string::String>,
89    pub(crate) author_name: ::std::option::Option<::std::string::String>,
90    pub(crate) email: ::std::option::Option<::std::string::String>,
91    pub(crate) commit_message: ::std::option::Option<::std::string::String>,
92    pub(crate) keep_empty_folders: ::std::option::Option<bool>,
93    pub(crate) put_files: ::std::option::Option<::std::vec::Vec<crate::types::PutFileEntry>>,
94    pub(crate) delete_files: ::std::option::Option<::std::vec::Vec<crate::types::DeleteFileEntry>>,
95    pub(crate) set_file_modes: ::std::option::Option<::std::vec::Vec<crate::types::SetFileModeEntry>>,
96}
97impl CreateCommitInputBuilder {
98    /// <p>The name of the repository where you create the commit.</p>
99    /// This field is required.
100    pub fn repository_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101        self.repository_name = ::std::option::Option::Some(input.into());
102        self
103    }
104    /// <p>The name of the repository where you create the commit.</p>
105    pub fn set_repository_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
106        self.repository_name = input;
107        self
108    }
109    /// <p>The name of the repository where you create the commit.</p>
110    pub fn get_repository_name(&self) -> &::std::option::Option<::std::string::String> {
111        &self.repository_name
112    }
113    /// <p>The name of the branch where you create the commit.</p>
114    /// This field is required.
115    pub fn branch_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.branch_name = ::std::option::Option::Some(input.into());
117        self
118    }
119    /// <p>The name of the branch where you create the commit.</p>
120    pub fn set_branch_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.branch_name = input;
122        self
123    }
124    /// <p>The name of the branch where you create the commit.</p>
125    pub fn get_branch_name(&self) -> &::std::option::Option<::std::string::String> {
126        &self.branch_name
127    }
128    /// <p>The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.</p>
129    pub fn parent_commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.parent_commit_id = ::std::option::Option::Some(input.into());
131        self
132    }
133    /// <p>The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.</p>
134    pub fn set_parent_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.parent_commit_id = input;
136        self
137    }
138    /// <p>The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.</p>
139    pub fn get_parent_commit_id(&self) -> &::std::option::Option<::std::string::String> {
140        &self.parent_commit_id
141    }
142    /// <p>The name of the author who created the commit. This information is used as both the author and committer for the commit.</p>
143    pub fn author_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.author_name = ::std::option::Option::Some(input.into());
145        self
146    }
147    /// <p>The name of the author who created the commit. This information is used as both the author and committer for the commit.</p>
148    pub fn set_author_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149        self.author_name = input;
150        self
151    }
152    /// <p>The name of the author who created the commit. This information is used as both the author and committer for the commit.</p>
153    pub fn get_author_name(&self) -> &::std::option::Option<::std::string::String> {
154        &self.author_name
155    }
156    /// <p>The email address of the person who created the commit.</p>
157    pub fn email(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        self.email = ::std::option::Option::Some(input.into());
159        self
160    }
161    /// <p>The email address of the person who created the commit.</p>
162    pub fn set_email(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.email = input;
164        self
165    }
166    /// <p>The email address of the person who created the commit.</p>
167    pub fn get_email(&self) -> &::std::option::Option<::std::string::String> {
168        &self.email
169    }
170    /// <p>The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.</p>
171    pub fn commit_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
172        self.commit_message = ::std::option::Option::Some(input.into());
173        self
174    }
175    /// <p>The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.</p>
176    pub fn set_commit_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
177        self.commit_message = input;
178        self
179    }
180    /// <p>The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.</p>
181    pub fn get_commit_message(&self) -> &::std::option::Option<::std::string::String> {
182        &self.commit_message
183    }
184    /// <p>If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.</p>
185    pub fn keep_empty_folders(mut self, input: bool) -> Self {
186        self.keep_empty_folders = ::std::option::Option::Some(input);
187        self
188    }
189    /// <p>If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.</p>
190    pub fn set_keep_empty_folders(mut self, input: ::std::option::Option<bool>) -> Self {
191        self.keep_empty_folders = input;
192        self
193    }
194    /// <p>If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.</p>
195    pub fn get_keep_empty_folders(&self) -> &::std::option::Option<bool> {
196        &self.keep_empty_folders
197    }
198    /// Appends an item to `put_files`.
199    ///
200    /// To override the contents of this collection use [`set_put_files`](Self::set_put_files).
201    ///
202    /// <p>The files to add or update in this commit.</p>
203    pub fn put_files(mut self, input: crate::types::PutFileEntry) -> Self {
204        let mut v = self.put_files.unwrap_or_default();
205        v.push(input);
206        self.put_files = ::std::option::Option::Some(v);
207        self
208    }
209    /// <p>The files to add or update in this commit.</p>
210    pub fn set_put_files(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PutFileEntry>>) -> Self {
211        self.put_files = input;
212        self
213    }
214    /// <p>The files to add or update in this commit.</p>
215    pub fn get_put_files(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PutFileEntry>> {
216        &self.put_files
217    }
218    /// Appends an item to `delete_files`.
219    ///
220    /// To override the contents of this collection use [`set_delete_files`](Self::set_delete_files).
221    ///
222    /// <p>The files to delete in this commit. These files still exist in earlier commits.</p>
223    pub fn delete_files(mut self, input: crate::types::DeleteFileEntry) -> Self {
224        let mut v = self.delete_files.unwrap_or_default();
225        v.push(input);
226        self.delete_files = ::std::option::Option::Some(v);
227        self
228    }
229    /// <p>The files to delete in this commit. These files still exist in earlier commits.</p>
230    pub fn set_delete_files(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DeleteFileEntry>>) -> Self {
231        self.delete_files = input;
232        self
233    }
234    /// <p>The files to delete in this commit. These files still exist in earlier commits.</p>
235    pub fn get_delete_files(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DeleteFileEntry>> {
236        &self.delete_files
237    }
238    /// Appends an item to `set_file_modes`.
239    ///
240    /// To override the contents of this collection use [`set_set_file_modes`](Self::set_set_file_modes).
241    ///
242    /// <p>The file modes to update for files in this commit.</p>
243    pub fn set_file_modes(mut self, input: crate::types::SetFileModeEntry) -> Self {
244        let mut v = self.set_file_modes.unwrap_or_default();
245        v.push(input);
246        self.set_file_modes = ::std::option::Option::Some(v);
247        self
248    }
249    /// <p>The file modes to update for files in this commit.</p>
250    pub fn set_set_file_modes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SetFileModeEntry>>) -> Self {
251        self.set_file_modes = input;
252        self
253    }
254    /// <p>The file modes to update for files in this commit.</p>
255    pub fn get_set_file_modes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SetFileModeEntry>> {
256        &self.set_file_modes
257    }
258    /// Consumes the builder and constructs a [`CreateCommitInput`](crate::operation::create_commit::CreateCommitInput).
259    pub fn build(
260        self,
261    ) -> ::std::result::Result<crate::operation::create_commit::CreateCommitInput, ::aws_smithy_types::error::operation::BuildError> {
262        ::std::result::Result::Ok(crate::operation::create_commit::CreateCommitInput {
263            repository_name: self.repository_name,
264            branch_name: self.branch_name,
265            parent_commit_id: self.parent_commit_id,
266            author_name: self.author_name,
267            email: self.email,
268            commit_message: self.commit_message,
269            keep_empty_folders: self.keep_empty_folders,
270            put_files: self.put_files,
271            delete_files: self.delete_files,
272            set_file_modes: self.set_file_modes,
273        })
274    }
275}