Skip to main content

aws_sdk_iam/operation/get_mfa_device/
_get_mfa_device_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetMfaDeviceOutput {
6    /// <p>The friendly name identifying the user.</p>
7    pub user_name: ::std::option::Option<::std::string::String>,
8    /// <p>Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">ARNs</a>.</p>
9    pub serial_number: ::std::string::String,
10    /// <p>The date that a specified user's MFA device was first enabled.</p>
11    pub enable_date: ::std::option::Option<::aws_smithy_types::DateTime>,
12    /// <p>The certifications of a specified user's MFA device. We currently provide FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from <a href="https://fidoalliance.org/metadata/"> FIDO Alliance Metadata Service (MDS)</a>.</p>
13    pub certifications: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
14    _request_id: Option<String>,
15}
16impl GetMfaDeviceOutput {
17    /// <p>The friendly name identifying the user.</p>
18    pub fn user_name(&self) -> ::std::option::Option<&str> {
19        self.user_name.as_deref()
20    }
21    /// <p>Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">ARNs</a>.</p>
22    pub fn serial_number(&self) -> &str {
23        use std::ops::Deref;
24        self.serial_number.deref()
25    }
26    /// <p>The date that a specified user's MFA device was first enabled.</p>
27    pub fn enable_date(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
28        self.enable_date.as_ref()
29    }
30    /// <p>The certifications of a specified user's MFA device. We currently provide FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from <a href="https://fidoalliance.org/metadata/"> FIDO Alliance Metadata Service (MDS)</a>.</p>
31    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    /// Creates a new builder-style object to manufacture [`GetMfaDeviceOutput`](crate::operation::get_mfa_device::GetMfaDeviceOutput).
42    pub fn builder() -> crate::operation::get_mfa_device::builders::GetMfaDeviceOutputBuilder {
43        crate::operation::get_mfa_device::builders::GetMfaDeviceOutputBuilder::default()
44    }
45}
46
47/// A builder for [`GetMfaDeviceOutput`](crate::operation::get_mfa_device::GetMfaDeviceOutput).
48#[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    /// <p>The friendly name identifying the user.</p>
59    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    /// <p>The friendly name identifying the user.</p>
64    pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
65        self.user_name = input;
66        self
67    }
68    /// <p>The friendly name identifying the user.</p>
69    pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
70        &self.user_name
71    }
72    /// <p>Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">ARNs</a>.</p>
73    /// This field is required.
74    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    /// <p>Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">ARNs</a>.</p>
79    pub fn set_serial_number(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.serial_number = input;
81        self
82    }
83    /// <p>Serial number that uniquely identifies the MFA device. For this API, we only accept FIDO security key <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">ARNs</a>.</p>
84    pub fn get_serial_number(&self) -> &::std::option::Option<::std::string::String> {
85        &self.serial_number
86    }
87    /// <p>The date that a specified user's MFA device was first enabled.</p>
88    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    /// <p>The date that a specified user's MFA device was first enabled.</p>
93    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    /// <p>The date that a specified user's MFA device was first enabled.</p>
98    pub fn get_enable_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
99        &self.enable_date
100    }
101    /// Adds a key-value pair to `certifications`.
102    ///
103    /// To override the contents of this collection use [`set_certifications`](Self::set_certifications).
104    ///
105    /// <p>The certifications of a specified user's MFA device. We currently provide FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from <a href="https://fidoalliance.org/metadata/"> FIDO Alliance Metadata Service (MDS)</a>.</p>
106    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    /// <p>The certifications of a specified user's MFA device. We currently provide FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from <a href="https://fidoalliance.org/metadata/"> FIDO Alliance Metadata Service (MDS)</a>.</p>
117    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    /// <p>The certifications of a specified user's MFA device. We currently provide FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from <a href="https://fidoalliance.org/metadata/"> FIDO Alliance Metadata Service (MDS)</a>.</p>
125    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    /// Consumes the builder and constructs a [`GetMfaDeviceOutput`](crate::operation::get_mfa_device::GetMfaDeviceOutput).
138    /// This method will fail if any of the following fields are not set:
139    /// - [`serial_number`](crate::operation::get_mfa_device::builders::GetMfaDeviceOutputBuilder::serial_number)
140    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}