Skip to main content

aws_sdk_accessanalyzer/types/
_unused_iam_user_access_key_details.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <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>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UnusedIamUserAccessKeyDetails {
7    /// <p>The ID of the access key for which the unused access finding was generated.</p>
8    pub access_key_id: ::std::string::String,
9    /// <p>The time at which the access key was last accessed.</p>
10    pub last_accessed: ::std::option::Option<::aws_smithy_types::DateTime>,
11}
12impl UnusedIamUserAccessKeyDetails {
13    /// <p>The ID of the access key for which the unused access finding was generated.</p>
14    pub fn access_key_id(&self) -> &str {
15        use std::ops::Deref;
16        self.access_key_id.deref()
17    }
18    /// <p>The time at which the access key was last accessed.</p>
19    pub fn last_accessed(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
20        self.last_accessed.as_ref()
21    }
22}
23impl UnusedIamUserAccessKeyDetails {
24    /// Creates a new builder-style object to manufacture [`UnusedIamUserAccessKeyDetails`](crate::types::UnusedIamUserAccessKeyDetails).
25    pub fn builder() -> crate::types::builders::UnusedIamUserAccessKeyDetailsBuilder {
26        crate::types::builders::UnusedIamUserAccessKeyDetailsBuilder::default()
27    }
28}
29
30/// A builder for [`UnusedIamUserAccessKeyDetails`](crate::types::UnusedIamUserAccessKeyDetails).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct UnusedIamUserAccessKeyDetailsBuilder {
34    pub(crate) access_key_id: ::std::option::Option<::std::string::String>,
35    pub(crate) last_accessed: ::std::option::Option<::aws_smithy_types::DateTime>,
36}
37impl UnusedIamUserAccessKeyDetailsBuilder {
38    /// <p>The ID of the access key for which the unused access finding was generated.</p>
39    /// This field is required.
40    pub fn access_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.access_key_id = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The ID of the access key for which the unused access finding was generated.</p>
45    pub fn set_access_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.access_key_id = input;
47        self
48    }
49    /// <p>The ID of the access key for which the unused access finding was generated.</p>
50    pub fn get_access_key_id(&self) -> &::std::option::Option<::std::string::String> {
51        &self.access_key_id
52    }
53    /// <p>The time at which the access key was last accessed.</p>
54    pub fn last_accessed(mut self, input: ::aws_smithy_types::DateTime) -> Self {
55        self.last_accessed = ::std::option::Option::Some(input);
56        self
57    }
58    /// <p>The time at which the access key was last accessed.</p>
59    pub fn set_last_accessed(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
60        self.last_accessed = input;
61        self
62    }
63    /// <p>The time at which the access key was last accessed.</p>
64    pub fn get_last_accessed(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
65        &self.last_accessed
66    }
67    /// Consumes the builder and constructs a [`UnusedIamUserAccessKeyDetails`](crate::types::UnusedIamUserAccessKeyDetails).
68    /// This method will fail if any of the following fields are not set:
69    /// - [`access_key_id`](crate::types::builders::UnusedIamUserAccessKeyDetailsBuilder::access_key_id)
70    pub fn build(self) -> ::std::result::Result<crate::types::UnusedIamUserAccessKeyDetails, ::aws_smithy_types::error::operation::BuildError> {
71        ::std::result::Result::Ok(crate::types::UnusedIamUserAccessKeyDetails {
72            access_key_id: self.access_key_id.ok_or_else(|| {
73                ::aws_smithy_types::error::operation::BuildError::missing_field(
74                    "access_key_id",
75                    "access_key_id was not specified but it is required when building UnusedIamUserAccessKeyDetails",
76                )
77            })?,
78            last_accessed: self.last_accessed,
79        })
80    }
81}