#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Principal {
pub name: ::std::string::String,
pub r#type: crate::types::PrincipalType,
pub access: crate::types::ReadAccessType,
pub data_source_id: ::std::option::Option<::std::string::String>,
}
impl Principal {
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
pub fn r#type(&self) -> &crate::types::PrincipalType {
&self.r#type
}
pub fn access(&self) -> &crate::types::ReadAccessType {
&self.access
}
pub fn data_source_id(&self) -> ::std::option::Option<&str> {
self.data_source_id.as_deref()
}
}
impl Principal {
pub fn builder() -> crate::types::builders::PrincipalBuilder {
crate::types::builders::PrincipalBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PrincipalBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) r#type: ::std::option::Option<crate::types::PrincipalType>,
pub(crate) access: ::std::option::Option<crate::types::ReadAccessType>,
pub(crate) data_source_id: ::std::option::Option<::std::string::String>,
}
impl PrincipalBuilder {
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
pub fn r#type(mut self, input: crate::types::PrincipalType) -> Self {
self.r#type = ::std::option::Option::Some(input);
self
}
pub fn set_type(mut self, input: ::std::option::Option<crate::types::PrincipalType>) -> Self {
self.r#type = input;
self
}
pub fn get_type(&self) -> &::std::option::Option<crate::types::PrincipalType> {
&self.r#type
}
pub fn access(mut self, input: crate::types::ReadAccessType) -> Self {
self.access = ::std::option::Option::Some(input);
self
}
pub fn set_access(mut self, input: ::std::option::Option<crate::types::ReadAccessType>) -> Self {
self.access = input;
self
}
pub fn get_access(&self) -> &::std::option::Option<crate::types::ReadAccessType> {
&self.access
}
pub fn data_source_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.data_source_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_data_source_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.data_source_id = input;
self
}
pub fn get_data_source_id(&self) -> &::std::option::Option<::std::string::String> {
&self.data_source_id
}
pub fn build(self) -> ::std::result::Result<crate::types::Principal, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Principal {
name: self.name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"name",
"name was not specified but it is required when building Principal",
)
})?,
r#type: self.r#type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"r#type",
"r#type was not specified but it is required when building Principal",
)
})?,
access: self.access.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"access",
"access was not specified but it is required when building Principal",
)
})?,
data_source_id: self.data_source_id,
})
}
}