{-# 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.WAFV2.Types.GeoMatchStatement 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.WAFV2.Types.CountryCode
import Amazonka.WAFV2.Types.ForwardedIPConfig
data GeoMatchStatement = GeoMatchStatement'
{
GeoMatchStatement -> Maybe (NonEmpty CountryCode)
countryCodes :: Prelude.Maybe (Prelude.NonEmpty CountryCode),
GeoMatchStatement -> Maybe ForwardedIPConfig
forwardedIPConfig :: Prelude.Maybe ForwardedIPConfig
}
deriving (GeoMatchStatement -> GeoMatchStatement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GeoMatchStatement -> GeoMatchStatement -> Bool
$c/= :: GeoMatchStatement -> GeoMatchStatement -> Bool
== :: GeoMatchStatement -> GeoMatchStatement -> Bool
$c== :: GeoMatchStatement -> GeoMatchStatement -> Bool
Prelude.Eq, ReadPrec [GeoMatchStatement]
ReadPrec GeoMatchStatement
Int -> ReadS GeoMatchStatement
ReadS [GeoMatchStatement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GeoMatchStatement]
$creadListPrec :: ReadPrec [GeoMatchStatement]
readPrec :: ReadPrec GeoMatchStatement
$creadPrec :: ReadPrec GeoMatchStatement
readList :: ReadS [GeoMatchStatement]
$creadList :: ReadS [GeoMatchStatement]
readsPrec :: Int -> ReadS GeoMatchStatement
$creadsPrec :: Int -> ReadS GeoMatchStatement
Prelude.Read, Int -> GeoMatchStatement -> ShowS
[GeoMatchStatement] -> ShowS
GeoMatchStatement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GeoMatchStatement] -> ShowS
$cshowList :: [GeoMatchStatement] -> ShowS
show :: GeoMatchStatement -> String
$cshow :: GeoMatchStatement -> String
showsPrec :: Int -> GeoMatchStatement -> ShowS
$cshowsPrec :: Int -> GeoMatchStatement -> ShowS
Prelude.Show, forall x. Rep GeoMatchStatement x -> GeoMatchStatement
forall x. GeoMatchStatement -> Rep GeoMatchStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GeoMatchStatement x -> GeoMatchStatement
$cfrom :: forall x. GeoMatchStatement -> Rep GeoMatchStatement x
Prelude.Generic)
newGeoMatchStatement ::
GeoMatchStatement
newGeoMatchStatement :: GeoMatchStatement
newGeoMatchStatement =
GeoMatchStatement'
{ $sel:countryCodes:GeoMatchStatement' :: Maybe (NonEmpty CountryCode)
countryCodes = forall a. Maybe a
Prelude.Nothing,
$sel:forwardedIPConfig:GeoMatchStatement' :: Maybe ForwardedIPConfig
forwardedIPConfig = forall a. Maybe a
Prelude.Nothing
}
geoMatchStatement_countryCodes :: Lens.Lens' GeoMatchStatement (Prelude.Maybe (Prelude.NonEmpty CountryCode))
geoMatchStatement_countryCodes :: Lens' GeoMatchStatement (Maybe (NonEmpty CountryCode))
geoMatchStatement_countryCodes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchStatement' {Maybe (NonEmpty CountryCode)
countryCodes :: Maybe (NonEmpty CountryCode)
$sel:countryCodes:GeoMatchStatement' :: GeoMatchStatement -> Maybe (NonEmpty CountryCode)
countryCodes} -> Maybe (NonEmpty CountryCode)
countryCodes) (\s :: GeoMatchStatement
s@GeoMatchStatement' {} Maybe (NonEmpty CountryCode)
a -> GeoMatchStatement
s {$sel:countryCodes:GeoMatchStatement' :: Maybe (NonEmpty CountryCode)
countryCodes = Maybe (NonEmpty CountryCode)
a} :: GeoMatchStatement) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
geoMatchStatement_forwardedIPConfig :: Lens.Lens' GeoMatchStatement (Prelude.Maybe ForwardedIPConfig)
geoMatchStatement_forwardedIPConfig :: Lens' GeoMatchStatement (Maybe ForwardedIPConfig)
geoMatchStatement_forwardedIPConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GeoMatchStatement' {Maybe ForwardedIPConfig
forwardedIPConfig :: Maybe ForwardedIPConfig
$sel:forwardedIPConfig:GeoMatchStatement' :: GeoMatchStatement -> Maybe ForwardedIPConfig
forwardedIPConfig} -> Maybe ForwardedIPConfig
forwardedIPConfig) (\s :: GeoMatchStatement
s@GeoMatchStatement' {} Maybe ForwardedIPConfig
a -> GeoMatchStatement
s {$sel:forwardedIPConfig:GeoMatchStatement' :: Maybe ForwardedIPConfig
forwardedIPConfig = Maybe ForwardedIPConfig
a} :: GeoMatchStatement)
instance Data.FromJSON GeoMatchStatement where
parseJSON :: Value -> Parser GeoMatchStatement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GeoMatchStatement"
( \Object
x ->
Maybe (NonEmpty CountryCode)
-> Maybe ForwardedIPConfig -> GeoMatchStatement
GeoMatchStatement'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CountryCodes")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ForwardedIPConfig")
)
instance Prelude.Hashable GeoMatchStatement where
hashWithSalt :: Int -> GeoMatchStatement -> Int
hashWithSalt Int
_salt GeoMatchStatement' {Maybe (NonEmpty CountryCode)
Maybe ForwardedIPConfig
forwardedIPConfig :: Maybe ForwardedIPConfig
countryCodes :: Maybe (NonEmpty CountryCode)
$sel:forwardedIPConfig:GeoMatchStatement' :: GeoMatchStatement -> Maybe ForwardedIPConfig
$sel:countryCodes:GeoMatchStatement' :: GeoMatchStatement -> Maybe (NonEmpty CountryCode)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty CountryCode)
countryCodes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ForwardedIPConfig
forwardedIPConfig
instance Prelude.NFData GeoMatchStatement where
rnf :: GeoMatchStatement -> ()
rnf GeoMatchStatement' {Maybe (NonEmpty CountryCode)
Maybe ForwardedIPConfig
forwardedIPConfig :: Maybe ForwardedIPConfig
countryCodes :: Maybe (NonEmpty CountryCode)
$sel:forwardedIPConfig:GeoMatchStatement' :: GeoMatchStatement -> Maybe ForwardedIPConfig
$sel:countryCodes:GeoMatchStatement' :: GeoMatchStatement -> Maybe (NonEmpty CountryCode)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty CountryCode)
countryCodes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ForwardedIPConfig
forwardedIPConfig
instance Data.ToJSON GeoMatchStatement where
toJSON :: GeoMatchStatement -> Value
toJSON GeoMatchStatement' {Maybe (NonEmpty CountryCode)
Maybe ForwardedIPConfig
forwardedIPConfig :: Maybe ForwardedIPConfig
countryCodes :: Maybe (NonEmpty CountryCode)
$sel:forwardedIPConfig:GeoMatchStatement' :: GeoMatchStatement -> Maybe ForwardedIPConfig
$sel:countryCodes:GeoMatchStatement' :: GeoMatchStatement -> Maybe (NonEmpty CountryCode)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CountryCodes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty CountryCode)
countryCodes,
(Key
"ForwardedIPConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ForwardedIPConfig
forwardedIPConfig
]
)