aws_sdk_codecommit/operation/put_file/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_file::_put_file_output::PutFileOutputBuilder;
3
4pub use crate::operation::put_file::_put_file_input::PutFileInputBuilder;
5
6impl crate::operation::put_file::builders::PutFileInputBuilder {
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::put_file::PutFileOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_file::PutFileError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_file();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutFile`.
24///
25/// <p>Adds or updates a file in a branch in an CodeCommit repository, and generates a commit for the addition in the specified branch.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct PutFileFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::put_file::builders::PutFileInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::put_file::PutFileOutput, crate::operation::put_file::PutFileError>
33    for PutFileFluentBuilder
34{
35    fn send(
36        self,
37        config_override: crate::config::Builder,
38    ) -> crate::client::customize::internal::BoxFuture<
39        crate::client::customize::internal::SendResult<crate::operation::put_file::PutFileOutput, crate::operation::put_file::PutFileError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl PutFileFluentBuilder {
45    /// Creates a new `PutFileFluentBuilder`.
46    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
47        Self {
48            handle,
49            inner: ::std::default::Default::default(),
50            config_override: ::std::option::Option::None,
51        }
52    }
53    /// Access the PutFile as a reference.
54    pub fn as_input(&self) -> &crate::operation::put_file::builders::PutFileInputBuilder {
55        &self.inner
56    }
57    /// Sends the request and returns the response.
58    ///
59    /// If an error occurs, an `SdkError` will be returned with additional details that
60    /// can be matched against.
61    ///
62    /// By default, any retryable failures will be retried twice. Retry behavior
63    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
64    /// set when configuring the client.
65    pub async fn send(
66        self,
67    ) -> ::std::result::Result<
68        crate::operation::put_file::PutFileOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::put_file::PutFileError,
71            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
72        >,
73    > {
74        let input = self
75            .inner
76            .build()
77            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
78        let runtime_plugins = crate::operation::put_file::PutFile::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::put_file::PutFile::orchestrate(&runtime_plugins, input).await
84    }
85
86    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
87    pub fn customize(
88        self,
89    ) -> crate::client::customize::CustomizableOperation<crate::operation::put_file::PutFileOutput, crate::operation::put_file::PutFileError, Self>
90    {
91        crate::client::customize::CustomizableOperation::new(self)
92    }
93    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
94        self.set_config_override(::std::option::Option::Some(config_override.into()));
95        self
96    }
97
98    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
99        self.config_override = config_override;
100        self
101    }
102    /// <p>The name of the repository where you want to add or update the file.</p>
103    pub fn repository_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.inner = self.inner.repository_name(input.into());
105        self
106    }
107    /// <p>The name of the repository where you want to add or update the file.</p>
108    pub fn set_repository_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.inner = self.inner.set_repository_name(input);
110        self
111    }
112    /// <p>The name of the repository where you want to add or update the file.</p>
113    pub fn get_repository_name(&self) -> &::std::option::Option<::std::string::String> {
114        self.inner.get_repository_name()
115    }
116    /// <p>The name of the branch where you want to add or update the file. If this is an empty repository, this branch is created.</p>
117    pub fn branch_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.branch_name(input.into());
119        self
120    }
121    /// <p>The name of the branch where you want to add or update the file. If this is an empty repository, this branch is created.</p>
122    pub fn set_branch_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_branch_name(input);
124        self
125    }
126    /// <p>The name of the branch where you want to add or update the file. If this is an empty repository, this branch is created.</p>
127    pub fn get_branch_name(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_branch_name()
129    }
130    /// <p>The content of the file, in binary object format.</p>
131    pub fn file_content(mut self, input: ::aws_smithy_types::Blob) -> Self {
132        self.inner = self.inner.file_content(input);
133        self
134    }
135    /// <p>The content of the file, in binary object format.</p>
136    pub fn set_file_content(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
137        self.inner = self.inner.set_file_content(input);
138        self
139    }
140    /// <p>The content of the file, in binary object format.</p>
141    pub fn get_file_content(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
142        self.inner.get_file_content()
143    }
144    /// <p>The name of the file you want to add or update, including the relative path to the file in the repository.</p><note>
145    /// <p>If the path does not currently exist in the repository, the path is created as part of adding the file.</p>
146    /// </note>
147    pub fn file_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.file_path(input.into());
149        self
150    }
151    /// <p>The name of the file you want to add or update, including the relative path to the file in the repository.</p><note>
152    /// <p>If the path does not currently exist in the repository, the path is created as part of adding the file.</p>
153    /// </note>
154    pub fn set_file_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.inner = self.inner.set_file_path(input);
156        self
157    }
158    /// <p>The name of the file you want to add or update, including the relative path to the file in the repository.</p><note>
159    /// <p>If the path does not currently exist in the repository, the path is created as part of adding the file.</p>
160    /// </note>
161    pub fn get_file_path(&self) -> &::std::option::Option<::std::string::String> {
162        self.inner.get_file_path()
163    }
164    /// <p>The file mode permissions of the blob. Valid file mode permissions are listed here.</p>
165    pub fn file_mode(mut self, input: crate::types::FileModeTypeEnum) -> Self {
166        self.inner = self.inner.file_mode(input);
167        self
168    }
169    /// <p>The file mode permissions of the blob. Valid file mode permissions are listed here.</p>
170    pub fn set_file_mode(mut self, input: ::std::option::Option<crate::types::FileModeTypeEnum>) -> Self {
171        self.inner = self.inner.set_file_mode(input);
172        self
173    }
174    /// <p>The file mode permissions of the blob. Valid file mode permissions are listed here.</p>
175    pub fn get_file_mode(&self) -> &::std::option::Option<crate::types::FileModeTypeEnum> {
176        self.inner.get_file_mode()
177    }
178    /// <p>The full commit ID of the head commit in the branch where you want to add or update the file. If this is an empty repository, no commit ID is required. If this is not an empty repository, a commit ID is required.</p>
179    /// <p>The commit ID must match the ID of the head commit at the time of the operation. Otherwise, an error occurs, and the file is not added or updated.</p>
180    pub fn parent_commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.inner = self.inner.parent_commit_id(input.into());
182        self
183    }
184    /// <p>The full commit ID of the head commit in the branch where you want to add or update the file. If this is an empty repository, no commit ID is required. If this is not an empty repository, a commit ID is required.</p>
185    /// <p>The commit ID must match the ID of the head commit at the time of the operation. Otherwise, an error occurs, and the file is not added or updated.</p>
186    pub fn set_parent_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
187        self.inner = self.inner.set_parent_commit_id(input);
188        self
189    }
190    /// <p>The full commit ID of the head commit in the branch where you want to add or update the file. If this is an empty repository, no commit ID is required. If this is not an empty repository, a commit ID is required.</p>
191    /// <p>The commit ID must match the ID of the head commit at the time of the operation. Otherwise, an error occurs, and the file is not added or updated.</p>
192    pub fn get_parent_commit_id(&self) -> &::std::option::Option<::std::string::String> {
193        self.inner.get_parent_commit_id()
194    }
195    /// <p>A message about why this file was added or updated. Although it is optional, a message makes the commit history for your repository more useful.</p>
196    pub fn commit_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        self.inner = self.inner.commit_message(input.into());
198        self
199    }
200    /// <p>A message about why this file was added or updated. Although it is optional, a message makes the commit history for your repository more useful.</p>
201    pub fn set_commit_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
202        self.inner = self.inner.set_commit_message(input);
203        self
204    }
205    /// <p>A message about why this file was added or updated. Although it is optional, a message makes the commit history for your repository more useful.</p>
206    pub fn get_commit_message(&self) -> &::std::option::Option<::std::string::String> {
207        self.inner.get_commit_message()
208    }
209    /// <p>The name of the person adding or updating the file. Although it is optional, a name makes the commit history for your repository more useful.</p>
210    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
211        self.inner = self.inner.name(input.into());
212        self
213    }
214    /// <p>The name of the person adding or updating the file. Although it is optional, a name makes the commit history for your repository more useful.</p>
215    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
216        self.inner = self.inner.set_name(input);
217        self
218    }
219    /// <p>The name of the person adding or updating the file. Although it is optional, a name makes the commit history for your repository more useful.</p>
220    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
221        self.inner.get_name()
222    }
223    /// <p>An email address for the person adding or updating the file.</p>
224    pub fn email(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
225        self.inner = self.inner.email(input.into());
226        self
227    }
228    /// <p>An email address for the person adding or updating the file.</p>
229    pub fn set_email(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
230        self.inner = self.inner.set_email(input);
231        self
232    }
233    /// <p>An email address for the person adding or updating the file.</p>
234    pub fn get_email(&self) -> &::std::option::Option<::std::string::String> {
235        self.inner.get_email()
236    }
237}