aws-sdk-datasync 1.58.0

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

/// <p>The credentials that provide DataSync Discovery read access to your on-premises storage system's management interface.</p>
/// <p>DataSync Discovery stores these credentials in <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html">Secrets Manager</a>. For more information, see <a href="https://docs.aws.amazon.com/datasync/latest/userguide/discovery-configure-storage.html">Accessing your on-premises storage system</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Credentials {
    /// <p>Specifies the user name for your storage system's management interface.</p>
    pub username: ::std::string::String,
    /// <p>Specifies the password for your storage system's management interface.</p>
    pub password: ::std::string::String,
}
impl Credentials {
    /// <p>Specifies the user name for your storage system's management interface.</p>
    pub fn username(&self) -> &str {
        use std::ops::Deref;
        self.username.deref()
    }
    /// <p>Specifies the password for your storage system's management interface.</p>
    pub fn password(&self) -> &str {
        use std::ops::Deref;
        self.password.deref()
    }
}
impl ::std::fmt::Debug for Credentials {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Credentials");
        formatter.field("username", &"*** Sensitive Data Redacted ***");
        formatter.field("password", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}
impl Credentials {
    /// Creates a new builder-style object to manufacture [`Credentials`](crate::types::Credentials).
    pub fn builder() -> crate::types::builders::CredentialsBuilder {
        crate::types::builders::CredentialsBuilder::default()
    }
}

/// A builder for [`Credentials`](crate::types::Credentials).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CredentialsBuilder {
    pub(crate) username: ::std::option::Option<::std::string::String>,
    pub(crate) password: ::std::option::Option<::std::string::String>,
}
impl CredentialsBuilder {
    /// <p>Specifies the user name for your storage system's management interface.</p>
    /// This field is required.
    pub fn username(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.username = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Specifies the user name for your storage system's management interface.</p>
    pub fn set_username(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.username = input;
        self
    }
    /// <p>Specifies the user name for your storage system's management interface.</p>
    pub fn get_username(&self) -> &::std::option::Option<::std::string::String> {
        &self.username
    }
    /// <p>Specifies the password for your storage system's management interface.</p>
    /// This field is required.
    pub fn password(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.password = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Specifies the password for your storage system's management interface.</p>
    pub fn set_password(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.password = input;
        self
    }
    /// <p>Specifies the password for your storage system's management interface.</p>
    pub fn get_password(&self) -> &::std::option::Option<::std::string::String> {
        &self.password
    }
    /// Consumes the builder and constructs a [`Credentials`](crate::types::Credentials).
    /// This method will fail if any of the following fields are not set:
    /// - [`username`](crate::types::builders::CredentialsBuilder::username)
    /// - [`password`](crate::types::builders::CredentialsBuilder::password)
    pub fn build(self) -> ::std::result::Result<crate::types::Credentials, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Credentials {
            username: self.username.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "username",
                    "username was not specified but it is required when building Credentials",
                )
            })?,
            password: self.password.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "password",
                    "password was not specified but it is required when building Credentials",
                )
            })?,
        })
    }
}
impl ::std::fmt::Debug for CredentialsBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CredentialsBuilder");
        formatter.field("username", &"*** Sensitive Data Redacted ***");
        formatter.field("password", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}