{-# 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.SecurityHub.Types.Action where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsApiCallAction
import Amazonka.SecurityHub.Types.DnsRequestAction
import Amazonka.SecurityHub.Types.NetworkConnectionAction
import Amazonka.SecurityHub.Types.PortProbeAction
data Action = Action'
{
Action -> Maybe NetworkConnectionAction
networkConnectionAction :: Prelude.Maybe NetworkConnectionAction,
Action -> Maybe PortProbeAction
portProbeAction :: Prelude.Maybe PortProbeAction,
Action -> Maybe Text
actionType :: Prelude.Maybe Prelude.Text,
Action -> Maybe DnsRequestAction
dnsRequestAction :: Prelude.Maybe DnsRequestAction,
Action -> Maybe AwsApiCallAction
awsApiCallAction :: Prelude.Maybe AwsApiCallAction
}
deriving (Action -> Action -> Bool
(Action -> Action -> Bool)
-> (Action -> Action -> Bool) -> Eq Action
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Action -> Action -> Bool
$c/= :: Action -> Action -> Bool
== :: Action -> Action -> Bool
$c== :: Action -> Action -> Bool
Prelude.Eq, ReadPrec [Action]
ReadPrec Action
Int -> ReadS Action
ReadS [Action]
(Int -> ReadS Action)
-> ReadS [Action]
-> ReadPrec Action
-> ReadPrec [Action]
-> Read Action
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Action]
$creadListPrec :: ReadPrec [Action]
readPrec :: ReadPrec Action
$creadPrec :: ReadPrec Action
readList :: ReadS [Action]
$creadList :: ReadS [Action]
readsPrec :: Int -> ReadS Action
$creadsPrec :: Int -> ReadS Action
Prelude.Read, Int -> Action -> ShowS
[Action] -> ShowS
Action -> String
(Int -> Action -> ShowS)
-> (Action -> String) -> ([Action] -> ShowS) -> Show Action
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Action] -> ShowS
$cshowList :: [Action] -> ShowS
show :: Action -> String
$cshow :: Action -> String
showsPrec :: Int -> Action -> ShowS
$cshowsPrec :: Int -> Action -> ShowS
Prelude.Show, (forall x. Action -> Rep Action x)
-> (forall x. Rep Action x -> Action) -> Generic Action
forall x. Rep Action x -> Action
forall x. Action -> Rep Action x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Action x -> Action
$cfrom :: forall x. Action -> Rep Action x
Prelude.Generic)
newAction ::
Action
newAction :: Action
newAction =
Action' :: Maybe NetworkConnectionAction
-> Maybe PortProbeAction
-> Maybe Text
-> Maybe DnsRequestAction
-> Maybe AwsApiCallAction
-> Action
Action'
{ $sel:networkConnectionAction:Action' :: Maybe NetworkConnectionAction
networkConnectionAction = Maybe NetworkConnectionAction
forall a. Maybe a
Prelude.Nothing,
$sel:portProbeAction:Action' :: Maybe PortProbeAction
portProbeAction = Maybe PortProbeAction
forall a. Maybe a
Prelude.Nothing,
$sel:actionType:Action' :: Maybe Text
actionType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dnsRequestAction:Action' :: Maybe DnsRequestAction
dnsRequestAction = Maybe DnsRequestAction
forall a. Maybe a
Prelude.Nothing,
$sel:awsApiCallAction:Action' :: Maybe AwsApiCallAction
awsApiCallAction = Maybe AwsApiCallAction
forall a. Maybe a
Prelude.Nothing
}
action_networkConnectionAction :: Lens.Lens' Action (Prelude.Maybe NetworkConnectionAction)
action_networkConnectionAction :: (Maybe NetworkConnectionAction
-> f (Maybe NetworkConnectionAction))
-> Action -> f Action
action_networkConnectionAction = (Action -> Maybe NetworkConnectionAction)
-> (Action -> Maybe NetworkConnectionAction -> Action)
-> Lens
Action
Action
(Maybe NetworkConnectionAction)
(Maybe NetworkConnectionAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe NetworkConnectionAction
networkConnectionAction :: Maybe NetworkConnectionAction
$sel:networkConnectionAction:Action' :: Action -> Maybe NetworkConnectionAction
networkConnectionAction} -> Maybe NetworkConnectionAction
networkConnectionAction) (\s :: Action
s@Action' {} Maybe NetworkConnectionAction
a -> Action
s {$sel:networkConnectionAction:Action' :: Maybe NetworkConnectionAction
networkConnectionAction = Maybe NetworkConnectionAction
a} :: Action)
action_portProbeAction :: Lens.Lens' Action (Prelude.Maybe PortProbeAction)
action_portProbeAction :: (Maybe PortProbeAction -> f (Maybe PortProbeAction))
-> Action -> f Action
action_portProbeAction = (Action -> Maybe PortProbeAction)
-> (Action -> Maybe PortProbeAction -> Action)
-> Lens
Action Action (Maybe PortProbeAction) (Maybe PortProbeAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe PortProbeAction
portProbeAction :: Maybe PortProbeAction
$sel:portProbeAction:Action' :: Action -> Maybe PortProbeAction
portProbeAction} -> Maybe PortProbeAction
portProbeAction) (\s :: Action
s@Action' {} Maybe PortProbeAction
a -> Action
s {$sel:portProbeAction:Action' :: Maybe PortProbeAction
portProbeAction = Maybe PortProbeAction
a} :: Action)
action_actionType :: Lens.Lens' Action (Prelude.Maybe Prelude.Text)
action_actionType :: (Maybe Text -> f (Maybe Text)) -> Action -> f Action
action_actionType = (Action -> Maybe Text)
-> (Action -> Maybe Text -> Action)
-> Lens Action Action (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Text
actionType :: Maybe Text
$sel:actionType:Action' :: Action -> Maybe Text
actionType} -> Maybe Text
actionType) (\s :: Action
s@Action' {} Maybe Text
a -> Action
s {$sel:actionType:Action' :: Maybe Text
actionType = Maybe Text
a} :: Action)
action_dnsRequestAction :: Lens.Lens' Action (Prelude.Maybe DnsRequestAction)
action_dnsRequestAction :: (Maybe DnsRequestAction -> f (Maybe DnsRequestAction))
-> Action -> f Action
action_dnsRequestAction = (Action -> Maybe DnsRequestAction)
-> (Action -> Maybe DnsRequestAction -> Action)
-> Lens
Action Action (Maybe DnsRequestAction) (Maybe DnsRequestAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe DnsRequestAction
dnsRequestAction :: Maybe DnsRequestAction
$sel:dnsRequestAction:Action' :: Action -> Maybe DnsRequestAction
dnsRequestAction} -> Maybe DnsRequestAction
dnsRequestAction) (\s :: Action
s@Action' {} Maybe DnsRequestAction
a -> Action
s {$sel:dnsRequestAction:Action' :: Maybe DnsRequestAction
dnsRequestAction = Maybe DnsRequestAction
a} :: Action)
action_awsApiCallAction :: Lens.Lens' Action (Prelude.Maybe AwsApiCallAction)
action_awsApiCallAction :: (Maybe AwsApiCallAction -> f (Maybe AwsApiCallAction))
-> Action -> f Action
action_awsApiCallAction = (Action -> Maybe AwsApiCallAction)
-> (Action -> Maybe AwsApiCallAction -> Action)
-> Lens
Action Action (Maybe AwsApiCallAction) (Maybe AwsApiCallAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe AwsApiCallAction
awsApiCallAction :: Maybe AwsApiCallAction
$sel:awsApiCallAction:Action' :: Action -> Maybe AwsApiCallAction
awsApiCallAction} -> Maybe AwsApiCallAction
awsApiCallAction) (\s :: Action
s@Action' {} Maybe AwsApiCallAction
a -> Action
s {$sel:awsApiCallAction:Action' :: Maybe AwsApiCallAction
awsApiCallAction = Maybe AwsApiCallAction
a} :: Action)
instance Core.FromJSON Action where
parseJSON :: Value -> Parser Action
parseJSON =
String -> (Object -> Parser Action) -> Value -> Parser Action
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Action"
( \Object
x ->
Maybe NetworkConnectionAction
-> Maybe PortProbeAction
-> Maybe Text
-> Maybe DnsRequestAction
-> Maybe AwsApiCallAction
-> Action
Action'
(Maybe NetworkConnectionAction
-> Maybe PortProbeAction
-> Maybe Text
-> Maybe DnsRequestAction
-> Maybe AwsApiCallAction
-> Action)
-> Parser (Maybe NetworkConnectionAction)
-> Parser
(Maybe PortProbeAction
-> Maybe Text
-> Maybe DnsRequestAction
-> Maybe AwsApiCallAction
-> Action)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NetworkConnectionAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NetworkConnectionAction")
Parser
(Maybe PortProbeAction
-> Maybe Text
-> Maybe DnsRequestAction
-> Maybe AwsApiCallAction
-> Action)
-> Parser (Maybe PortProbeAction)
-> Parser
(Maybe Text
-> Maybe DnsRequestAction -> Maybe AwsApiCallAction -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PortProbeAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PortProbeAction")
Parser
(Maybe Text
-> Maybe DnsRequestAction -> Maybe AwsApiCallAction -> Action)
-> Parser (Maybe Text)
-> Parser
(Maybe DnsRequestAction -> Maybe AwsApiCallAction -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActionType")
Parser (Maybe DnsRequestAction -> Maybe AwsApiCallAction -> Action)
-> Parser (Maybe DnsRequestAction)
-> Parser (Maybe AwsApiCallAction -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DnsRequestAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DnsRequestAction")
Parser (Maybe AwsApiCallAction -> Action)
-> Parser (Maybe AwsApiCallAction) -> Parser Action
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AwsApiCallAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AwsApiCallAction")
)
instance Prelude.Hashable Action
instance Prelude.NFData Action
instance Core.ToJSON Action where
toJSON :: Action -> Value
toJSON Action' {Maybe Text
Maybe DnsRequestAction
Maybe AwsApiCallAction
Maybe NetworkConnectionAction
Maybe PortProbeAction
awsApiCallAction :: Maybe AwsApiCallAction
dnsRequestAction :: Maybe DnsRequestAction
actionType :: Maybe Text
portProbeAction :: Maybe PortProbeAction
networkConnectionAction :: Maybe NetworkConnectionAction
$sel:awsApiCallAction:Action' :: Action -> Maybe AwsApiCallAction
$sel:dnsRequestAction:Action' :: Action -> Maybe DnsRequestAction
$sel:actionType:Action' :: Action -> Maybe Text
$sel:portProbeAction:Action' :: Action -> Maybe PortProbeAction
$sel:networkConnectionAction:Action' :: Action -> Maybe NetworkConnectionAction
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NetworkConnectionAction" Text -> NetworkConnectionAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NetworkConnectionAction -> Pair)
-> Maybe NetworkConnectionAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkConnectionAction
networkConnectionAction,
(Text
"PortProbeAction" Text -> PortProbeAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(PortProbeAction -> Pair) -> Maybe PortProbeAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PortProbeAction
portProbeAction,
(Text
"ActionType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
actionType,
(Text
"DnsRequestAction" Text -> DnsRequestAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DnsRequestAction -> Pair) -> Maybe DnsRequestAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DnsRequestAction
dnsRequestAction,
(Text
"AwsApiCallAction" Text -> AwsApiCallAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AwsApiCallAction -> Pair) -> Maybe AwsApiCallAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsApiCallAction
awsApiCallAction
]
)