1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains information about an unused access finding for an IAM user access key. IAM Access Analyzer charges for unused access analysis based on the number of IAM roles and users analyzed per month. For more details on pricing, see <a href="https://aws.amazon.com/iam/access-analyzer/pricing">IAM Access Analyzer pricing</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct UnusedIamUserAccessKeyDetails {
    /// <p>The ID of the access key for which the unused access finding was generated.</p>
    pub access_key_id: ::std::string::String,
    /// <p>The time at which the access key was last accessed.</p>
    pub last_accessed: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl UnusedIamUserAccessKeyDetails {
    /// <p>The ID of the access key for which the unused access finding was generated.</p>
    pub fn access_key_id(&self) -> &str {
        use std::ops::Deref;
        self.access_key_id.deref()
    }
    /// <p>The time at which the access key was last accessed.</p>
    pub fn last_accessed(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.last_accessed.as_ref()
    }
}
impl UnusedIamUserAccessKeyDetails {
    /// Creates a new builder-style object to manufacture [`UnusedIamUserAccessKeyDetails`](crate::types::UnusedIamUserAccessKeyDetails).
    pub fn builder() -> crate::types::builders::UnusedIamUserAccessKeyDetailsBuilder {
        crate::types::builders::UnusedIamUserAccessKeyDetailsBuilder::default()
    }
}

/// A builder for [`UnusedIamUserAccessKeyDetails`](crate::types::UnusedIamUserAccessKeyDetails).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct UnusedIamUserAccessKeyDetailsBuilder {
    pub(crate) access_key_id: ::std::option::Option<::std::string::String>,
    pub(crate) last_accessed: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl UnusedIamUserAccessKeyDetailsBuilder {
    /// <p>The ID of the access key for which the unused access finding was generated.</p>
    /// This field is required.
    pub fn access_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.access_key_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the access key for which the unused access finding was generated.</p>
    pub fn set_access_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.access_key_id = input;
        self
    }
    /// <p>The ID of the access key for which the unused access finding was generated.</p>
    pub fn get_access_key_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.access_key_id
    }
    /// <p>The time at which the access key was last accessed.</p>
    pub fn last_accessed(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.last_accessed = ::std::option::Option::Some(input);
        self
    }
    /// <p>The time at which the access key was last accessed.</p>
    pub fn set_last_accessed(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.last_accessed = input;
        self
    }
    /// <p>The time at which the access key was last accessed.</p>
    pub fn get_last_accessed(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.last_accessed
    }
    /// Consumes the builder and constructs a [`UnusedIamUserAccessKeyDetails`](crate::types::UnusedIamUserAccessKeyDetails).
    /// This method will fail if any of the following fields are not set:
    /// - [`access_key_id`](crate::types::builders::UnusedIamUserAccessKeyDetailsBuilder::access_key_id)
    pub fn build(self) -> ::std::result::Result<crate::types::UnusedIamUserAccessKeyDetails, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::UnusedIamUserAccessKeyDetails {
            access_key_id: self.access_key_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "access_key_id",
                    "access_key_id was not specified but it is required when building UnusedIamUserAccessKeyDetails",
                )
            })?,
            last_accessed: self.last_accessed,
        })
    }
}