aws-sdk-codecommit 1.99.0

AWS SDK for AWS CodeCommit
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Returns information about a specific commit.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Commit {
    /// <p>The full SHA ID of the specified commit.</p>
    pub commit_id: ::std::option::Option<::std::string::String>,
    /// <p>Tree information for the specified commit.</p>
    pub tree_id: ::std::option::Option<::std::string::String>,
    /// <p>A list of parent commits for the specified commit. Each parent commit ID is the full commit ID.</p>
    pub parents: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The commit message associated with the specified commit.</p>
    pub message: ::std::option::Option<::std::string::String>,
    /// <p>Information about the author of the specified commit. Information includes the date in timestamp format with GMT offset, the name of the author, and the email address for the author, as configured in Git.</p>
    pub author: ::std::option::Option<crate::types::UserInfo>,
    /// <p>Information about the person who committed the specified commit, also known as the committer. Information includes the date in timestamp format with GMT offset, the name of the committer, and the email address for the committer, as configured in Git.</p>
    /// <p>For more information about the difference between an author and a committer in Git, see <a href="http://git-scm.com/book/ch2-3.html">Viewing the Commit History</a> in Pro Git by Scott Chacon and Ben Straub.</p>
    pub committer: ::std::option::Option<crate::types::UserInfo>,
    /// <p>Any other data associated with the specified commit.</p>
    pub additional_data: ::std::option::Option<::std::string::String>,
}
impl Commit {
    /// <p>The full SHA ID of the specified commit.</p>
    pub fn commit_id(&self) -> ::std::option::Option<&str> {
        self.commit_id.as_deref()
    }
    /// <p>Tree information for the specified commit.</p>
    pub fn tree_id(&self) -> ::std::option::Option<&str> {
        self.tree_id.as_deref()
    }
    /// <p>A list of parent commits for the specified commit. Each parent commit ID is the full commit ID.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.parents.is_none()`.
    pub fn parents(&self) -> &[::std::string::String] {
        self.parents.as_deref().unwrap_or_default()
    }
    /// <p>The commit message associated with the specified commit.</p>
    pub fn message(&self) -> ::std::option::Option<&str> {
        self.message.as_deref()
    }
    /// <p>Information about the author of the specified commit. Information includes the date in timestamp format with GMT offset, the name of the author, and the email address for the author, as configured in Git.</p>
    pub fn author(&self) -> ::std::option::Option<&crate::types::UserInfo> {
        self.author.as_ref()
    }
    /// <p>Information about the person who committed the specified commit, also known as the committer. Information includes the date in timestamp format with GMT offset, the name of the committer, and the email address for the committer, as configured in Git.</p>
    /// <p>For more information about the difference between an author and a committer in Git, see <a href="http://git-scm.com/book/ch2-3.html">Viewing the Commit History</a> in Pro Git by Scott Chacon and Ben Straub.</p>
    pub fn committer(&self) -> ::std::option::Option<&crate::types::UserInfo> {
        self.committer.as_ref()
    }
    /// <p>Any other data associated with the specified commit.</p>
    pub fn additional_data(&self) -> ::std::option::Option<&str> {
        self.additional_data.as_deref()
    }
}
impl Commit {
    /// Creates a new builder-style object to manufacture [`Commit`](crate::types::Commit).
    pub fn builder() -> crate::types::builders::CommitBuilder {
        crate::types::builders::CommitBuilder::default()
    }
}

