{-# 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.ForwardedIPConfig 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
data ForwardedIPConfig = ForwardedIPConfig'
{
:: Prelude.Text,
ForwardedIPConfig -> FallbackBehavior
fallbackBehavior :: FallbackBehavior
}
deriving (ForwardedIPConfig -> ForwardedIPConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForwardedIPConfig -> ForwardedIPConfig -> Bool
$c/= :: ForwardedIPConfig -> ForwardedIPConfig -> Bool
== :: ForwardedIPConfig -> ForwardedIPConfig -> Bool
$c== :: ForwardedIPConfig -> ForwardedIPConfig -> Bool
Prelude.Eq, ReadPrec [ForwardedIPConfig]
ReadPrec ForwardedIPConfig
Int -> ReadS ForwardedIPConfig
ReadS [ForwardedIPConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForwardedIPConfig]
$creadListPrec :: ReadPrec [ForwardedIPConfig]
readPrec :: ReadPrec ForwardedIPConfig
$creadPrec :: ReadPrec ForwardedIPConfig
readList :: ReadS [ForwardedIPConfig]
$creadList :: ReadS [ForwardedIPConfig]
readsPrec :: Int -> ReadS ForwardedIPConfig
$creadsPrec :: Int -> ReadS ForwardedIPConfig
Prelude.Read, Int -> ForwardedIPConfig -> ShowS
[ForwardedIPConfig] -> ShowS
ForwardedIPConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForwardedIPConfig] -> ShowS
$cshowList :: [ForwardedIPConfig] -> ShowS
show :: ForwardedIPConfig -> String
$cshow :: ForwardedIPConfig -> String
showsPrec :: Int -> ForwardedIPConfig -> ShowS
$cshowsPrec :: Int -> ForwardedIPConfig -> ShowS
Prelude.Show, forall x. Rep ForwardedIPConfig x -> ForwardedIPConfig
forall x. ForwardedIPConfig -> Rep ForwardedIPConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForwardedIPConfig x -> ForwardedIPConfig
$cfrom :: forall x. ForwardedIPConfig -> Rep ForwardedIPConfig x
Prelude.Generic)
newForwardedIPConfig ::
Prelude.Text ->
FallbackBehavior ->
ForwardedIPConfig
newForwardedIPConfig :: Text -> FallbackBehavior -> ForwardedIPConfig
newForwardedIPConfig Text
pHeaderName_ FallbackBehavior
pFallbackBehavior_ =
ForwardedIPConfig'
{ $sel:headerName:ForwardedIPConfig' :: Text
headerName = Text
pHeaderName_,
$sel:fallbackBehavior:ForwardedIPConfig' :: FallbackBehavior
fallbackBehavior = FallbackBehavior
pFallbackBehavior_
}
forwardedIPConfig_headerName :: Lens.Lens' ForwardedIPConfig Prelude.Text
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForwardedIPConfig' {Text
headerName :: Text
$sel:headerName:ForwardedIPConfig' :: ForwardedIPConfig -> Text
headerName} -> Text
headerName) (\s :: ForwardedIPConfig
s@ForwardedIPConfig' {} Text
a -> ForwardedIPConfig
s {$sel:headerName:ForwardedIPConfig' :: Text
headerName = Text
a} :: ForwardedIPConfig)
forwardedIPConfig_fallbackBehavior :: Lens.Lens' ForwardedIPConfig FallbackBehavior
forwardedIPConfig_fallbackBehavior :: Lens' ForwardedIPConfig FallbackBehavior
forwardedIPConfig_fallbackBehavior = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForwardedIPConfig' {FallbackBehavior
fallbackBehavior :: FallbackBehavior
$sel:fallbackBehavior:ForwardedIPConfig' :: ForwardedIPConfig -> FallbackBehavior
fallbackBehavior} -> FallbackBehavior
fallbackBehavior) (\s :: ForwardedIPConfig
s@ForwardedIPConfig' {} FallbackBehavior
a -> ForwardedIPConfig
s {$sel:fallbackBehavior:ForwardedIPConfig' :: FallbackBehavior
fallbackBehavior = FallbackBehavior
a} :: ForwardedIPConfig)
instance Data.FromJSON ForwardedIPConfig where
parseJSON :: Value -> Parser ForwardedIPConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ForwardedIPConfig"
( \Object
x ->
Text -> FallbackBehavior -> ForwardedIPConfig
ForwardedIPConfig'
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")
)
instance Prelude.Hashable ForwardedIPConfig where
hashWithSalt :: Int -> ForwardedIPConfig -> Int
hashWithSalt Int
_salt ForwardedIPConfig' {Text
FallbackBehavior
fallbackBehavior :: FallbackBehavior
headerName :: Text
$sel:fallbackBehavior:ForwardedIPConfig' :: ForwardedIPConfig -> FallbackBehavior
$sel:headerName:ForwardedIPConfig' :: ForwardedIPConfig -> 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
instance Prelude.NFData ForwardedIPConfig where
rnf :: ForwardedIPConfig -> ()
rnf ForwardedIPConfig' {Text
FallbackBehavior
fallbackBehavior :: FallbackBehavior
headerName :: Text
$sel:fallbackBehavior:ForwardedIPConfig' :: ForwardedIPConfig -> FallbackBehavior
$sel:headerName:ForwardedIPConfig' :: ForwardedIPConfig -> 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
instance Data.ToJSON ForwardedIPConfig where
toJSON :: ForwardedIPConfig -> Value
toJSON ForwardedIPConfig' {Text
FallbackBehavior
fallbackBehavior :: FallbackBehavior
headerName :: Text
$sel:fallbackBehavior:ForwardedIPConfig' :: ForwardedIPConfig -> FallbackBehavior
$sel:headerName:ForwardedIPConfig' :: ForwardedIPConfig -> 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)
]
)