{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IAM.Types.AccessKeyMetadata where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.StatusType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AccessKeyMetadata = AccessKeyMetadata'
{
AccessKeyMetadata -> Maybe StatusType
status :: Prelude.Maybe StatusType,
AccessKeyMetadata -> Maybe ISO8601
createDate :: Prelude.Maybe Core.ISO8601,
AccessKeyMetadata -> Maybe Text
userName :: Prelude.Maybe Prelude.Text,
AccessKeyMetadata -> Maybe AccessKey
accessKeyId :: Prelude.Maybe Core.AccessKey
}
deriving (AccessKeyMetadata -> AccessKeyMetadata -> Bool
(AccessKeyMetadata -> AccessKeyMetadata -> Bool)
-> (AccessKeyMetadata -> AccessKeyMetadata -> Bool)
-> Eq AccessKeyMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessKeyMetadata -> AccessKeyMetadata -> Bool
$c/= :: AccessKeyMetadata -> AccessKeyMetadata -> Bool
== :: AccessKeyMetadata -> AccessKeyMetadata -> Bool
$c== :: AccessKeyMetadata -> AccessKeyMetadata -> Bool
Prelude.Eq, ReadPrec [AccessKeyMetadata]
ReadPrec AccessKeyMetadata
Int -> ReadS AccessKeyMetadata
ReadS [AccessKeyMetadata]
(Int -> ReadS AccessKeyMetadata)
-> ReadS [AccessKeyMetadata]
-> ReadPrec AccessKeyMetadata
-> ReadPrec [AccessKeyMetadata]
-> Read AccessKeyMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessKeyMetadata]
$creadListPrec :: ReadPrec [AccessKeyMetadata]
readPrec :: ReadPrec AccessKeyMetadata
$creadPrec :: ReadPrec AccessKeyMetadata
readList :: ReadS [AccessKeyMetadata]
$creadList :: ReadS [AccessKeyMetadata]
readsPrec :: Int -> ReadS AccessKeyMetadata
$creadsPrec :: Int -> ReadS AccessKeyMetadata
Prelude.Read, Int -> AccessKeyMetadata -> ShowS
[AccessKeyMetadata] -> ShowS
AccessKeyMetadata -> String
(Int -> AccessKeyMetadata -> ShowS)
-> (AccessKeyMetadata -> String)
-> ([AccessKeyMetadata] -> ShowS)
-> Show AccessKeyMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessKeyMetadata] -> ShowS
$cshowList :: [AccessKeyMetadata] -> ShowS
show :: AccessKeyMetadata -> String
$cshow :: AccessKeyMetadata -> String
showsPrec :: Int -> AccessKeyMetadata -> ShowS
$cshowsPrec :: Int -> AccessKeyMetadata -> ShowS
Prelude.Show, (forall x. AccessKeyMetadata -> Rep AccessKeyMetadata x)
-> (forall x. Rep AccessKeyMetadata x -> AccessKeyMetadata)
-> Generic AccessKeyMetadata
forall x. Rep AccessKeyMetadata x -> AccessKeyMetadata
forall x. AccessKeyMetadata -> Rep AccessKeyMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessKeyMetadata x -> AccessKeyMetadata
$cfrom :: forall x. AccessKeyMetadata -> Rep AccessKeyMetadata x
Prelude.Generic)
newAccessKeyMetadata ::
AccessKeyMetadata
newAccessKeyMetadata :: AccessKeyMetadata
newAccessKeyMetadata =
AccessKeyMetadata' :: Maybe StatusType
-> Maybe ISO8601
-> Maybe Text
-> Maybe AccessKey
-> AccessKeyMetadata
AccessKeyMetadata'
{ $sel:status:AccessKeyMetadata' :: Maybe StatusType
status = Maybe StatusType
forall a. Maybe a
Prelude.Nothing,
$sel:createDate:AccessKeyMetadata' :: Maybe ISO8601
createDate = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:userName:AccessKeyMetadata' :: Maybe Text
userName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:accessKeyId:AccessKeyMetadata' :: Maybe AccessKey
accessKeyId = Maybe AccessKey
forall a. Maybe a
Prelude.Nothing
}
accessKeyMetadata_status :: Lens.Lens' AccessKeyMetadata (Prelude.Maybe StatusType)
accessKeyMetadata_status :: (Maybe StatusType -> f (Maybe StatusType))
-> AccessKeyMetadata -> f AccessKeyMetadata
accessKeyMetadata_status = (AccessKeyMetadata -> Maybe StatusType)
-> (AccessKeyMetadata -> Maybe StatusType -> AccessKeyMetadata)
-> Lens
AccessKeyMetadata
AccessKeyMetadata
(Maybe StatusType)
(Maybe StatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKeyMetadata' {Maybe StatusType
status :: Maybe StatusType
$sel:status:AccessKeyMetadata' :: AccessKeyMetadata -> Maybe StatusType
status} -> Maybe StatusType
status) (\s :: AccessKeyMetadata
s@AccessKeyMetadata' {} Maybe StatusType
a -> AccessKeyMetadata
s {$sel:status:AccessKeyMetadata' :: Maybe StatusType
status = Maybe StatusType
a} :: AccessKeyMetadata)
accessKeyMetadata_createDate :: Lens.Lens' AccessKeyMetadata (Prelude.Maybe Prelude.UTCTime)
accessKeyMetadata_createDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AccessKeyMetadata -> f AccessKeyMetadata
accessKeyMetadata_createDate = (AccessKeyMetadata -> Maybe ISO8601)
-> (AccessKeyMetadata -> Maybe ISO8601 -> AccessKeyMetadata)
-> Lens
AccessKeyMetadata AccessKeyMetadata (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKeyMetadata' {Maybe ISO8601
createDate :: Maybe ISO8601
$sel:createDate:AccessKeyMetadata' :: AccessKeyMetadata -> Maybe ISO8601
createDate} -> Maybe ISO8601
createDate) (\s :: AccessKeyMetadata
s@AccessKeyMetadata' {} Maybe ISO8601
a -> AccessKeyMetadata
s {$sel:createDate:AccessKeyMetadata' :: Maybe ISO8601
createDate = Maybe ISO8601
a} :: AccessKeyMetadata) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> AccessKeyMetadata -> f AccessKeyMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AccessKeyMetadata
-> f AccessKeyMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
accessKeyMetadata_userName :: Lens.Lens' AccessKeyMetadata (Prelude.Maybe Prelude.Text)
accessKeyMetadata_userName :: (Maybe Text -> f (Maybe Text))
-> AccessKeyMetadata -> f AccessKeyMetadata
accessKeyMetadata_userName = (AccessKeyMetadata -> Maybe Text)
-> (AccessKeyMetadata -> Maybe Text -> AccessKeyMetadata)
-> Lens
AccessKeyMetadata AccessKeyMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKeyMetadata' {Maybe Text
userName :: Maybe Text
$sel:userName:AccessKeyMetadata' :: AccessKeyMetadata -> Maybe Text
userName} -> Maybe Text
userName) (\s :: AccessKeyMetadata
s@AccessKeyMetadata' {} Maybe Text
a -> AccessKeyMetadata
s {$sel:userName:AccessKeyMetadata' :: Maybe Text
userName = Maybe Text
a} :: AccessKeyMetadata)
accessKeyMetadata_accessKeyId :: Lens.Lens' AccessKeyMetadata (Prelude.Maybe Core.AccessKey)
accessKeyMetadata_accessKeyId :: (Maybe AccessKey -> f (Maybe AccessKey))
-> AccessKeyMetadata -> f AccessKeyMetadata
accessKeyMetadata_accessKeyId = (AccessKeyMetadata -> Maybe AccessKey)
-> (AccessKeyMetadata -> Maybe AccessKey -> AccessKeyMetadata)
-> Lens
AccessKeyMetadata
AccessKeyMetadata
(Maybe AccessKey)
(Maybe AccessKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessKeyMetadata' {Maybe AccessKey
accessKeyId :: Maybe AccessKey
$sel:accessKeyId:AccessKeyMetadata' :: AccessKeyMetadata -> Maybe AccessKey
accessKeyId} -> Maybe AccessKey
accessKeyId) (\s :: AccessKeyMetadata
s@AccessKeyMetadata' {} Maybe AccessKey
a -> AccessKeyMetadata
s {$sel:accessKeyId:AccessKeyMetadata' :: Maybe AccessKey
accessKeyId = Maybe AccessKey
a} :: AccessKeyMetadata)
instance Core.FromXML AccessKeyMetadata where
parseXML :: [Node] -> Either String AccessKeyMetadata
parseXML [Node]
x =
Maybe StatusType
-> Maybe ISO8601
-> Maybe Text
-> Maybe AccessKey
-> AccessKeyMetadata
AccessKeyMetadata'
(Maybe StatusType
-> Maybe ISO8601
-> Maybe Text
-> Maybe AccessKey
-> AccessKeyMetadata)
-> Either String (Maybe StatusType)
-> Either
String
(Maybe ISO8601
-> Maybe Text -> Maybe AccessKey -> AccessKeyMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe StatusType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
Either
String
(Maybe ISO8601
-> Maybe Text -> Maybe AccessKey -> AccessKeyMetadata)
-> Either String (Maybe ISO8601)
-> Either
String (Maybe Text -> Maybe AccessKey -> AccessKeyMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreateDate")
Either String (Maybe Text -> Maybe AccessKey -> AccessKeyMetadata)
-> Either String (Maybe Text)
-> Either String (Maybe AccessKey -> AccessKeyMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UserName")
Either String (Maybe AccessKey -> AccessKeyMetadata)
-> Either String (Maybe AccessKey)
-> Either String AccessKeyMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AccessKey)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AccessKeyId")
instance Prelude.Hashable AccessKeyMetadata
instance Prelude.NFData AccessKeyMetadata