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