{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:type':GeoMatchConstraint' :: GeoMatchConstraintType
type' = GeoMatchConstraintType
pType_,
$sel:value:GeoMatchConstraint' :: GeoMatchConstraintValue
value = GeoMatchConstraintValue
pValue_
}
geoMatchConstraint_type :: Lens.Lens' GeoMatchConstraint GeoMatchConstraintType
geoMatchConstraint_type :: Lens' GeoMatchConstraint GeoMatchConstraintType
geoMatchConstraint_type = 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 :: Lens' GeoMatchConstraint GeoMatchConstraintValue
geoMatchConstraint_value = 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 Data.FromJSON GeoMatchConstraint where
parseJSON :: Value -> Parser GeoMatchConstraint
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GeoMatchConstraint"
( \Object
x ->
GeoMatchConstraintType
-> GeoMatchConstraintValue -> GeoMatchConstraint
GeoMatchConstraint'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Value")
)
instance Prelude.Hashable GeoMatchConstraint where
hashWithSalt :: Int -> GeoMatchConstraint -> Int
hashWithSalt Int
_salt GeoMatchConstraint' {GeoMatchConstraintType
GeoMatchConstraintValue
value :: GeoMatchConstraintValue
type' :: GeoMatchConstraintType
$sel:value:GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintValue
$sel:type':GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GeoMatchConstraintType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GeoMatchConstraintValue
value
instance Prelude.NFData GeoMatchConstraint where
rnf :: GeoMatchConstraint -> ()
rnf GeoMatchConstraint' {GeoMatchConstraintType
GeoMatchConstraintValue
value :: GeoMatchConstraintValue
type' :: GeoMatchConstraintType
$sel:value:GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintValue
$sel:type':GeoMatchConstraint' :: GeoMatchConstraint -> GeoMatchConstraintType
..} =
forall a. NFData a => a -> ()
Prelude.rnf GeoMatchConstraintType
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf GeoMatchConstraintValue
value
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GeoMatchConstraintType
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GeoMatchConstraintValue
value)
]
)