aws-sdk-codeconnections 1.83.0

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

/// <p>Information about the revision for a specific sync event, such as the branch, owner ID, and name of the repository.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Revision {
    /// <p>The branch name for a specific revision.</p>
    pub branch: ::std::string::String,
    /// <p>The directory, if any, for a specific revision.</p>
    pub directory: ::std::string::String,
    /// <p>The owner ID for a specific revision, such as the GitHub owner ID for a GitHub repository.</p>
    pub owner_id: ::std::string::String,
    /// <p>The repository name for a specific revision.</p>
    pub repository_name: ::std::string::String,
    /// <p>The provider type for a revision, such as GitHub.</p>
    pub provider_type: crate::types::ProviderType,
    /// <p>The SHA, such as the commit ID, for a specific revision.</p>
    pub sha: ::std::string::String,
}
impl Revision {
    /// <p>The branch name for a specific revision.</p>
    pub fn branch(&self) -> &str {
        use std::ops::Deref;
        self.branch.deref()
    }
    /// <p>The directory, if any, for a specific revision.</p>
    pub fn directory(&self) -> &str {
        use std::ops::Deref;
        self.directory.deref()
    }
    /// <p>The owner ID for a specific revision, such as the GitHub owner ID for a GitHub repository.</p>
    pub fn owner_id(&self) -> &str {
        use std::ops::Deref;
        self.owner_id.deref()
    }
    /// <p>The repository name for a specific revision.</p>
    pub fn repository_name(&self) -> &str {
        use std::ops::Deref;
        self.repository_name.deref()
    }
    /// <p>The provider type for a revision, such as GitHub.</p>
    pub fn provider_type(&self) -> &crate::types::ProviderType {
        &self.provider_type
    }
    /// <p>The SHA, such as the commit ID, for a specific revision.</p>
    pub fn sha(&self) -> &str {
        use std::ops::Deref;
        self.sha.deref()
    }
}
impl Revision {
    /// Creates a new builder-style object to manufacture [`Revision`](crate::types::Revision).
    pub fn builder() -> crate::types::builders::RevisionBuilder {
        crate::types::builders::RevisionBuilder::default()
    }
}

/// A builder for [`Revision`](crate::types::Revision).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RevisionBuilder {
    pub(crate) branch: ::std::option::Option<::std::string::String>,
    pub(crate) directory: ::std::option::Option<::std::string::String>,
    pub(crate) owner_id: ::std::option::Option<::std::string::String>,
    pub(crate) repository_name: ::std::option::Option<::std::string::String>,
    pub(crate) provider_type: ::std::option::Option<crate::types::ProviderType>,
    pub(crate) sha: ::std::option::Option<::std::string::String>,
}
impl RevisionBuilder {
    /// <p>The branch name for a specific revision.</p>
    /// This field is required.
    pub fn branch(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.branch = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The branch name for a specific revision.</p>
    pub fn set_branch(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.branch = input;
        self
    }
    /// <p>The branch name for a specific revision.</p>
    pub fn get_branch(&self) -> &::std::option::Option<::std::string::String> {
        &self.branch
    }
    /// <p>The directory, if any, for a specific revision.</p>
    /// This field is required.
    pub fn directory(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.directory = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The directory, if any, for a specific revision.</p>
    pub fn set_directory(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.directory = input;
        self
    }
    /// <p>The directory, if any, for a specific revision.</p>
    pub fn get_directory(&self) -> &::std::option::Option<::std::string::String> {
        &self.directory
    }
    /// <p>The owner ID for a specific revision, such as the GitHub owner ID for a GitHub repository.</p>
    /// This field is required.
    pub fn owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.owner_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The owner ID for a specific revision, such as the GitHub owner ID for a GitHub repository.</p>
    pub fn set_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.owner_id = input;
        self
    }
    /// <p>The owner ID for a specific revision, such as the GitHub owner ID for a GitHub repository.</p>
    pub fn get_owner_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.owner_id
    }
    /// <p>The repository name for a specific revision.</p>
    /// This field is required.
    pub fn repository_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.repository_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The repository name for a specific revision.</p>
    pub fn set_repository_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.repository_name = input;
        self
    }
    /// <p>The repository name for a specific revision.</p>
    pub fn get_repository_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.repository_name
    }
    /// <p>The provider type for a revision, such as GitHub.</p>
    /// This field is required.
    pub fn provider_type(mut self, input: crate::types::ProviderType) -> Self {
        self.provider_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The provider type for a revision, such as GitHub.</p>
    pub fn set_provider_type(mut self, input: ::std::option::Option<crate::types::ProviderType>) -> Self {
        self.provider_type = input;
        self
    }
    /// <p>The provider type for a revision, such as GitHub.</p>
    pub fn get_provider_type(&self) -> &::std::option::Option<crate::types::ProviderType> {
        &self.provider_type
    }
    /// <p>The SHA, such as the commit ID, for a specific revision.</p>
    /// This field is required.
    pub fn sha(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.sha = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The SHA, such as the commit ID, for a specific revision.</p>
    pub fn set_sha(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.sha = input;
        self
    }
    /// <p>The SHA, such as the commit ID, for a specific revision.</p>
    pub fn get_sha(&self) -> &::std::option::Option<::std::string::String> {
        &self.sha
    }
    /// Consumes the builder and constructs a [`Revision`](crate::types::Revision).
    /// This method will fail if any of the following fields are not set:
    /// - [`branch`](crate::types::builders::RevisionBuilder::branch)
    /// - [`directory`](crate::types::builders::RevisionBuilder::directory)
    /// - [`owner_id`](crate::types::builders::RevisionBuilder::owner_id)
    /// - [`repository_name`](crate::types::builders::RevisionBuilder::repository_name)
    /// - [`provider_type`](crate::types::builders::RevisionBuilder::provider_type)
    /// - [`sha`](crate::types::builders::RevisionBuilder::sha)
    pub fn build(self) -> ::std::result::Result<crate::types::Revision, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Revision {
            branch: self.branch.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "branch",
                    "branch was not specified but it is required when building Revision",
                )
            })?,
            directory: self.directory.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "directory",
                    "directory was not specified but it is required when building Revision",
                )
            })?,
            owner_id: self.owner_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "owner_id",
                    "owner_id was not specified but it is required when building Revision",
                )
            })?,
            repository_name: self.repository_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "repository_name",
                    "repository_name was not specified but it is required when building Revision",
                )
            })?,
            provider_type: self.provider_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "provider_type",
                    "provider_type was not specified but it is required when building Revision",
                )
            })?,
            sha: self.sha.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "sha",
                    "sha was not specified but it is required when building Revision",
                )
            })?,
        })
    }
}