{-# 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.WAF.Types.GeoMatchSet where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAF.Types.GeoMatchConstraint
data GeoMatchSet = GeoMatchSet'
{
GeoMatchSet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
GeoMatchSet -> Text
geoMatchSetId :: Prelude.Text,
GeoMatchSet -> [GeoMatchConstraint]
geoMatchConstraints :: [GeoMatchConstraint]
}
deriving (GeoMatchSet -> GeoMatchSet -> Bool
(GeoMatchSet -> GeoMatchSet -> Bool)
-> (GeoMatchSet -> GeoMatchSet -> Bool) -> Eq GeoMatchSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoMatchSet -> GeoMatchSet -> Bool
$c/= :: GeoMatchSet -> GeoMatchSet -> Bool
== :: GeoMatchSet -> GeoMatchSet -> Bool
$c== :: GeoMatchSet -> GeoMatchSet -> Bool
Prelude.Eq, ReadPrec [GeoMatchSet]
ReadPrec GeoMatchSet
Int -> ReadS GeoMatchSet
ReadS [GeoMatchSet]
(Int -> ReadS GeoMatchSet)
-> ReadS [GeoMatchSet]
-> ReadPrec GeoMatchSet
-> ReadPrec [GeoMatchSet]
-> Read GeoMatchSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoMatchSet]
$creadListPrec :: ReadPrec [GeoMatchSet]
readPrec :: ReadPrec GeoMatchSet
$creadPrec :: ReadPrec GeoMatchSet
readList :: ReadS [GeoMatchSet]
$creadList :: ReadS [GeoMatchSet]
readsPrec :: Int -> ReadS GeoMatchSet
$creadsPrec :: Int -> ReadS GeoMatchSet
Prelude.Read, Int -> GeoMatchSet -> ShowS
[GeoMatchSet] -> ShowS
GeoMatchSet -> String
(Int -> GeoMatchSet -> ShowS)
-> (GeoMatchSet -> String)
-> ([GeoMatchSet] -> ShowS)
-> Show GeoMatchSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoMatchSet] -> ShowS
$cshowList :: [GeoMatchSet] -> ShowS
show :: GeoMatchSet -> String
$cshow :: GeoMatchSet -> String
showsPrec :: Int -> GeoMatchSet -> ShowS
$cshowsPrec :: Int -> GeoMatchSet -> ShowS
Prelude.Show, (forall x. GeoMatchSet -> Rep GeoMatchSet x)
-> (forall x. Rep GeoMatchSet x -> GeoMatchSet)
-> Generic GeoMatchSet
forall x. Rep GeoMatchSet x -> GeoMatchSet
forall x. GeoMatchSet -> Rep GeoMatchSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoMatchSet x -> GeoMatchSet
$cfrom :: forall x. GeoMatchSet -> Rep GeoMatchSet x
Prelude.Generic)
newGeoMatchSet ::
Prelude.Text ->
GeoMatchSet
newGeoMatchSet :: Text -> GeoMatchSet
newGeoMatchSet Text
pGeoMatchSetId_ =
GeoMatchSet' :: Maybe Text -> Text -> [GeoMatchConstraint] -> GeoMatchSet
GeoMatchSet'
{ $sel:name:GeoMatchSet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:geoMatchSetId:GeoMatchSet' :: Text
geoMatchSetId = Text
pGeoMatchSetId_,
$sel:geoMatchConstraints:GeoMatchSet' :: [GeoMatchConstraint]
geoMatchConstraints = [GeoMatchConstraint]
forall a. Monoid a => a
Prelude.mempty
}
geoMatchSet_name :: Lens.Lens' GeoMatchSet (Prelude.Maybe Prelude.Text)
geoMatchSet_name :: (Maybe Text -> f (Maybe Text)) -> GeoMatchSet -> f GeoMatchSet
geoMatchSet_name = (GeoMatchSet -> Maybe Text)
-> (GeoMatchSet -> Maybe Text -> GeoMatchSet)
-> Lens GeoMatchSet GeoMatchSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchSet' {Maybe Text
name :: Maybe Text
$sel:name:GeoMatchSet' :: GeoMatchSet -> Maybe Text
name} -> Maybe Text
name) (\s :: GeoMatchSet
s@GeoMatchSet' {} Maybe Text
a -> GeoMatchSet
s {$sel:name:GeoMatchSet' :: Maybe Text
name = Maybe Text
a} :: GeoMatchSet)
geoMatchSet_geoMatchSetId :: Lens.Lens' GeoMatchSet Prelude.Text
geoMatchSet_geoMatchSetId :: (Text -> f Text) -> GeoMatchSet -> f GeoMatchSet
geoMatchSet_geoMatchSetId = (GeoMatchSet -> Text)
-> (GeoMatchSet -> Text -> GeoMatchSet)
-> Lens GeoMatchSet GeoMatchSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchSet' {Text
geoMatchSetId :: Text
$sel:geoMatchSetId:GeoMatchSet' :: GeoMatchSet -> Text
geoMatchSetId} -> Text
geoMatchSetId) (\s :: GeoMatchSet
s@GeoMatchSet' {} Text
a -> GeoMatchSet
s {$sel:geoMatchSetId:GeoMatchSet' :: Text
geoMatchSetId = Text
a} :: GeoMatchSet)
geoMatchSet_geoMatchConstraints :: Lens.Lens' GeoMatchSet [GeoMatchConstraint]
geoMatchSet_geoMatchConstraints :: ([GeoMatchConstraint] -> f [GeoMatchConstraint])
-> GeoMatchSet -> f GeoMatchSet
geoMatchSet_geoMatchConstraints = (GeoMatchSet -> [GeoMatchConstraint])
-> (GeoMatchSet -> [GeoMatchConstraint] -> GeoMatchSet)
-> Lens
GeoMatchSet GeoMatchSet [GeoMatchConstraint] [GeoMatchConstraint]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchSet' {[GeoMatchConstraint]
geoMatchConstraints :: [GeoMatchConstraint]
$sel:geoMatchConstraints:GeoMatchSet' :: GeoMatchSet -> [GeoMatchConstraint]
geoMatchConstraints} -> [GeoMatchConstraint]
geoMatchConstraints) (\s :: GeoMatchSet
s@GeoMatchSet' {} [GeoMatchConstraint]
a -> GeoMatchSet
s {$sel:geoMatchConstraints:GeoMatchSet' :: [GeoMatchConstraint]
geoMatchConstraints = [GeoMatchConstraint]
a} :: GeoMatchSet) (([GeoMatchConstraint] -> f [GeoMatchConstraint])
-> GeoMatchSet -> f GeoMatchSet)
-> (([GeoMatchConstraint] -> f [GeoMatchConstraint])
-> [GeoMatchConstraint] -> f [GeoMatchConstraint])
-> ([GeoMatchConstraint] -> f [GeoMatchConstraint])
-> GeoMatchSet
-> f GeoMatchSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GeoMatchConstraint] -> f [GeoMatchConstraint])
-> [GeoMatchConstraint] -> f [GeoMatchConstraint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON GeoMatchSet where
parseJSON :: Value -> Parser GeoMatchSet
parseJSON =
String
-> (Object -> Parser GeoMatchSet) -> Value -> Parser GeoMatchSet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GeoMatchSet"
( \Object
x ->
Maybe Text -> Text -> [GeoMatchConstraint] -> GeoMatchSet
GeoMatchSet'
(Maybe Text -> Text -> [GeoMatchConstraint] -> GeoMatchSet)
-> Parser (Maybe Text)
-> Parser (Text -> [GeoMatchConstraint] -> GeoMatchSet)
forall (f :: * -> *) a b. Functor 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
"Name")
Parser (Text -> [GeoMatchConstraint] -> GeoMatchSet)
-> Parser Text -> Parser ([GeoMatchConstraint] -> GeoMatchSet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GeoMatchSetId")
Parser ([GeoMatchConstraint] -> GeoMatchSet)
-> Parser [GeoMatchConstraint] -> Parser GeoMatchSet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [GeoMatchConstraint])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GeoMatchConstraints"
Parser (Maybe [GeoMatchConstraint])
-> [GeoMatchConstraint] -> Parser [GeoMatchConstraint]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [GeoMatchConstraint]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable GeoMatchSet
instance Prelude.NFData GeoMatchSet