{-# 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.Certificate where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.CertificateMode
import Amazonka.IoT.Types.CertificateStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Certificate = Certificate'
{
Certificate -> Maybe CertificateStatus
status :: Prelude.Maybe CertificateStatus,
Certificate -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
Certificate -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
Certificate -> Maybe CertificateMode
certificateMode :: Prelude.Maybe CertificateMode,
Certificate -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX
}
deriving (Certificate -> Certificate -> Bool
(Certificate -> Certificate -> Bool)
-> (Certificate -> Certificate -> Bool) -> Eq Certificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Certificate -> Certificate -> Bool
$c/= :: Certificate -> Certificate -> Bool
== :: Certificate -> Certificate -> Bool
$c== :: Certificate -> Certificate -> Bool
Prelude.Eq, ReadPrec [Certificate]
ReadPrec Certificate
Int -> ReadS Certificate
ReadS [Certificate]
(Int -> ReadS Certificate)
-> ReadS [Certificate]
-> ReadPrec Certificate
-> ReadPrec [Certificate]
-> Read Certificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Certificate]
$creadListPrec :: ReadPrec [Certificate]
readPrec :: ReadPrec Certificate
$creadPrec :: ReadPrec Certificate
readList :: ReadS [Certificate]
$creadList :: ReadS [Certificate]
readsPrec :: Int -> ReadS Certificate
$creadsPrec :: Int -> ReadS Certificate
Prelude.Read, Int -> Certificate -> ShowS
[Certificate] -> ShowS
Certificate -> String
(Int -> Certificate -> ShowS)
-> (Certificate -> String)
-> ([Certificate] -> ShowS)
-> Show Certificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Certificate] -> ShowS
$cshowList :: [Certificate] -> ShowS
show :: Certificate -> String
$cshow :: Certificate -> String
showsPrec :: Int -> Certificate -> ShowS
$cshowsPrec :: Int -> Certificate -> ShowS
Prelude.Show, (forall x. Certificate -> Rep Certificate x)
-> (forall x. Rep Certificate x -> Certificate)
-> Generic Certificate
forall x. Rep Certificate x -> Certificate
forall x. Certificate -> Rep Certificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Certificate x -> Certificate
$cfrom :: forall x. Certificate -> Rep Certificate x
Prelude.Generic)
newCertificate ::
Certificate
newCertificate :: Certificate
newCertificate =
Certificate' :: Maybe CertificateStatus
-> Maybe Text
-> Maybe Text
-> Maybe CertificateMode
-> Maybe POSIX
-> Certificate
Certificate'
{ $sel:status:Certificate' :: Maybe CertificateStatus
status = Maybe CertificateStatus
forall a. Maybe a
Prelude.Nothing,
$sel:certificateArn:Certificate' :: Maybe Text
certificateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateId:Certificate' :: Maybe Text
certificateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateMode:Certificate' :: Maybe CertificateMode
certificateMode = Maybe CertificateMode
forall a. Maybe a
Prelude.Nothing,
$sel:creationDate:Certificate' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
certificate_status :: Lens.Lens' Certificate (Prelude.Maybe CertificateStatus)
certificate_status :: (Maybe CertificateStatus -> f (Maybe CertificateStatus))
-> Certificate -> f Certificate
certificate_status = (Certificate -> Maybe CertificateStatus)
-> (Certificate -> Maybe CertificateStatus -> Certificate)
-> Lens
Certificate
Certificate
(Maybe CertificateStatus)
(Maybe CertificateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe CertificateStatus
status :: Maybe CertificateStatus
$sel:status:Certificate' :: Certificate -> Maybe CertificateStatus
status} -> Maybe CertificateStatus
status) (\s :: Certificate
s@Certificate' {} Maybe CertificateStatus
a -> Certificate
s {$sel:status:Certificate' :: Maybe CertificateStatus
status = Maybe CertificateStatus
a} :: Certificate)
certificate_certificateArn :: Lens.Lens' Certificate (Prelude.Maybe Prelude.Text)
certificate_certificateArn :: (Maybe Text -> f (Maybe Text)) -> Certificate -> f Certificate
certificate_certificateArn = (Certificate -> Maybe Text)
-> (Certificate -> Maybe Text -> Certificate)
-> Lens Certificate Certificate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:Certificate' :: Certificate -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: Certificate
s@Certificate' {} Maybe Text
a -> Certificate
s {$sel:certificateArn:Certificate' :: Maybe Text
certificateArn = Maybe Text
a} :: Certificate)
certificate_certificateId :: Lens.Lens' Certificate (Prelude.Maybe Prelude.Text)
certificate_certificateId :: (Maybe Text -> f (Maybe Text)) -> Certificate -> f Certificate
certificate_certificateId = (Certificate -> Maybe Text)
-> (Certificate -> Maybe Text -> Certificate)
-> Lens Certificate Certificate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:Certificate' :: Certificate -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: Certificate
s@Certificate' {} Maybe Text
a -> Certificate
s {$sel:certificateId:Certificate' :: Maybe Text
certificateId = Maybe Text
a} :: Certificate)
certificate_certificateMode :: Lens.Lens' Certificate (Prelude.Maybe CertificateMode)
certificate_certificateMode :: (Maybe CertificateMode -> f (Maybe CertificateMode))
-> Certificate -> f Certificate
certificate_certificateMode = (Certificate -> Maybe CertificateMode)
-> (Certificate -> Maybe CertificateMode -> Certificate)
-> Lens
Certificate
Certificate
(Maybe CertificateMode)
(Maybe CertificateMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe CertificateMode
certificateMode :: Maybe CertificateMode
$sel:certificateMode:Certificate' :: Certificate -> Maybe CertificateMode
certificateMode} -> Maybe CertificateMode
certificateMode) (\s :: Certificate
s@Certificate' {} Maybe CertificateMode
a -> Certificate
s {$sel:certificateMode:Certificate' :: Maybe CertificateMode
certificateMode = Maybe CertificateMode
a} :: Certificate)
certificate_creationDate :: Lens.Lens' Certificate (Prelude.Maybe Prelude.UTCTime)
certificate_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> Certificate -> f Certificate
certificate_creationDate = (Certificate -> Maybe POSIX)
-> (Certificate -> Maybe POSIX -> Certificate)
-> Lens Certificate Certificate (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:Certificate' :: Certificate -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: Certificate
s@Certificate' {} Maybe POSIX
a -> Certificate
s {$sel:creationDate:Certificate' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: Certificate) ((Maybe POSIX -> f (Maybe POSIX)) -> Certificate -> f Certificate)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Certificate
-> f Certificate
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 Certificate where
parseJSON :: Value -> Parser Certificate
parseJSON =
String
-> (Object -> Parser Certificate) -> Value -> Parser Certificate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Certificate"
( \Object
x ->
Maybe CertificateStatus
-> Maybe Text
-> Maybe Text
-> Maybe CertificateMode
-> Maybe POSIX
-> Certificate
Certificate'
(Maybe CertificateStatus
-> Maybe Text
-> Maybe Text
-> Maybe CertificateMode
-> Maybe POSIX
-> Certificate)
-> Parser (Maybe CertificateStatus)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe CertificateMode
-> Maybe POSIX
-> Certificate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CertificateStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
Parser
(Maybe Text
-> Maybe Text
-> Maybe CertificateMode
-> Maybe POSIX
-> Certificate)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe CertificateMode -> Maybe POSIX -> Certificate)
forall (f :: * -> *) a b. Applicative f => 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
"certificateArn")
Parser
(Maybe Text -> Maybe CertificateMode -> Maybe POSIX -> Certificate)
-> Parser (Maybe Text)
-> Parser (Maybe CertificateMode -> Maybe POSIX -> Certificate)
forall (f :: * -> *) a b. Applicative f => 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
"certificateId")
Parser (Maybe CertificateMode -> Maybe POSIX -> Certificate)
-> Parser (Maybe CertificateMode)
-> Parser (Maybe POSIX -> Certificate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CertificateMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"certificateMode")
Parser (Maybe POSIX -> Certificate)
-> Parser (Maybe POSIX) -> Parser Certificate
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
"creationDate")
)
instance Prelude.Hashable Certificate
instance Prelude.NFData Certificate