/// A builder for [`Commit`](crate::types::Commit).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CommitBuilder {
    pub(crate) commit_id: ::std::option::Option<::std::string::String>,
    pub(crate) tree_id: ::std::option::Option<::std::string::String>,
    pub(crate) parents: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) message: ::std::option::Option<::std::string::String>,
    pub(crate) author: ::std::option::Option<crate::types::UserInfo>,
    pub(crate) committer: ::std::option::Option<crate::types::UserInfo>,
    pub(crate) additional_data: ::std::option::Option<::std::string::String>,
}
impl CommitBuilder {
    /// <p>The full SHA ID of the specified commit.</p>
    pub fn commit_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.commit_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The full SHA ID of the specified commit.</p>
    pub fn set_commit_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.commit_id = input;
        self
    }
    /// <p>The full SHA ID of the specified commit.</p>
    pub fn get_commit_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.commit_id
    }
    /// <p>Tree information for the specified commit.</p>
    pub fn tree_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.tree_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Tree information for the specified commit.</p>
    pub fn set_tree_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.tree_id = input;
        self
    }
    /// <p>Tree information for the specified commit.</p>
    pub fn get_tree_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.tree_id
    }
    /// Appends an item to `parents`.
    ///
    /// To override the contents of this collection use [`set_parents`](Self::set_parents).
    ///
    /// <p>A list of parent commits for the specified commit. Each parent commit ID is the full commit ID.</p>
    pub fn parents(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.parents.unwrap_or_default();
        v.push(input.into());
        self.parents = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of parent commits for the specified commit. Each parent commit ID is the full commit ID.</p>
    pub fn set_parents(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.parents = input;
        self
    }
    /// <p>A list of parent commits for the specified commit. Each parent commit ID is the full commit ID.</p>
    pub fn get_parents(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.parents
    }
    /// <p>The commit message associated with the specified commit.</p>
    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.message = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The commit message associated with the specified commit.</p>
    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.message = input;
        self
    }
    /// <p>The commit message associated with the specified commit.</p>
    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
        &self.message
    }
    /// <p>Information about the author of the specified commit. Information includes the date in timestamp format with GMT offset, the name of the author, and the email address for the author, as configured in Git.</p>
    pub fn author(mut self, input: crate::types::UserInfo) -> Self {
        self.author = ::std::option::Option::Some(input);
        self
    }
    /// <p>Information about the author of the specified commit. Information includes the date in timestamp format with GMT offset, the name of the author, and the email address for the author, as configured in Git.</p>
    pub fn set_author(mut self, input: ::std::option::Option<crate::types::UserInfo>) -> Self {
        self.author = input;
        self
    }
    /// <p>Information about the author of the specified commit. Information includes the date in timestamp format with GMT offset, the name of the author, and the email address for the author, as configured in Git.</p>
    pub fn get_author(&self) -> &::std::option::Option<crate::types::UserInfo> {
        &self.author
    }
    /// <p>Information about the person who committed the specified commit, also known as the committer. Information includes the date in timestamp format with GMT offset, the name of the committer, and the email address for the committer, as configured in Git.</p>
    /// <p>For more information about the difference between an author and a committer in Git, see <a href="http://git-scm.com/book/ch2-3.html">Viewing the Commit History</a> in Pro Git by Scott Chacon and Ben Straub.</p>
    pub fn committer(mut self, input: crate::types::UserInfo) -> Self {
        self.committer = ::std::option::Option::Some(input);
        self
    }
    /// <p>Information about the person who committed the specified commit, also known as the committer. Information includes the date in timestamp format with GMT offset, the name of the committer, and the email address for the committer, as configured in Git.</p>
    /// <p>For more information about the difference between an author and a committer in Git, see <a href="http://git-scm.com/book/ch2-3.html">Viewing the Commit History</a> in Pro Git by Scott Chacon and Ben Straub.</p>
    pub fn set_committer(mut self, input: ::std::option::Option<crate::types::UserInfo>) -> Self {
        self.committer = input;
        self
    }
    /// <p>Information about the person who committed the specified commit, also known as the committer. Information includes the date in timestamp format with GMT offset, the name of the committer, and the email address for the committer, as configured in Git.</p>
    /// <p>For more information about the difference between an author and a committer in Git, see <a href="http://git-scm.com/book/ch2-3.html">Viewing the Commit History</a> in Pro Git by Scott Chacon and Ben Straub.</p>
    pub fn get_committer(&self) -> &::std::option::Option<crate::types::UserInfo> {
        &self.committer
    }
    /// <p>Any other data associated with the specified commit.</p>
    pub fn additional_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.additional_data = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Any other data associated with the specified commit.</p>
    pub fn set_additional_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.additional_data = input;
        self
    }
    /// <p>Any other data associated with the specified commit.</p>
    pub fn get_additional_data(&self) -> &::std::option::Option<::std::string::String> {
        &self.additional_data
    }
    /// Consumes the builder and constructs a [`Commit`](crate::types::Commit).
    pub fn build(self) -> crate::types::Commit {
        crate::types::Commit {
            commit_id: self.commit_id,
            tree_id: self.tree_id,
            parents: self.parents,
            message: self.message,
            author: self.author,
            committer: self.committer,
            additional_data: self.additional_data,
        }
    }
}