aws_sdk_codecommit/operation/create_branch/
_create_branch_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the input of a create branch operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateBranchInput {
7    /// <p>The name of the repository in which you want to create the new branch.</p>
8    pub repository_name: ::std::option::Option<::std::string::String>,
9    /// <p>The name of the new branch to create.</p>
10    pub branch_name: ::std::option::Option<::std::string::String>,
11    /// <p>The ID of the commit to point the new branch to.</p>
12    pub commit_id: ::std::option::Option<::std::string::String>,
13}
14impl CreateBranchInput {
15    /// <p>The name of the repository in which you want to create the new branch.</p>
16    pub fn repository_name(&self) -> ::std::option::Option<&str> {
17        self.repository_name.as_deref()
18    }
19    /// <p>The name of the new branch to create.</p>
20    pub fn branch_name(&self) -> ::std::option::Option<&str> {
21        self.branch_name.as_deref()
22    }
23    /// <p>The ID of the commit to point the new branch to.</p>
24    pub fn commit_id(&self) -> ::std::option::Option<&str> {
25        self.commit_id.as_deref()
26    }
27}
28impl CreateBranchInput {
29    /// Creates a new builder-style object to manufacture [`CreateBranchInput`](crate::operation::create_branch::CreateBranchInput).
30    pub fn builder() -> crate::operation::create_branch::builders::CreateBranchInputBuilder {
31        crate::operation::create_branch::builders::CreateBranchInputBuilder::default()
32    }
33}
34
35/// A builder for [`CreateBranchInput`](crate::operation::create_branch::CreateBranchInput).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct CreateBranchInputBuilder {
39    pub(crate) repository_name: ::std::option::Option<::std::string::String>,
40    pub(crate) branch_name: ::std::option::Option<::std::string::String>,
41    pub(crate) commit_id: ::std::option::Option<::std::string::String>,
42}
43impl CreateBranchInputBuilder {
44    /// <p>The name of the repository in which you want to create the new branch.</p>
45    /// This field is required.
46    pub fn repository_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
47        self.repository_name = ::std::option::Option::Some(input.into());
48        self
49    }
50    /// <p>The name of the repository in which you want to create the new branch.</p>
51    pub fn set_repository_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
52        self.repository_name = input;
53        self
54    }
55    /// <p>The name of the repository in which you want to create the new branch.</p>
56    pub fn get_repository_name(&self) -> &::std::option::Option<::std::string::String> {
57        &self.repository_name
58    }
59    /// <p>The name of the new branch to create.</p>
60    /// This field is required.
61    pub fn branch_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.branch_name = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The name of the new branch to create.</p>
66    pub fn set_branch_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.branch_name = input;
68        self
69    }
70    /// <p>The name of the new branch to create.</p>
71    pub fn get_branch_name(&self) -> &::std::option::Option<::std::string::String> {
72        &self.branch_name
73    }
74    /// <p>The ID of the commit to point the new branch to.</p>
75    /// This field is required.
76    pub fn commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.commit_id = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>The ID of the commit to point the new branch to.</p>
81    pub fn set_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.commit_id = input;
83        self
84    }
85    /// <p>The ID of the commit to point the new branch to.</p>
86    pub fn get_commit_id(&self) -> &::std::option::Option<::std::string::String> {
87        &self.commit_id
88    }
89    /// Consumes the builder and constructs a [`CreateBranchInput`](crate::operation::create_branch::CreateBranchInput).
90    pub fn build(
91        self,
92    ) -> ::std::result::Result<crate::operation::create_branch::CreateBranchInput, ::aws_smithy_types::error::operation::BuildError> {
93        ::std::result::Result::Ok(crate::operation::create_branch::CreateBranchInput {
94            repository_name: self.repository_name,
95            branch_name: self.branch_name,
96            commit_id: self.commit_id,
97        })
98    }
99}