{-# 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.KeyGroupConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KeyGroupConfig = KeyGroupConfig'
{
:: Prelude.Maybe Prelude.Text,
KeyGroupConfig -> Text
name :: Prelude.Text,
KeyGroupConfig -> [Text]
items :: [Prelude.Text]
}
deriving (KeyGroupConfig -> KeyGroupConfig -> Bool
(KeyGroupConfig -> KeyGroupConfig -> Bool)
-> (KeyGroupConfig -> KeyGroupConfig -> Bool) -> Eq KeyGroupConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyGroupConfig -> KeyGroupConfig -> Bool
$c/= :: KeyGroupConfig -> KeyGroupConfig -> Bool
== :: KeyGroupConfig -> KeyGroupConfig -> Bool
$c== :: KeyGroupConfig -> KeyGroupConfig -> Bool
Prelude.Eq, ReadPrec [KeyGroupConfig]
ReadPrec KeyGroupConfig
Int -> ReadS KeyGroupConfig
ReadS [KeyGroupConfig]
(Int -> ReadS KeyGroupConfig)
-> ReadS [KeyGroupConfig]
-> ReadPrec KeyGroupConfig
-> ReadPrec [KeyGroupConfig]
-> Read KeyGroupConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyGroupConfig]
$creadListPrec :: ReadPrec [KeyGroupConfig]
readPrec :: ReadPrec KeyGroupConfig
$creadPrec :: ReadPrec KeyGroupConfig
readList :: ReadS [KeyGroupConfig]
$creadList :: ReadS [KeyGroupConfig]
readsPrec :: Int -> ReadS KeyGroupConfig
$creadsPrec :: Int -> ReadS KeyGroupConfig
Prelude.Read, Int -> KeyGroupConfig -> ShowS
[KeyGroupConfig] -> ShowS
KeyGroupConfig -> String
(Int -> KeyGroupConfig -> ShowS)
-> (KeyGroupConfig -> String)
-> ([KeyGroupConfig] -> ShowS)
-> Show KeyGroupConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyGroupConfig] -> ShowS
$cshowList :: [KeyGroupConfig] -> ShowS
show :: KeyGroupConfig -> String
$cshow :: KeyGroupConfig -> String
showsPrec :: Int -> KeyGroupConfig -> ShowS
$cshowsPrec :: Int -> KeyGroupConfig -> ShowS
Prelude.Show, (forall x. KeyGroupConfig -> Rep KeyGroupConfig x)
-> (forall x. Rep KeyGroupConfig x -> KeyGroupConfig)
-> Generic KeyGroupConfig
forall x. Rep KeyGroupConfig x -> KeyGroupConfig
forall x. KeyGroupConfig -> Rep KeyGroupConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyGroupConfig x -> KeyGroupConfig
$cfrom :: forall x. KeyGroupConfig -> Rep KeyGroupConfig x
Prelude.Generic)
newKeyGroupConfig ::
Prelude.Text ->
KeyGroupConfig
newKeyGroupConfig :: Text -> KeyGroupConfig
newKeyGroupConfig Text
pName_ =
KeyGroupConfig' :: Maybe Text -> Text -> [Text] -> KeyGroupConfig
KeyGroupConfig'
{ $sel:comment:KeyGroupConfig' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:KeyGroupConfig' :: Text
name = Text
pName_,
$sel:items:KeyGroupConfig' :: [Text]
items = [Text]
forall a. Monoid a => a
Prelude.mempty
}
keyGroupConfig_comment :: Lens.Lens' KeyGroupConfig (Prelude.Maybe Prelude.Text)
= (KeyGroupConfig -> Maybe Text)
-> (KeyGroupConfig -> Maybe Text -> KeyGroupConfig)
-> Lens KeyGroupConfig KeyGroupConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyGroupConfig' {Maybe Text
comment :: Maybe Text
$sel:comment:KeyGroupConfig' :: KeyGroupConfig -> Maybe Text
comment} -> Maybe Text
comment) (\s :: KeyGroupConfig
s@KeyGroupConfig' {} Maybe Text
a -> KeyGroupConfig
s {$sel:comment:KeyGroupConfig' :: Maybe Text
comment = Maybe Text
a} :: KeyGroupConfig)
keyGroupConfig_name :: Lens.Lens' KeyGroupConfig Prelude.Text
keyGroupConfig_name :: (Text -> f Text) -> KeyGroupConfig -> f KeyGroupConfig
keyGroupConfig_name = (KeyGroupConfig -> Text)
-> (KeyGroupConfig -> Text -> KeyGroupConfig)
-> Lens KeyGroupConfig KeyGroupConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyGroupConfig' {Text
name :: Text
$sel:name:KeyGroupConfig' :: KeyGroupConfig -> Text
name} -> Text
name) (\s :: KeyGroupConfig
s@KeyGroupConfig' {} Text
a -> KeyGroupConfig
s {$sel:name:KeyGroupConfig' :: Text
name = Text
a} :: KeyGroupConfig)
keyGroupConfig_items :: Lens.Lens' KeyGroupConfig [Prelude.Text]
keyGroupConfig_items :: ([Text] -> f [Text]) -> KeyGroupConfig -> f KeyGroupConfig
keyGroupConfig_items = (KeyGroupConfig -> [Text])
-> (KeyGroupConfig -> [Text] -> KeyGroupConfig)
-> Lens KeyGroupConfig KeyGroupConfig [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyGroupConfig' {[Text]
items :: [Text]
$sel:items:KeyGroupConfig' :: KeyGroupConfig -> [Text]
items} -> [Text]
items) (\s :: KeyGroupConfig
s@KeyGroupConfig' {} [Text]
a -> KeyGroupConfig
s {$sel:items:KeyGroupConfig' :: [Text]
items = [Text]
a} :: KeyGroupConfig) (([Text] -> f [Text]) -> KeyGroupConfig -> f KeyGroupConfig)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> KeyGroupConfig
-> f KeyGroupConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromXML KeyGroupConfig where
parseXML :: [Node] -> Either String KeyGroupConfig
parseXML [Node]
x =
Maybe Text -> Text -> [Text] -> KeyGroupConfig
KeyGroupConfig'
(Maybe Text -> Text -> [Text] -> KeyGroupConfig)
-> Either String (Maybe Text)
-> Either String (Text -> [Text] -> KeyGroupConfig)
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] -> KeyGroupConfig)
-> Either String Text -> Either String ([Text] -> KeyGroupConfig)
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] -> KeyGroupConfig)
-> Either String [Text] -> Either String KeyGroupConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Items" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String [Text]) -> Either String [Text]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"PublicKey"
)
instance Prelude.Hashable KeyGroupConfig
instance Prelude.NFData KeyGroupConfig
instance Core.ToXML KeyGroupConfig where
toXML :: KeyGroupConfig -> XML
toXML KeyGroupConfig' {[Text]
Maybe Text
Text
items :: [Text]
name :: Text
comment :: Maybe Text
$sel:items:KeyGroupConfig' :: KeyGroupConfig -> [Text]
$sel:name:KeyGroupConfig' :: KeyGroupConfig -> Text
$sel:comment:KeyGroupConfig' :: KeyGroupConfig -> 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
"Name" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
name,
Name
"Items" Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Name -> [Text] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"PublicKey" [Text]
items
]