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