{-# 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.ActionCondition 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.ActionValue
data ActionCondition = ActionCondition'
{
ActionCondition -> ActionValue
action :: ActionValue
}
deriving (ActionCondition -> ActionCondition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionCondition -> ActionCondition -> Bool
$c/= :: ActionCondition -> ActionCondition -> Bool
== :: ActionCondition -> ActionCondition -> Bool
$c== :: ActionCondition -> ActionCondition -> Bool
Prelude.Eq, ReadPrec [ActionCondition]
ReadPrec ActionCondition
Int -> ReadS ActionCondition
ReadS [ActionCondition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionCondition]
$creadListPrec :: ReadPrec [ActionCondition]
readPrec :: ReadPrec ActionCondition
$creadPrec :: ReadPrec ActionCondition
readList :: ReadS [ActionCondition]
$creadList :: ReadS [ActionCondition]
readsPrec :: Int -> ReadS ActionCondition
$creadsPrec :: Int -> ReadS ActionCondition
Prelude.Read, Int -> ActionCondition -> ShowS
[ActionCondition] -> ShowS
ActionCondition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionCondition] -> ShowS
$cshowList :: [ActionCondition] -> ShowS
show :: ActionCondition -> String
$cshow :: ActionCondition -> String
showsPrec :: Int -> ActionCondition -> ShowS
$cshowsPrec :: Int -> ActionCondition -> ShowS
Prelude.Show, forall x. Rep ActionCondition x -> ActionCondition
forall x. ActionCondition -> Rep ActionCondition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionCondition x -> ActionCondition
$cfrom :: forall x. ActionCondition -> Rep ActionCondition x
Prelude.Generic)
newActionCondition ::
ActionValue ->
ActionCondition
newActionCondition :: ActionValue -> ActionCondition
newActionCondition ActionValue
pAction_ =
ActionCondition' {$sel:action:ActionCondition' :: ActionValue
action = ActionValue
pAction_}
actionCondition_action :: Lens.Lens' ActionCondition ActionValue
actionCondition_action :: Lens' ActionCondition ActionValue
actionCondition_action = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionCondition' {ActionValue
action :: ActionValue
$sel:action:ActionCondition' :: ActionCondition -> ActionValue
action} -> ActionValue
action) (\s :: ActionCondition
s@ActionCondition' {} ActionValue
a -> ActionCondition
s {$sel:action:ActionCondition' :: ActionValue
action = ActionValue
a} :: ActionCondition)
instance Data.FromJSON ActionCondition where
parseJSON :: Value -> Parser ActionCondition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ActionCondition"
( \Object
x ->
ActionValue -> ActionCondition
ActionCondition' 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
"Action")
)
instance Prelude.Hashable ActionCondition where
hashWithSalt :: Int -> ActionCondition -> Int
hashWithSalt Int
_salt ActionCondition' {ActionValue
action :: ActionValue
$sel:action:ActionCondition' :: ActionCondition -> ActionValue
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ActionValue
action
instance Prelude.NFData ActionCondition where
rnf :: ActionCondition -> ()
rnf ActionCondition' {ActionValue
action :: ActionValue
$sel:action:ActionCondition' :: ActionCondition -> ActionValue
..} = forall a. NFData a => a -> ()
Prelude.rnf ActionValue
action
instance Data.ToJSON ActionCondition where
toJSON :: ActionCondition -> Value
toJSON ActionCondition' {ActionValue
action :: ActionValue
$sel:action:ActionCondition' :: ActionCondition -> ActionValue
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Action" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ActionValue
action)]
)