{-# 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.WAFRegional.Types.GeoMatchConstraint where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFRegional.Types.GeoMatchConstraintType
import Amazonka.WAFRegional.Types.GeoMatchConstraintValue
data GeoMatchConstraint = GeoMatchConstraint'
{
GeoMatchConstraint -> GeoMatchConstraintType
type' :: GeoMatchConstraintType,
GeoMatchConstraint -> GeoMatchConstraintValue
value :: GeoMatchConstraintValue
}
deriving (GeoMatchConstraint -> GeoMatchConstraint -> Bool
(GeoMatchConstraint -> GeoMatchConstraint -> Bool)
-> (GeoMatchConstraint -> GeoMatchConstraint -> Bool)
-> Eq GeoMatchConstraint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoMatchConstraint -> GeoMatchConstraint -> Bool
$c/= :: GeoMatchConstraint -> GeoMatchConstraint -> Bool
== :: GeoMatchConstraint -> GeoMatchConstraint -> Bool
$c== :: GeoMatchConstraint -> GeoMatchConstraint -> Bool
Prelude.Eq, ReadPrec [GeoMatchConstraint]
ReadPrec GeoMatchConstraint
Int -> ReadS GeoMatchConstraint
ReadS [GeoMatchConstraint]
(Int -> ReadS GeoMatchConstraint)
-> ReadS [GeoMatchConstraint]
-> ReadPrec GeoMatchConstraint
-> ReadPrec [GeoMatchConstraint]
-> Read GeoMatchConstraint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoMatchConstraint]
$creadListPrec :: ReadPrec [GeoMatchConstraint]
readPrec :: ReadPrec GeoMatchConstraint
$creadPrec :: ReadPrec GeoMatchConstraint
readList :: ReadS [GeoMatchConstraint]
$creadList :: ReadS [GeoMatchConstraint]
readsPrec :: Int -> ReadS GeoMatchConstraint
$creadsPrec :: Int -> ReadS GeoMatchConstraint
Prelude.Read, Int -> GeoMatchConstraint -> ShowS
[GeoMatchConstraint] -> ShowS
GeoMatchConstraint -> String
(Int -> GeoMatchConstraint -> ShowS)
-> (GeoMatchConstraint -> String)
-> ([GeoMatchConstraint] -> ShowS)
-> Show GeoMatchConstraint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoMatchConstraint] -> ShowS
$cshowList :: [GeoMatchConstraint] -> ShowS
show :: GeoMatchConstraint -> String
$cshow :: GeoMatchConstraint -> String
showsPrec :: Int -> GeoMatchConstraint -> ShowS
$cshowsPrec :: Int -> GeoMatchConstraint -> ShowS
Prelude.Show, (forall x. GeoMatchConstraint -> Rep GeoMatchConstraint x)
-> (forall x. Rep GeoMatchConstraint x -> GeoMatchConstraint)
-> Generic GeoMatchConstraint
forall x. Rep GeoMatchConstraint x -> GeoMatchConstraint
forall x. GeoMatchConstraint -> Rep GeoMatchConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoMatchConstraint x -> GeoMatchConstraint
$cfrom :: forall x. GeoMatchConstraint -> Rep GeoMatchConstraint x
Prelude.Generic)
newGeoMatchConstraint ::
GeoMatchConstraintType ->
GeoMatchConstraintValue ->
GeoMatchConstraint
newGeoMatchConstraint :: GeoMatchConstraintType
-> GeoMatchConstraintValue -> GeoMatchConstraint
newGeoMatchConstraint GeoMatchConstraintType
pType_ GeoMatchConstraintValue
pValue_ =
GeoMatchConstraint' :: GeoMatchConstraintType
-> GeoMatchConstraintValue -> GeoMatchConstraint
GeoMatchConstraint'
{ $sel:type':GeoMatchConstraint' :: GeoMatchConstraintType
type' = GeoMatchConstraintType
pType_,
$sel:value:GeoMatchConstraint' :: GeoMatchConstraintValue
value = GeoMatchConstraintValue
pValue_
}
geoMatchConstraint_type :: Lens.Lens' GeoMatchConstraint GeoMatchConstraintType
geoMatchConstraint_type :: (GeoMatchConstraintType -> f GeoMatchConstraintType)
-> GeoMatchConstraint -> f GeoMatchConstraint
geoMatchConstraint_type = (GeoMatchConstraint -> GeoMatchConstraintType)
-> (GeoMatchConstraint
-> GeoMatchConstraintType -> GeoMatchConstraint)
-> Lens
GeoMatchConstraint
GeoMatchConstraint
GeoMatchConstraintType
GeoMatchConstraintType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchConstraint' {GeoMatchConstraintType
type' :: GeoMatchConstraintType
$sel:type':GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintType
type'} -> GeoMatchConstraintType
type') (\s :: GeoMatchConstraint
s@GeoMatchConstraint' {} GeoMatchConstraintType
a -> GeoMatchConstraint
s {$sel:type':GeoMatchConstraint' :: GeoMatchConstraintType
type' = GeoMatchConstraintType
a} :: GeoMatchConstraint)
geoMatchConstraint_value :: Lens.Lens' GeoMatchConstraint GeoMatchConstraintValue
geoMatchConstraint_value :: (GeoMatchConstraintValue -> f GeoMatchConstraintValue)
-> GeoMatchConstraint -> f GeoMatchConstraint
geoMatchConstraint_value = (GeoMatchConstraint -> GeoMatchConstraintValue)
-> (GeoMatchConstraint
-> GeoMatchConstraintValue -> GeoMatchConstraint)
-> Lens
GeoMatchConstraint
GeoMatchConstraint
GeoMatchConstraintValue
GeoMatchConstraintValue
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchConstraint' {GeoMatchConstraintValue
value :: GeoMatchConstraintValue
$sel:value:GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintValue
value} -> GeoMatchConstraintValue
value) (\s :: GeoMatchConstraint
s@GeoMatchConstraint' {} GeoMatchConstraintValue
a -> GeoMatchConstraint
s {$sel:value:GeoMatchConstraint' :: GeoMatchConstraintValue
value = GeoMatchConstraintValue
a} :: GeoMatchConstraint)
instance Core.FromJSON GeoMatchConstraint where
parseJSON :: Value -> Parser GeoMatchConstraint
parseJSON =
String
-> (Object -> Parser GeoMatchConstraint)
-> Value
-> Parser GeoMatchConstraint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GeoMatchConstraint"
( \Object
x ->
GeoMatchConstraintType
-> GeoMatchConstraintValue -> GeoMatchConstraint
GeoMatchConstraint'
(GeoMatchConstraintType
-> GeoMatchConstraintValue -> GeoMatchConstraint)
-> Parser GeoMatchConstraintType
-> Parser (GeoMatchConstraintValue -> GeoMatchConstraint)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser GeoMatchConstraintType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type") Parser (GeoMatchConstraintValue -> GeoMatchConstraint)
-> Parser GeoMatchConstraintValue -> Parser GeoMatchConstraint
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser GeoMatchConstraintValue
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
)
instance Prelude.Hashable GeoMatchConstraint
instance Prelude.NFData GeoMatchConstraint
instance Core.ToJSON GeoMatchConstraint where
toJSON :: GeoMatchConstraint -> Value
toJSON GeoMatchConstraint' {GeoMatchConstraintType
GeoMatchConstraintValue
value :: GeoMatchConstraintValue
type' :: GeoMatchConstraintType
$sel:value:GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintValue
$sel:type':GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> GeoMatchConstraintType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GeoMatchConstraintType
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> GeoMatchConstraintValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GeoMatchConstraintValue
value)
]
)