{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GuardDuty.Types.PortProbeAction
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GuardDuty.Types.PortProbeAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types.PortProbeDetail
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the PORT_PROBE action described in the
-- finding.
--
-- /See:/ 'newPortProbeAction' smart constructor.
data PortProbeAction = PortProbeAction'
  { -- | Indicates whether EC2 blocked the port probe to the instance, such as
    -- with an ACL.
    PortProbeAction -> Maybe Bool
blocked :: Prelude.Maybe Prelude.Bool,
    -- | A list of objects related to port probe details.
    PortProbeAction -> Maybe [PortProbeDetail]
portProbeDetails :: Prelude.Maybe [PortProbeDetail]
  }
  deriving (PortProbeAction -> PortProbeAction -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'PortProbeAction' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'blocked', 'portProbeAction_blocked' - Indicates whether EC2 blocked the port probe to the instance, such as
-- with an ACL.
--
-- 'portProbeDetails', 'portProbeAction_portProbeDetails' - A list of objects related to port probe details.
newPortProbeAction ::
  PortProbeAction
newPortProbeAction :: PortProbeAction
newPortProbeAction =
  PortProbeAction'
    { $sel:blocked:PortProbeAction' :: Maybe Bool
blocked = forall a. Maybe a
Prelude.Nothing,
      $sel:portProbeDetails:PortProbeAction' :: Maybe [PortProbeDetail]
portProbeDetails = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether EC2 blocked the port probe to the instance, such as
-- with an ACL.
portProbeAction_blocked :: Lens.Lens' PortProbeAction (Prelude.Maybe Prelude.Bool)
portProbeAction_blocked :: Lens' PortProbeAction (Maybe Bool)
portProbeAction_blocked = 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)

-- | A list of objects related to port probe details.
portProbeAction_portProbeDetails :: Lens.Lens' PortProbeAction (Prelude.Maybe [PortProbeDetail])
portProbeAction_portProbeDetails :: Lens' PortProbeAction (Maybe [PortProbeDetail])
portProbeAction_portProbeDetails = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON PortProbeAction where
  parseJSON :: Value -> Parser PortProbeAction
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PortProbeAction"
      ( \Object
x ->
          Maybe Bool -> Maybe [PortProbeDetail] -> PortProbeAction
PortProbeAction'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"blocked")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"portProbeDetails"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable PortProbeAction where
  hashWithSalt :: Int -> PortProbeAction -> Int
hashWithSalt Int
_salt PortProbeAction' {Maybe Bool
Maybe [PortProbeDetail]
portProbeDetails :: Maybe [PortProbeDetail]
blocked :: Maybe Bool
$sel:portProbeDetails:PortProbeAction' :: PortProbeAction -> Maybe [PortProbeDetail]
$sel:blocked:PortProbeAction' :: PortProbeAction -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
blocked
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PortProbeDetail]
portProbeDetails

instance Prelude.NFData PortProbeAction where
  rnf :: PortProbeAction -> ()
rnf PortProbeAction' {Maybe Bool
Maybe [PortProbeDetail]
portProbeDetails :: Maybe [PortProbeDetail]
blocked :: Maybe Bool
$sel:portProbeDetails:PortProbeAction' :: PortProbeAction -> Maybe [PortProbeDetail]
$sel:blocked:PortProbeAction' :: PortProbeAction -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
blocked
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PortProbeDetail]
portProbeDetails