{-# 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.PublicKeyConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PublicKeyConfig = PublicKeyConfig'
{
:: Prelude.Maybe Prelude.Text,
PublicKeyConfig -> Text
callerReference :: Prelude.Text,
PublicKeyConfig -> Text
name :: Prelude.Text,
PublicKeyConfig -> Text
encodedKey :: Prelude.Text
}
deriving (PublicKeyConfig -> PublicKeyConfig -> Bool
(PublicKeyConfig -> PublicKeyConfig -> Bool)
-> (PublicKeyConfig -> PublicKeyConfig -> Bool)
-> Eq PublicKeyConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublicKeyConfig -> PublicKeyConfig -> Bool
$c/= :: PublicKeyConfig -> PublicKeyConfig -> Bool
== :: PublicKeyConfig -> PublicKeyConfig -> Bool
$c== :: PublicKeyConfig -> PublicKeyConfig -> Bool
Prelude.Eq, ReadPrec [PublicKeyConfig]
ReadPrec PublicKeyConfig
Int -> ReadS PublicKeyConfig
ReadS [PublicKeyConfig]
(Int -> ReadS PublicKeyConfig)
-> ReadS [PublicKeyConfig]
-> ReadPrec PublicKeyConfig
-> ReadPrec [PublicKeyConfig]
-> Read PublicKeyConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PublicKeyConfig]
$creadListPrec :: ReadPrec [PublicKeyConfig]
readPrec :: ReadPrec PublicKeyConfig
$creadPrec :: ReadPrec PublicKeyConfig
readList :: ReadS [PublicKeyConfig]
$creadList :: ReadS [PublicKeyConfig]
readsPrec :: Int -> ReadS PublicKeyConfig
$creadsPrec :: Int -> ReadS PublicKeyConfig
Prelude.Read, Int -> PublicKeyConfig -> ShowS
[PublicKeyConfig] -> ShowS
PublicKeyConfig -> String
(Int -> PublicKeyConfig -> ShowS)
-> (PublicKeyConfig -> String)
-> ([PublicKeyConfig] -> ShowS)
-> Show PublicKeyConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublicKeyConfig] -> ShowS
$cshowList :: [PublicKeyConfig] -> ShowS
show :: PublicKeyConfig -> String
$cshow :: PublicKeyConfig -> String
showsPrec :: Int -> PublicKeyConfig -> ShowS
$cshowsPrec :: Int -> PublicKeyConfig -> ShowS
Prelude.Show, (forall x. PublicKeyConfig -> Rep PublicKeyConfig x)
-> (forall x. Rep PublicKeyConfig x -> PublicKeyConfig)
-> Generic PublicKeyConfig
forall x. Rep PublicKeyConfig x -> PublicKeyConfig
forall x. PublicKeyConfig -> Rep PublicKeyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PublicKeyConfig x -> PublicKeyConfig
$cfrom :: forall x. PublicKeyConfig -> Rep PublicKeyConfig x
Prelude.Generic)
newPublicKeyConfig ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
PublicKeyConfig
newPublicKeyConfig :: Text -> Text -> Text -> PublicKeyConfig
newPublicKeyConfig
Text
pCallerReference_
Text
pName_
Text
pEncodedKey_ =
PublicKeyConfig' :: Maybe Text -> Text -> Text -> Text -> PublicKeyConfig
PublicKeyConfig'
{ $sel:comment:PublicKeyConfig' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:callerReference:PublicKeyConfig' :: Text
callerReference = Text
pCallerReference_,
$sel:name:PublicKeyConfig' :: Text
name = Text
pName_,
$sel:encodedKey:PublicKeyConfig' :: Text
encodedKey = Text
pEncodedKey_
}
publicKeyConfig_comment :: Lens.Lens' PublicKeyConfig (Prelude.Maybe Prelude.Text)
= (PublicKeyConfig -> Maybe Text)
-> (PublicKeyConfig -> Maybe Text -> PublicKeyConfig)
-> Lens PublicKeyConfig PublicKeyConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeyConfig' {Maybe Text
comment :: Maybe Text
$sel:comment:PublicKeyConfig' :: PublicKeyConfig -> Maybe Text
comment} -> Maybe Text
comment) (\s :: PublicKeyConfig
s@PublicKeyConfig' {} Maybe Text
a -> PublicKeyConfig
s {$sel:comment:PublicKeyConfig' :: Maybe Text
comment = Maybe Text
a} :: PublicKeyConfig)
publicKeyConfig_callerReference :: Lens.Lens' PublicKeyConfig Prelude.Text
publicKeyConfig_callerReference :: (Text -> f Text) -> PublicKeyConfig -> f PublicKeyConfig
publicKeyConfig_callerReference = (PublicKeyConfig -> Text)
-> (PublicKeyConfig -> Text -> PublicKeyConfig)
-> Lens PublicKeyConfig PublicKeyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeyConfig' {Text
callerReference :: Text
$sel:callerReference:PublicKeyConfig' :: PublicKeyConfig -> Text
callerReference} -> Text
callerReference) (\s :: PublicKeyConfig
s@PublicKeyConfig' {} Text
a -> PublicKeyConfig
s {$sel:callerReference:PublicKeyConfig' :: Text
callerReference = Text
a} :: PublicKeyConfig)
publicKeyConfig_name :: Lens.Lens' PublicKeyConfig Prelude.Text
publicKeyConfig_name :: (Text -> f Text) -> PublicKeyConfig -> f PublicKeyConfig
publicKeyConfig_name = (PublicKeyConfig -> Text)
-> (PublicKeyConfig -> Text -> PublicKeyConfig)
-> Lens PublicKeyConfig PublicKeyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeyConfig' {Text
name :: Text
$sel:name:PublicKeyConfig' :: PublicKeyConfig -> Text
name} -> Text
name) (\s :: PublicKeyConfig
s@PublicKeyConfig' {} Text
a -> PublicKeyConfig
s {$sel:name:PublicKeyConfig' :: Text
name = Text
a} :: PublicKeyConfig)
publicKeyConfig_encodedKey :: Lens.Lens' PublicKeyConfig Prelude.Text
publicKeyConfig_encodedKey :: (Text -> f Text) -> PublicKeyConfig -> f PublicKeyConfig
publicKeyConfig_encodedKey = (PublicKeyConfig -> Text)
-> (PublicKeyConfig -> Text -> PublicKeyConfig)
-> Lens PublicKeyConfig PublicKeyConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PublicKeyConfig' {Text
encodedKey :: Text
$sel:encodedKey:PublicKeyConfig' :: PublicKeyConfig -> Text
encodedKey} -> Text
encodedKey) (\s :: PublicKeyConfig
s@PublicKeyConfig' {} Text
a -> PublicKeyConfig
s {$sel:encodedKey:PublicKeyConfig' :: Text
encodedKey = Text
a} :: PublicKeyConfig)
instance Core.FromXML PublicKeyConfig where
parseXML :: [Node] -> Either String PublicKeyConfig
parseXML [Node]
x =
Maybe Text -> Text -> Text -> Text -> PublicKeyConfig
PublicKeyConfig'
(Maybe Text -> Text -> Text -> Text -> PublicKeyConfig)
-> Either String (Maybe Text)
-> Either String (Text -> Text -> Text -> PublicKeyConfig)
forall (f :: * -> *) a b. Functor 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
"Comment")
Either String (Text -> Text -> Text -> PublicKeyConfig)
-> Either String Text
-> Either String (Text -> Text -> PublicKeyConfig)
forall (f :: * -> *) a b. Applicative f => 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
"CallerReference")
Either String (Text -> Text -> PublicKeyConfig)
-> Either String Text -> Either String (Text -> PublicKeyConfig)
forall (f :: * -> *) a b. Applicative f => 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
"Name")
Either String (Text -> PublicKeyConfig)
-> Either String Text -> Either String PublicKeyConfig
forall (f :: * -> *) a b. Applicative f => 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
"EncodedKey")
instance Prelude.Hashable PublicKeyConfig
instance Prelude.NFData PublicKeyConfig
instance Core.ToXML PublicKeyConfig where
toXML :: PublicKeyConfig -> XML
toXML PublicKeyConfig' {Maybe Text
Text
encodedKey :: Text
name :: Text
callerReference :: Text
comment :: Maybe Text
$sel:encodedKey:PublicKeyConfig' :: PublicKeyConfig -> Text
$sel:name:PublicKeyConfig' :: PublicKeyConfig -> Text
$sel:callerReference:PublicKeyConfig' :: PublicKeyConfig -> Text
$sel:comment:PublicKeyConfig' :: PublicKeyConfig -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Comment" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
comment,
Name
"CallerReference" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
callerReference,
Name
"Name" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
name,
Name
"EncodedKey" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
encodedKey
]