{-# 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.IoT.Types.CertificateValidity where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CertificateValidity = CertificateValidity'
{
CertificateValidity -> Maybe POSIX
notBefore :: Prelude.Maybe Core.POSIX,
CertificateValidity -> Maybe POSIX
notAfter :: Prelude.Maybe Core.POSIX
}
deriving (CertificateValidity -> CertificateValidity -> Bool
(CertificateValidity -> CertificateValidity -> Bool)
-> (CertificateValidity -> CertificateValidity -> Bool)
-> Eq CertificateValidity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CertificateValidity -> CertificateValidity -> Bool
$c/= :: CertificateValidity -> CertificateValidity -> Bool
== :: CertificateValidity -> CertificateValidity -> Bool
$c== :: CertificateValidity -> CertificateValidity -> Bool
Prelude.Eq, ReadPrec [CertificateValidity]
ReadPrec CertificateValidity
Int -> ReadS CertificateValidity
ReadS [CertificateValidity]
(Int -> ReadS CertificateValidity)
-> ReadS [CertificateValidity]
-> ReadPrec CertificateValidity
-> ReadPrec [CertificateValidity]
-> Read CertificateValidity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CertificateValidity]
$creadListPrec :: ReadPrec [CertificateValidity]
readPrec :: ReadPrec CertificateValidity
$creadPrec :: ReadPrec CertificateValidity
readList :: ReadS [CertificateValidity]
$creadList :: ReadS [CertificateValidity]
readsPrec :: Int -> ReadS CertificateValidity
$creadsPrec :: Int -> ReadS CertificateValidity
Prelude.Read, Int -> CertificateValidity -> ShowS
[CertificateValidity] -> ShowS
CertificateValidity -> String
(Int -> CertificateValidity -> ShowS)
-> (CertificateValidity -> String)
-> ([CertificateValidity] -> ShowS)
-> Show CertificateValidity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CertificateValidity] -> ShowS
$cshowList :: [CertificateValidity] -> ShowS
show :: CertificateValidity -> String
$cshow :: CertificateValidity -> String
showsPrec :: Int -> CertificateValidity -> ShowS
$cshowsPrec :: Int -> CertificateValidity -> ShowS
Prelude.Show, (forall x. CertificateValidity -> Rep CertificateValidity x)
-> (forall x. Rep CertificateValidity x -> CertificateValidity)
-> Generic CertificateValidity
forall x. Rep CertificateValidity x -> CertificateValidity
forall x. CertificateValidity -> Rep CertificateValidity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CertificateValidity x -> CertificateValidity
$cfrom :: forall x. CertificateValidity -> Rep CertificateValidity x
Prelude.Generic)
newCertificateValidity ::
CertificateValidity
newCertificateValidity :: CertificateValidity
newCertificateValidity =
CertificateValidity' :: Maybe POSIX -> Maybe POSIX -> CertificateValidity
CertificateValidity'
{ $sel:notBefore:CertificateValidity' :: Maybe POSIX
notBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:notAfter:CertificateValidity' :: Maybe POSIX
notAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
certificateValidity_notBefore :: Lens.Lens' CertificateValidity (Prelude.Maybe Prelude.UTCTime)
certificateValidity_notBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CertificateValidity -> f CertificateValidity
certificateValidity_notBefore = (CertificateValidity -> Maybe POSIX)
-> (CertificateValidity -> Maybe POSIX -> CertificateValidity)
-> Lens
CertificateValidity CertificateValidity (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateValidity' {Maybe POSIX
notBefore :: Maybe POSIX
$sel:notBefore:CertificateValidity' :: CertificateValidity -> Maybe POSIX
notBefore} -> Maybe POSIX
notBefore) (\s :: CertificateValidity
s@CertificateValidity' {} Maybe POSIX
a -> CertificateValidity
s {$sel:notBefore:CertificateValidity' :: Maybe POSIX
notBefore = Maybe POSIX
a} :: CertificateValidity) ((Maybe POSIX -> f (Maybe POSIX))
-> CertificateValidity -> f CertificateValidity)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CertificateValidity
-> f CertificateValidity
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
certificateValidity_notAfter :: Lens.Lens' CertificateValidity (Prelude.Maybe Prelude.UTCTime)
certificateValidity_notAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CertificateValidity -> f CertificateValidity
certificateValidity_notAfter = (CertificateValidity -> Maybe POSIX)
-> (CertificateValidity -> Maybe POSIX -> CertificateValidity)
-> Lens
CertificateValidity CertificateValidity (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateValidity' {Maybe POSIX
notAfter :: Maybe POSIX
$sel:notAfter:CertificateValidity' :: CertificateValidity -> Maybe POSIX
notAfter} -> Maybe POSIX
notAfter) (\s :: CertificateValidity
s@CertificateValidity' {} Maybe POSIX
a -> CertificateValidity
s {$sel:notAfter:CertificateValidity' :: Maybe POSIX
notAfter = Maybe POSIX
a} :: CertificateValidity) ((Maybe POSIX -> f (Maybe POSIX))
-> CertificateValidity -> f CertificateValidity)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CertificateValidity
-> f CertificateValidity
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 CertificateValidity where
parseJSON :: Value -> Parser CertificateValidity
parseJSON =
String
-> (Object -> Parser CertificateValidity)
-> Value
-> Parser CertificateValidity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CertificateValidity"
( \Object
x ->
Maybe POSIX -> Maybe POSIX -> CertificateValidity
CertificateValidity'
(Maybe POSIX -> Maybe POSIX -> CertificateValidity)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> CertificateValidity)
forall (f :: * -> *) a b. Functor 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
"notBefore")
Parser (Maybe POSIX -> CertificateValidity)
-> Parser (Maybe POSIX) -> Parser CertificateValidity
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
"notAfter")
)
instance Prelude.Hashable CertificateValidity
instance Prelude.NFData CertificateValidity