{-# 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.CloudTrail.Types.PublicKey where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PublicKey = PublicKey'
{
PublicKey -> Maybe Text
fingerprint :: Prelude.Maybe Prelude.Text,
PublicKey -> Maybe POSIX
validityEndTime :: Prelude.Maybe Core.POSIX,
PublicKey -> Maybe Base64
value :: Prelude.Maybe Core.Base64,
PublicKey -> Maybe POSIX
validityStartTime :: Prelude.Maybe Core.POSIX
}
deriving (PublicKey -> PublicKey -> Bool
(PublicKey -> PublicKey -> Bool)
-> (PublicKey -> PublicKey -> Bool) -> Eq PublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublicKey -> PublicKey -> Bool
$c/= :: PublicKey -> PublicKey -> Bool
== :: PublicKey -> PublicKey -> Bool
$c== :: PublicKey -> PublicKey -> Bool
Prelude.Eq, ReadPrec [PublicKey]
ReadPrec PublicKey
Int -> ReadS PublicKey
ReadS [PublicKey]
(Int -> ReadS PublicKey)
-> ReadS [PublicKey]
-> ReadPrec PublicKey
-> ReadPrec [PublicKey]
-> Read PublicKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublicKey]
$creadListPrec :: ReadPrec [PublicKey]
readPrec :: ReadPrec PublicKey
$creadPrec :: ReadPrec PublicKey
readList :: ReadS [PublicKey]
$creadList :: ReadS [PublicKey]
readsPrec :: Int -> ReadS PublicKey
$creadsPrec :: Int -> ReadS PublicKey
Prelude.Read, Int -> PublicKey -> ShowS
[PublicKey] -> ShowS
PublicKey -> String
(Int -> PublicKey -> ShowS)
-> (PublicKey -> String)
-> ([PublicKey] -> ShowS)
-> Show PublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublicKey] -> ShowS
$cshowList :: [PublicKey] -> ShowS
show :: PublicKey -> String
$cshow :: PublicKey -> String
showsPrec :: Int -> PublicKey -> ShowS
$cshowsPrec :: Int -> PublicKey -> ShowS
Prelude.Show, (forall x. PublicKey -> Rep PublicKey x)
-> (forall x. Rep PublicKey x -> PublicKey) -> Generic PublicKey
forall x. Rep PublicKey x -> PublicKey
forall x. PublicKey -> Rep PublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublicKey x -> PublicKey
$cfrom :: forall x. PublicKey -> Rep PublicKey x
Prelude.Generic)
newPublicKey ::
PublicKey
newPublicKey :: PublicKey
newPublicKey =
PublicKey' :: Maybe Text
-> Maybe POSIX -> Maybe Base64 -> Maybe POSIX -> PublicKey
PublicKey'
{ $sel:fingerprint:PublicKey' :: Maybe Text
fingerprint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:validityEndTime:PublicKey' :: Maybe POSIX
validityEndTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:value:PublicKey' :: Maybe Base64
value = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:validityStartTime:PublicKey' :: Maybe POSIX
validityStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
publicKey_fingerprint :: Lens.Lens' PublicKey (Prelude.Maybe Prelude.Text)
publicKey_fingerprint :: (Maybe Text -> f (Maybe Text)) -> PublicKey -> f PublicKey
publicKey_fingerprint = (PublicKey -> Maybe Text)
-> (PublicKey -> Maybe Text -> PublicKey)
-> Lens PublicKey PublicKey (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {Maybe Text
fingerprint :: Maybe Text
$sel:fingerprint:PublicKey' :: PublicKey -> Maybe Text
fingerprint} -> Maybe Text
fingerprint) (\s :: PublicKey
s@PublicKey' {} Maybe Text
a -> PublicKey
s {$sel:fingerprint:PublicKey' :: Maybe Text
fingerprint = Maybe Text
a} :: PublicKey)
publicKey_validityEndTime :: Lens.Lens' PublicKey (Prelude.Maybe Prelude.UTCTime)
publicKey_validityEndTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> PublicKey -> f PublicKey
publicKey_validityEndTime = (PublicKey -> Maybe POSIX)
-> (PublicKey -> Maybe POSIX -> PublicKey)
-> Lens PublicKey PublicKey (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {Maybe POSIX
validityEndTime :: Maybe POSIX
$sel:validityEndTime:PublicKey' :: PublicKey -> Maybe POSIX
validityEndTime} -> Maybe POSIX
validityEndTime) (\s :: PublicKey
s@PublicKey' {} Maybe POSIX
a -> PublicKey
s {$sel:validityEndTime:PublicKey' :: Maybe POSIX
validityEndTime = Maybe POSIX
a} :: PublicKey) ((Maybe POSIX -> f (Maybe POSIX)) -> PublicKey -> f PublicKey)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PublicKey
-> f PublicKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
publicKey_value :: Lens.Lens' PublicKey (Prelude.Maybe Prelude.ByteString)
publicKey_value :: (Maybe ByteString -> f (Maybe ByteString))
-> PublicKey -> f PublicKey
publicKey_value = (PublicKey -> Maybe Base64)
-> (PublicKey -> Maybe Base64 -> PublicKey)
-> Lens PublicKey PublicKey (Maybe Base64) (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {Maybe Base64
value :: Maybe Base64
$sel:value:PublicKey' :: PublicKey -> Maybe Base64
value} -> Maybe Base64
value) (\s :: PublicKey
s@PublicKey' {} Maybe Base64
a -> PublicKey
s {$sel:value:PublicKey' :: Maybe Base64
value = Maybe Base64
a} :: PublicKey) ((Maybe Base64 -> f (Maybe Base64)) -> PublicKey -> f PublicKey)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> PublicKey
-> f PublicKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
publicKey_validityStartTime :: Lens.Lens' PublicKey (Prelude.Maybe Prelude.UTCTime)
publicKey_validityStartTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> PublicKey -> f PublicKey
publicKey_validityStartTime = (PublicKey -> Maybe POSIX)
-> (PublicKey -> Maybe POSIX -> PublicKey)
-> Lens PublicKey PublicKey (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {Maybe POSIX
validityStartTime :: Maybe POSIX
$sel:validityStartTime:PublicKey' :: PublicKey -> Maybe POSIX
validityStartTime} -> Maybe POSIX
validityStartTime) (\s :: PublicKey
s@PublicKey' {} Maybe POSIX
a -> PublicKey
s {$sel:validityStartTime:PublicKey' :: Maybe POSIX
validityStartTime = Maybe POSIX
a} :: PublicKey) ((Maybe POSIX -> f (Maybe POSIX)) -> PublicKey -> f PublicKey)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PublicKey
-> f PublicKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON PublicKey where
parseJSON :: Value -> Parser PublicKey
parseJSON =
String -> (Object -> Parser PublicKey) -> Value -> Parser PublicKey
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PublicKey"
( \Object
x ->
Maybe Text
-> Maybe POSIX -> Maybe Base64 -> Maybe POSIX -> PublicKey
PublicKey'
(Maybe Text
-> Maybe POSIX -> Maybe Base64 -> Maybe POSIX -> PublicKey)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Base64 -> Maybe POSIX -> PublicKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Fingerprint")
Parser (Maybe POSIX -> Maybe Base64 -> Maybe POSIX -> PublicKey)
-> Parser (Maybe POSIX)
-> Parser (Maybe Base64 -> Maybe POSIX -> PublicKey)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ValidityEndTime")
Parser (Maybe Base64 -> Maybe POSIX -> PublicKey)
-> Parser (Maybe Base64) -> Parser (Maybe POSIX -> PublicKey)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Base64)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
Parser (Maybe POSIX -> PublicKey)
-> Parser (Maybe POSIX) -> Parser PublicKey
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ValidityStartTime")
)
instance Prelude.Hashable PublicKey
instance Prelude.NFData PublicKey