aws_sdk_workdocs/types/
_search_principal_type.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SearchPrincipalType {
7 pub id: ::std::string::String,
9 pub roles: ::std::option::Option<::std::vec::Vec<crate::types::PrincipalRoleType>>,
11}
12impl SearchPrincipalType {
13 pub fn id(&self) -> &str {
15 use std::ops::Deref;
16 self.id.deref()
17 }
18 pub fn roles(&self) -> &[crate::types::PrincipalRoleType] {
22 self.roles.as_deref().unwrap_or_default()
23 }
24}
25impl SearchPrincipalType {
26 pub fn builder() -> crate::types::builders::SearchPrincipalTypeBuilder {
28 crate::types::builders::SearchPrincipalTypeBuilder::default()
29 }
30}
31
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
34#[non_exhaustive]
35pub struct SearchPrincipalTypeBuilder {
36 pub(crate) id: ::std::option::Option<::std::string::String>,
37 pub(crate) roles: ::std::option::Option<::std::vec::Vec<crate::types::PrincipalRoleType>>,
38}
39impl SearchPrincipalTypeBuilder {
40 pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
43 self.id = ::std::option::Option::Some(input.into());
44 self
45 }
46 pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
48 self.id = input;
49 self
50 }
51 pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
53 &self.id
54 }
55 pub fn roles(mut self, input: crate::types::PrincipalRoleType) -> Self {
61 let mut v = self.roles.unwrap_or_default();
62 v.push(input);
63 self.roles = ::std::option::Option::Some(v);
64 self
65 }
66 pub fn set_roles(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PrincipalRoleType>>) -> Self {
68 self.roles = input;
69 self
70 }
71 pub fn get_roles(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PrincipalRoleType>> {
73 &self.roles
74 }
75 pub fn build(self) -> ::std::result::Result<crate::types::SearchPrincipalType, ::aws_smithy_types::error::operation::BuildError> {
79 ::std::result::Result::Ok(crate::types::SearchPrincipalType {
80 id: self.id.ok_or_else(|| {
81 ::aws_smithy_types::error::operation::BuildError::missing_field(
82 "id",
83 "id was not specified but it is required when building SearchPrincipalType",
84 )
85 })?,
86 roles: self.roles,
87 })
88 }
89}