{-# 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.IPSetForwardedIPConfig 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.FallbackBehavior
import Amazonka.WAFV2.Types.ForwardedIPPosition
data IPSetForwardedIPConfig = IPSetForwardedIPConfig'
{
:: Prelude.Text,
IPSetForwardedIPConfig -> FallbackBehavior
fallbackBehavior :: FallbackBehavior,
IPSetForwardedIPConfig -> ForwardedIPPosition
position :: ForwardedIPPosition
}
deriving (IPSetForwardedIPConfig -> IPSetForwardedIPConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPSetForwardedIPConfig -> IPSetForwardedIPConfig -> Bool
$c/= :: IPSetForwardedIPConfig -> IPSetForwardedIPConfig -> Bool
== :: IPSetForwardedIPConfig -> IPSetForwardedIPConfig -> Bool
$c== :: IPSetForwardedIPConfig -> IPSetForwardedIPConfig -> Bool
Prelude.Eq, ReadPrec [IPSetForwardedIPConfig]
ReadPrec IPSetForwardedIPConfig
Int -> ReadS IPSetForwardedIPConfig
ReadS [IPSetForwardedIPConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IPSetForwardedIPConfig]
$creadListPrec :: ReadPrec [IPSetForwardedIPConfig]
readPrec :: ReadPrec IPSetForwardedIPConfig
$creadPrec :: ReadPrec IPSetForwardedIPConfig
readList :: ReadS [IPSetForwardedIPConfig]
$creadList :: ReadS [IPSetForwardedIPConfig]
readsPrec :: Int -> ReadS IPSetForwardedIPConfig
$creadsPrec :: Int -> ReadS IPSetForwardedIPConfig
Prelude.Read, Int -> IPSetForwardedIPConfig -> ShowS
[IPSetForwardedIPConfig] -> ShowS
IPSetForwardedIPConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPSetForwardedIPConfig] -> ShowS
$cshowList :: [IPSetForwardedIPConfig] -> ShowS
show :: IPSetForwardedIPConfig -> String
$cshow :: IPSetForwardedIPConfig -> String
showsPrec :: Int -> IPSetForwardedIPConfig -> ShowS
$cshowsPrec :: Int -> IPSetForwardedIPConfig -> ShowS
Prelude.Show, forall x. Rep IPSetForwardedIPConfig x -> IPSetForwardedIPConfig
forall x. IPSetForwardedIPConfig -> Rep IPSetForwardedIPConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPSetForwardedIPConfig x -> IPSetForwardedIPConfig
$cfrom :: forall x. IPSetForwardedIPConfig -> Rep IPSetForwardedIPConfig x
Prelude.Generic)
newIPSetForwardedIPConfig ::
Prelude.Text ->
FallbackBehavior ->
ForwardedIPPosition ->
IPSetForwardedIPConfig
newIPSetForwardedIPConfig :: Text
-> FallbackBehavior
-> ForwardedIPPosition
-> IPSetForwardedIPConfig
newIPSetForwardedIPConfig
Text
pHeaderName_
FallbackBehavior
pFallbackBehavior_
ForwardedIPPosition
pPosition_ =
IPSetForwardedIPConfig'
{ $sel:headerName:IPSetForwardedIPConfig' :: Text
headerName = Text
pHeaderName_,
$sel:fallbackBehavior:IPSetForwardedIPConfig' :: FallbackBehavior
fallbackBehavior = FallbackBehavior
pFallbackBehavior_,
$sel:position:IPSetForwardedIPConfig' :: ForwardedIPPosition
position = ForwardedIPPosition
pPosition_
}
iPSetForwardedIPConfig_headerName :: Lens.Lens' IPSetForwardedIPConfig Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSetForwardedIPConfig' {Text
headerName :: Text
$sel:headerName:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> Text
headerName} -> Text
headerName) (\s :: IPSetForwardedIPConfig
s@IPSetForwardedIPConfig' {} Text
a -> IPSetForwardedIPConfig
s {$sel:headerName:IPSetForwardedIPConfig' :: Text
headerName = Text
a} :: IPSetForwardedIPConfig)
iPSetForwardedIPConfig_fallbackBehavior :: Lens.Lens' IPSetForwardedIPConfig FallbackBehavior
iPSetForwardedIPConfig_fallbackBehavior :: Lens' IPSetForwardedIPConfig FallbackBehavior
iPSetForwardedIPConfig_fallbackBehavior = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSetForwardedIPConfig' {FallbackBehavior
fallbackBehavior :: FallbackBehavior
$sel:fallbackBehavior:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> FallbackBehavior
fallbackBehavior} -> FallbackBehavior
fallbackBehavior) (\s :: IPSetForwardedIPConfig
s@IPSetForwardedIPConfig' {} FallbackBehavior
a -> IPSetForwardedIPConfig
s {$sel:fallbackBehavior:IPSetForwardedIPConfig' :: FallbackBehavior
fallbackBehavior = FallbackBehavior
a} :: IPSetForwardedIPConfig)
iPSetForwardedIPConfig_position :: Lens.Lens' IPSetForwardedIPConfig ForwardedIPPosition
iPSetForwardedIPConfig_position :: Lens' IPSetForwardedIPConfig ForwardedIPPosition
iPSetForwardedIPConfig_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPSetForwardedIPConfig' {ForwardedIPPosition
position :: ForwardedIPPosition
$sel:position:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> ForwardedIPPosition
position} -> ForwardedIPPosition
position) (\s :: IPSetForwardedIPConfig
s@IPSetForwardedIPConfig' {} ForwardedIPPosition
a -> IPSetForwardedIPConfig
s {$sel:position:IPSetForwardedIPConfig' :: ForwardedIPPosition
position = ForwardedIPPosition
a} :: IPSetForwardedIPConfig)
instance Data.FromJSON IPSetForwardedIPConfig where
parseJSON :: Value -> Parser IPSetForwardedIPConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"IPSetForwardedIPConfig"
( \Object
x ->
Text
-> FallbackBehavior
-> ForwardedIPPosition
-> IPSetForwardedIPConfig
IPSetForwardedIPConfig'
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
"HeaderName")
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
"FallbackBehavior")
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
"Position")
)
instance Prelude.Hashable IPSetForwardedIPConfig where
hashWithSalt :: Int -> IPSetForwardedIPConfig -> Int
hashWithSalt Int
_salt IPSetForwardedIPConfig' {Text
FallbackBehavior
ForwardedIPPosition
position :: ForwardedIPPosition
fallbackBehavior :: FallbackBehavior
headerName :: Text
$sel:position:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> ForwardedIPPosition
$sel:fallbackBehavior:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> FallbackBehavior
$sel:headerName:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
headerName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FallbackBehavior
fallbackBehavior
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ForwardedIPPosition
position
instance Prelude.NFData IPSetForwardedIPConfig where
rnf :: IPSetForwardedIPConfig -> ()
rnf IPSetForwardedIPConfig' {Text
FallbackBehavior
ForwardedIPPosition
position :: ForwardedIPPosition
fallbackBehavior :: FallbackBehavior
headerName :: Text
$sel:position:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> ForwardedIPPosition
$sel:fallbackBehavior:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> FallbackBehavior
$sel:headerName:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
headerName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FallbackBehavior
fallbackBehavior
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ForwardedIPPosition
position
instance Data.ToJSON IPSetForwardedIPConfig where
toJSON :: IPSetForwardedIPConfig -> Value
toJSON IPSetForwardedIPConfig' {Text
FallbackBehavior
ForwardedIPPosition
position :: ForwardedIPPosition
fallbackBehavior :: FallbackBehavior
headerName :: Text
$sel:position:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> ForwardedIPPosition
$sel:fallbackBehavior:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> FallbackBehavior
$sel:headerName:IPSetForwardedIPConfig' :: IPSetForwardedIPConfig -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"HeaderName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
headerName),
forall a. a -> Maybe a
Prelude.Just
(Key
"FallbackBehavior" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FallbackBehavior
fallbackBehavior),
forall a. a -> Maybe a
Prelude.Just (Key
"Position" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ForwardedIPPosition
position)
]
)