{-# 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.PortProbeAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.PortProbeDetail
data PortProbeAction = PortProbeAction'
{
PortProbeAction -> Maybe [PortProbeDetail]
portProbeDetails :: Prelude.Maybe [PortProbeDetail],
PortProbeAction -> Maybe Bool
blocked :: Prelude.Maybe Prelude.Bool
}
deriving (PortProbeAction -> PortProbeAction -> Bool
(PortProbeAction -> PortProbeAction -> Bool)
-> (PortProbeAction -> PortProbeAction -> Bool)
-> Eq PortProbeAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortProbeAction -> PortProbeAction -> Bool
$c/= :: PortProbeAction -> PortProbeAction -> Bool
== :: PortProbeAction -> PortProbeAction -> Bool
$c== :: PortProbeAction -> PortProbeAction -> Bool
Prelude.Eq, ReadPrec [PortProbeAction]
ReadPrec PortProbeAction
Int -> ReadS PortProbeAction
ReadS [PortProbeAction]
(Int -> ReadS PortProbeAction)
-> ReadS [PortProbeAction]
-> ReadPrec PortProbeAction
-> ReadPrec [PortProbeAction]
-> Read PortProbeAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PortProbeAction]
$creadListPrec :: ReadPrec [PortProbeAction]
readPrec :: ReadPrec PortProbeAction
$creadPrec :: ReadPrec PortProbeAction
readList :: ReadS [PortProbeAction]
$creadList :: ReadS [PortProbeAction]
readsPrec :: Int -> ReadS PortProbeAction
$creadsPrec :: Int -> ReadS PortProbeAction
Prelude.Read, Int -> PortProbeAction -> ShowS
[PortProbeAction] -> ShowS
PortProbeAction -> String
(Int -> PortProbeAction -> ShowS)
-> (PortProbeAction -> String)
-> ([PortProbeAction] -> ShowS)
-> Show PortProbeAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortProbeAction] -> ShowS
$cshowList :: [PortProbeAction] -> ShowS
show :: PortProbeAction -> String
$cshow :: PortProbeAction -> String
showsPrec :: Int -> PortProbeAction -> ShowS
$cshowsPrec :: Int -> PortProbeAction -> ShowS
Prelude.Show, (forall x. PortProbeAction -> Rep PortProbeAction x)
-> (forall x. Rep PortProbeAction x -> PortProbeAction)
-> Generic PortProbeAction
forall x. Rep PortProbeAction x -> PortProbeAction
forall x. PortProbeAction -> Rep PortProbeAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortProbeAction x -> PortProbeAction
$cfrom :: forall x. PortProbeAction -> Rep PortProbeAction x
Prelude.Generic)
newPortProbeAction ::
PortProbeAction
newPortProbeAction :: PortProbeAction
newPortProbeAction =
PortProbeAction' :: Maybe [PortProbeDetail] -> Maybe Bool -> PortProbeAction
PortProbeAction'
{ $sel:portProbeDetails:PortProbeAction' :: Maybe [PortProbeDetail]
portProbeDetails =
Maybe [PortProbeDetail]
forall a. Maybe a
Prelude.Nothing,
$sel:blocked:PortProbeAction' :: Maybe Bool
blocked = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
portProbeAction_portProbeDetails :: Lens.Lens' PortProbeAction (Prelude.Maybe [PortProbeDetail])
portProbeAction_portProbeDetails :: (Maybe [PortProbeDetail] -> f (Maybe [PortProbeDetail]))
-> PortProbeAction -> f PortProbeAction
portProbeAction_portProbeDetails = (PortProbeAction -> Maybe [PortProbeDetail])
-> (PortProbeAction -> Maybe [PortProbeDetail] -> PortProbeAction)
-> Lens
PortProbeAction
PortProbeAction
(Maybe [PortProbeDetail])
(Maybe [PortProbeDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortProbeAction' {Maybe [PortProbeDetail]
portProbeDetails :: Maybe [PortProbeDetail]
$sel:portProbeDetails:PortProbeAction' :: PortProbeAction -> Maybe [PortProbeDetail]
portProbeDetails} -> Maybe [PortProbeDetail]
portProbeDetails) (\s :: PortProbeAction
s@PortProbeAction' {} Maybe [PortProbeDetail]
a -> PortProbeAction
s {$sel:portProbeDetails:PortProbeAction' :: Maybe [PortProbeDetail]
portProbeDetails = Maybe [PortProbeDetail]
a} :: PortProbeAction) ((Maybe [PortProbeDetail] -> f (Maybe [PortProbeDetail]))
-> PortProbeAction -> f PortProbeAction)
-> ((Maybe [PortProbeDetail] -> f (Maybe [PortProbeDetail]))
-> Maybe [PortProbeDetail] -> f (Maybe [PortProbeDetail]))
-> (Maybe [PortProbeDetail] -> f (Maybe [PortProbeDetail]))
-> PortProbeAction
-> f PortProbeAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PortProbeDetail]
[PortProbeDetail]
[PortProbeDetail]
[PortProbeDetail]
-> Iso
(Maybe [PortProbeDetail])
(Maybe [PortProbeDetail])
(Maybe [PortProbeDetail])
(Maybe [PortProbeDetail])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[PortProbeDetail]
[PortProbeDetail]
[PortProbeDetail]
[PortProbeDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
portProbeAction_blocked :: Lens.Lens' PortProbeAction (Prelude.Maybe Prelude.Bool)
portProbeAction_blocked :: (Maybe Bool -> f (Maybe Bool))
-> PortProbeAction -> f PortProbeAction
portProbeAction_blocked = (PortProbeAction -> Maybe Bool)
-> (PortProbeAction -> Maybe Bool -> PortProbeAction)
-> Lens PortProbeAction PortProbeAction (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortProbeAction' {Maybe Bool
blocked :: Maybe Bool
$sel:blocked:PortProbeAction' :: PortProbeAction -> Maybe Bool
blocked} -> Maybe Bool
blocked) (\s :: PortProbeAction
s@PortProbeAction' {} Maybe Bool
a -> PortProbeAction
s {$sel:blocked:PortProbeAction' :: Maybe Bool
blocked = Maybe Bool
a} :: PortProbeAction)
instance Core.FromJSON PortProbeAction where
parseJSON :: Value -> Parser PortProbeAction
parseJSON =
String
-> (Object -> Parser PortProbeAction)
-> Value
-> Parser PortProbeAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PortProbeAction"
( \Object
x ->
Maybe [PortProbeDetail] -> Maybe Bool -> PortProbeAction
PortProbeAction'
(Maybe [PortProbeDetail] -> Maybe Bool -> PortProbeAction)
-> Parser (Maybe [PortProbeDetail])
-> Parser (Maybe Bool -> PortProbeAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [PortProbeDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PortProbeDetails"
Parser (Maybe (Maybe [PortProbeDetail]))
-> Maybe [PortProbeDetail] -> Parser (Maybe [PortProbeDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PortProbeDetail]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Bool -> PortProbeAction)
-> Parser (Maybe Bool) -> Parser PortProbeAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Blocked")
)
instance Prelude.Hashable PortProbeAction
instance Prelude.NFData PortProbeAction
instance Core.ToJSON PortProbeAction where
toJSON :: PortProbeAction -> Value
toJSON PortProbeAction' {Maybe Bool
Maybe [PortProbeDetail]
blocked :: Maybe Bool
portProbeDetails :: Maybe [PortProbeDetail]
$sel:blocked:PortProbeAction' :: PortProbeAction -> Maybe Bool
$sel:portProbeDetails:PortProbeAction' :: PortProbeAction -> Maybe [PortProbeDetail]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PortProbeDetails" Text -> [PortProbeDetail] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PortProbeDetail] -> Pair)
-> Maybe [PortProbeDetail] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PortProbeDetail]
portProbeDetails,
(Text
"Blocked" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
blocked
]
)