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