aws_sdk_workdocs/types/
_share_principal.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SharePrincipal {
7 pub id: ::std::string::String,
9 pub r#type: crate::types::PrincipalType,
11 pub role: crate::types::RoleType,
13}
14impl SharePrincipal {
15 pub fn id(&self) -> &str {
17 use std::ops::Deref;
18 self.id.deref()
19 }
20 pub fn r#type(&self) -> &crate::types::PrincipalType {
22 &self.r#type
23 }
24 pub fn role(&self) -> &crate::types::RoleType {
26 &self.role
27 }
28}
29impl SharePrincipal {
30 pub fn builder() -> crate::types::builders::SharePrincipalBuilder {
32 crate::types::builders::SharePrincipalBuilder::default()
33 }
34}
35
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct SharePrincipalBuilder {
40 pub(crate) id: ::std::option::Option<::std::string::String>,
41 pub(crate) r#type: ::std::option::Option<crate::types::PrincipalType>,
42 pub(crate) role: ::std::option::Option<crate::types::RoleType>,
43}
44impl SharePrincipalBuilder {
45 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48 self.id = ::std::option::Option::Some(input.into());
49 self
50 }
51 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53 self.id = input;
54 self
55 }
56 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
58 &self.id
59 }
60 pub fn r#type(mut self, input: crate::types::PrincipalType) -> Self {
63 self.r#type = ::std::option::Option::Some(input);
64 self
65 }
66 pub fn set_type(mut self, input: ::std::option::Option<crate::types::PrincipalType>) -> Self {
68 self.r#type = input;
69 self
70 }
71 pub fn get_type(&self) -> &::std::option::Option<crate::types::PrincipalType> {
73 &self.r#type
74 }
75 pub fn role(mut self, input: crate::types::RoleType) -> Self {
78 self.role = ::std::option::Option::Some(input);
79 self
80 }
81 pub fn set_role(mut self, input: ::std::option::Option<crate::types::RoleType>) -> Self {
83 self.role = input;
84 self
85 }
86 pub fn get_role(&self) -> &::std::option::Option<crate::types::RoleType> {
88 &self.role
89 }
90 pub fn build(self) -> ::std::result::Result<crate::types::SharePrincipal, ::aws_smithy_types::error::operation::BuildError> {
96 ::std::result::Result::Ok(crate::types::SharePrincipal {
97 id: self.id.ok_or_else(|| {
98 ::aws_smithy_types::error::operation::BuildError::missing_field(
99 "id",
100 "id was not specified but it is required when building SharePrincipal",
101 )
102 })?,
103 r#type: self.r#type.ok_or_else(|| {
104 ::aws_smithy_types::error::operation::BuildError::missing_field(
105 "r#type",
106 "r#type was not specified but it is required when building SharePrincipal",
107 )
108 })?,
109 role: self.role.ok_or_else(|| {
110 ::aws_smithy_types::error::operation::BuildError::missing_field(
111 "role",
112 "role was not specified but it is required when building SharePrincipal",
113 )
114 })?,
115 })
116 }
117}