aws_sdk_iam/operation/get_mfa_device/
_get_mfa_device_output.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetMfaDeviceOutput {
6 pub user_name: ::std::option::Option<::std::string::String>,
8 pub serial_number: ::std::string::String,
10 pub enable_date: ::std::option::Option<::aws_smithy_types::DateTime>,
12 pub certifications: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
14 _request_id: Option<String>,
15}
16impl GetMfaDeviceOutput {
17 pub fn user_name(&self) -> ::std::option::Option<&str> {
19 self.user_name.as_deref()
20 }
21 pub fn serial_number(&self) -> &str {
23 use std::ops::Deref;
24 self.serial_number.deref()
25 }
26 pub fn enable_date(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
28 self.enable_date.as_ref()
29 }
30 pub fn certifications(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
32 self.certifications.as_ref()
33 }
34}
35impl ::aws_types::request_id::RequestId for GetMfaDeviceOutput {
36 fn request_id(&self) -> Option<&str> {
37 self._request_id.as_deref()
38 }
39}
40impl GetMfaDeviceOutput {
41 pub fn builder() -> crate::operation::get_mfa_device::builders::GetMfaDeviceOutputBuilder {
43 crate::operation::get_mfa_device::builders::GetMfaDeviceOutputBuilder::default()
44 }
45}
46
47#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct GetMfaDeviceOutputBuilder {
51 pub(crate) user_name: ::std::option::Option<::std::string::String>,
52 pub(crate) serial_number: ::std::option::Option<::std::string::String>,
53 pub(crate) enable_date: ::std::option::Option<::aws_smithy_types::DateTime>,
54 pub(crate) certifications: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
55 _request_id: Option<String>,
56}
57impl GetMfaDeviceOutputBuilder {
58 pub fn user_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
60 self.user_name = ::std::option::Option::Some(input.into());
61 self
62 }
63 pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
65 self.user_name = input;
66 self
67 }
68 pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
70 &self.user_name
71 }
72 pub fn serial_number(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75 self.serial_number = ::std::option::Option::Some(input.into());
76 self
77 }
78 pub fn set_serial_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80 self.serial_number = input;
81 self
82 }
83 pub fn get_serial_number(&self) -> &::std::option::Option<::std::string::String> {
85 &self.serial_number
86 }
87 pub fn enable_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
89 self.enable_date = ::std::option::Option::Some(input);
90 self
91 }
92 pub fn set_enable_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
94 self.enable_date = input;
95 self
96 }
97 pub fn get_enable_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
99 &self.enable_date
100 }
101 pub fn certifications(
107 mut self,
108 k: impl ::std::convert::Into<::std::string::String>,
109 v: impl ::std::convert::Into<::std::string::String>,
110 ) -> Self {
111 let mut hash_map = self.certifications.unwrap_or_default();
112 hash_map.insert(k.into(), v.into());
113 self.certifications = ::std::option::Option::Some(hash_map);
114 self
115 }
116 pub fn set_certifications(
118 mut self,
119 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
120 ) -> Self {
121 self.certifications = input;
122 self
123 }
124 pub fn get_certifications(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
126 &self.certifications
127 }
128 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
129 self._request_id = Some(request_id.into());
130 self
131 }
132
133 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
134 self._request_id = request_id;
135 self
136 }
137 pub fn build(
141 self,
142 ) -> ::std::result::Result<crate::operation::get_mfa_device::GetMfaDeviceOutput, ::aws_smithy_types::error::operation::BuildError> {
143 ::std::result::Result::Ok(crate::operation::get_mfa_device::GetMfaDeviceOutput {
144 user_name: self.user_name,
145 serial_number: self.serial_number.ok_or_else(|| {
146 ::aws_smithy_types::error::operation::BuildError::missing_field(
147 "serial_number",
148 "serial_number was not specified but it is required when building GetMfaDeviceOutput",
149 )
150 })?,
151 enable_date: self.enable_date,
152 certifications: self.certifications,
153 _request_id: self._request_id,
154 })
155 }
156}