{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:comment:KeyGroupConfig' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
$sel:name:KeyGroupConfig' :: Text
name = Text
pName_,
$sel:items:KeyGroupConfig' :: [Text]
items = forall a. Monoid a => a
Prelude.mempty
}
keyGroupConfig_comment :: Lens.Lens' KeyGroupConfig (Prelude.Maybe Prelude.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 :: Lens' KeyGroupConfig Text
keyGroupConfig_name = 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 :: Lens' KeyGroupConfig [Text]
keyGroupConfig_items = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromXML KeyGroupConfig where
parseXML :: [Node] -> Either String KeyGroupConfig
parseXML [Node]
x =
Maybe Text -> Text -> [Text] -> KeyGroupConfig
KeyGroupConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Comment")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Items"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"PublicKey"
)
instance Prelude.Hashable KeyGroupConfig where
hashWithSalt :: Int -> KeyGroupConfig -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
items
instance Prelude.NFData KeyGroupConfig where
rnf :: KeyGroupConfig -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
items
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Comment" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
comment,
Name
"Name" forall a. ToXML a => Name -> a -> XML
Data.@= Text
name,
Name
"Items" forall a. ToXML a => Name -> a -> XML
Data.@= forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"PublicKey" [Text]
items
]