aws-sdk-proton 1.101.0

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

/// <p>Revision detail data for a commit and push that activates a sync attempt</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Revision {
    /// <p>The repository name.</p>
    pub repository_name: ::std::string::String,
    /// <p>The repository provider.</p>
    pub repository_provider: crate::types::RepositoryProvider,
    /// <p>The secure hash algorithm (SHA) hash for the revision.</p>
    pub sha: ::std::string::String,
    /// <p>The repository directory changed by a commit and push that activated the sync attempt.</p>
    pub directory: ::std::string::String,
    /// <p>The repository branch.</p>
    pub branch: ::std::string::String,
}
impl Revision {
    /// <p>The repository name.</p>
    pub fn repository_name(&self) -> &str {
        use std::ops::Deref;
        self.repository_name.deref()
    }
    /// <p>The repository provider.</p>
    pub fn repository_provider(&self) -> &crate::types::RepositoryProvider {
        &self.repository_provider
    }
    /// <p>The secure hash algorithm (SHA) hash for the revision.</p>
    pub fn sha(&self) -> &str {
        use std::ops::Deref;
        self.sha.deref()
    }
    /// <p>The repository directory changed by a commit and push that activated the sync attempt.</p>
    pub fn directory(&self) -> &str {
        use std::ops::Deref;
        self.directory.deref()
    }
    /// <p>The repository branch.</p>
    pub fn branch(&self) -> &str {
        use std::ops::Deref;
        self.branch.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) repository_name: ::std::option::Option<::std::string::String>,
    pub(crate) repository_provider: ::std::option::Option<crate::types::RepositoryProvider>,
    pub(crate) sha: ::std::option::Option<::std::string::String>,
    pub(crate) directory: ::std::option::Option<::std::string::String>,
    pub(crate) branch: ::std::option::Option<::std::string::String>,
}
impl RevisionBuilder {
    /// <p>The repository name.</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.</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.</p>
    pub fn get_repository_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.repository_name
    }
    /// <p>The repository provider.</p>
    /// This field is required.
    pub fn repository_provider(mut self, input: crate::types::RepositoryProvider) -> Self {
        self.repository_provider = ::std::option::Option::Some(input);
        self
    }
    /// <p>The repository provider.</p>
    pub fn set_repository_provider(mut self, input: ::std::option::Option<crate::types::RepositoryProvider>) -> Self {
        self.repository_provider = input;
        self
    }
    /// <p>The repository provider.</p>
    pub fn get_repository_provider(&self) -> &::std::option::Option<crate::types::RepositoryProvider> {
        &self.repository_provider
    }
    /// <p>The secure hash algorithm (SHA) hash for the 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 secure hash algorithm (SHA) hash for the revision.</p>
    pub fn set_sha(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.sha = input;
        self
    }
    /// <p>The secure hash algorithm (SHA) hash for the revision.</p>
    pub fn get_sha(&self) -> &::std::option::Option<::std::string::String> {
        &self.sha
    }
    /// <p>The repository directory changed by a commit and push that activated the sync attempt.</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 repository directory changed by a commit and push that activated the sync attempt.</p>
    pub fn set_directory(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.directory = input;
        self
    }
    /// <p>The repository directory changed by a commit and push that activated the sync attempt.</p>
    pub fn get_directory(&self) -> &::std::option::Option<::std::string::String> {
        &self.directory
    }
    /// <p>The repository branch.</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 repository branch.</p>
    pub fn set_branch(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.branch = input;
        self
    }
    /// <p>The repository branch.</p>
    pub fn get_branch(&self) -> &::std::option::Option<::std::string::String> {
        &self.branch
    }
    /// Consumes the builder and constructs a [`Revision`](crate::types::Revision).
    /// This method will fail if any of the following fields are not set:
    /// - [`repository_name`](crate::types::builders::RevisionBuilder::repository_name)
    /// - [`repository_provider`](crate::types::builders::RevisionBuilder::repository_provider)
    /// - [`sha`](crate::types::builders::RevisionBuilder::sha)
    /// - [`directory`](crate::types::builders::RevisionBuilder::directory)
    /// - [`branch`](crate::types::builders::RevisionBuilder::branch)
    pub fn build(self) -> ::std::result::Result<crate::types::Revision, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::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",
                )
            })?,
            repository_provider: self.repository_provider.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "repository_provider",
                    "repository_provider 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",
                )
            })?,
            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",
                )
            })?,
            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",
                )
            })?,
        })
    }
}