{-# 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.CloudFront.Types.PublicKey where
import Amazonka.CloudFront.Types.PublicKeyConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PublicKey = PublicKey'
{
PublicKey -> Text
id :: Prelude.Text,
PublicKey -> ISO8601
createdTime :: Core.ISO8601,
PublicKey -> PublicKeyConfig
publicKeyConfig :: PublicKeyConfig
}
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 ::
Prelude.Text ->
Prelude.UTCTime ->
PublicKeyConfig ->
PublicKey
newPublicKey :: Text -> UTCTime -> PublicKeyConfig -> PublicKey
newPublicKey Text
pId_ UTCTime
pCreatedTime_ PublicKeyConfig
pPublicKeyConfig_ =
PublicKey' :: Text -> ISO8601 -> PublicKeyConfig -> PublicKey
PublicKey'
{ $sel:id:PublicKey' :: Text
id = Text
pId_,
$sel:createdTime:PublicKey' :: ISO8601
createdTime = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedTime_,
$sel:publicKeyConfig:PublicKey' :: PublicKeyConfig
publicKeyConfig = PublicKeyConfig
pPublicKeyConfig_
}
publicKey_id :: Lens.Lens' PublicKey Prelude.Text
publicKey_id :: (Text -> f Text) -> PublicKey -> f PublicKey
publicKey_id = (PublicKey -> Text)
-> (PublicKey -> Text -> PublicKey)
-> Lens PublicKey PublicKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {Text
id :: Text
$sel:id:PublicKey' :: PublicKey -> Text
id} -> Text
id) (\s :: PublicKey
s@PublicKey' {} Text
a -> PublicKey
s {$sel:id:PublicKey' :: Text
id = Text
a} :: PublicKey)
publicKey_createdTime :: Lens.Lens' PublicKey Prelude.UTCTime
publicKey_createdTime :: (UTCTime -> f UTCTime) -> PublicKey -> f PublicKey
publicKey_createdTime = (PublicKey -> ISO8601)
-> (PublicKey -> ISO8601 -> PublicKey)
-> Lens PublicKey PublicKey ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {ISO8601
createdTime :: ISO8601
$sel:createdTime:PublicKey' :: PublicKey -> ISO8601
createdTime} -> ISO8601
createdTime) (\s :: PublicKey
s@PublicKey' {} ISO8601
a -> PublicKey
s {$sel:createdTime:PublicKey' :: ISO8601
createdTime = ISO8601
a} :: PublicKey) ((ISO8601 -> f ISO8601) -> PublicKey -> f PublicKey)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> PublicKey
-> f PublicKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
publicKey_publicKeyConfig :: Lens.Lens' PublicKey PublicKeyConfig
publicKey_publicKeyConfig :: (PublicKeyConfig -> f PublicKeyConfig) -> PublicKey -> f PublicKey
publicKey_publicKeyConfig = (PublicKey -> PublicKeyConfig)
-> (PublicKey -> PublicKeyConfig -> PublicKey)
-> Lens PublicKey PublicKey PublicKeyConfig PublicKeyConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKey' {PublicKeyConfig
publicKeyConfig :: PublicKeyConfig
$sel:publicKeyConfig:PublicKey' :: PublicKey -> PublicKeyConfig
publicKeyConfig} -> PublicKeyConfig
publicKeyConfig) (\s :: PublicKey
s@PublicKey' {} PublicKeyConfig
a -> PublicKey
s {$sel:publicKeyConfig:PublicKey' :: PublicKeyConfig
publicKeyConfig = PublicKeyConfig
a} :: PublicKey)
instance Core.FromXML PublicKey where
parseXML :: [Node] -> Either String PublicKey
parseXML [Node]
x =
Text -> ISO8601 -> PublicKeyConfig -> PublicKey
PublicKey'
(Text -> ISO8601 -> PublicKeyConfig -> PublicKey)
-> Either String Text
-> Either String (ISO8601 -> PublicKeyConfig -> PublicKey)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
Either String (ISO8601 -> PublicKeyConfig -> PublicKey)
-> Either String ISO8601
-> Either String (PublicKeyConfig -> PublicKey)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CreatedTime")
Either String (PublicKeyConfig -> PublicKey)
-> Either String PublicKeyConfig -> Either String PublicKey
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String PublicKeyConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"PublicKeyConfig")
instance Prelude.Hashable PublicKey
instance Prelude.NFData PublicKey