{-# 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.ThreatDetectedByName
-- 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.ThreatDetectedByName 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.ScanThreatName
import qualified Amazonka.Prelude as Prelude

-- | Contains details about identified threats organized by threat name.
--
-- /See:/ 'newThreatDetectedByName' smart constructor.
data ThreatDetectedByName = ThreatDetectedByName'
  { -- | Total number of infected files identified.
    ThreatDetectedByName -> Maybe Int
itemCount :: Prelude.Maybe Prelude.Int,
    -- | Flag to determine if the finding contains every single infected
    -- file-path and\/or every threat.
    ThreatDetectedByName -> Maybe Bool
shortened :: Prelude.Maybe Prelude.Bool,
    -- | List of identified threats with details, organized by threat name.
    ThreatDetectedByName -> Maybe [ScanThreatName]
threatNames :: Prelude.Maybe [ScanThreatName],
    -- | Total number of unique threats by name identified, as part of the
    -- malware scan.
    ThreatDetectedByName -> Maybe Int
uniqueThreatNameCount :: Prelude.Maybe Prelude.Int
  }
  deriving (ThreatDetectedByName -> ThreatDetectedByName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ThreatDetectedByName -> ThreatDetectedByName -> Bool
$c/= :: ThreatDetectedByName -> ThreatDetectedByName -> Bool
== :: ThreatDetectedByName -> ThreatDetectedByName -> Bool
$c== :: ThreatDetectedByName -> ThreatDetectedByName -> Bool
Prelude.Eq, ReadPrec [ThreatDetectedByName]
ReadPrec ThreatDetectedByName
Int -> ReadS ThreatDetectedByName
ReadS [ThreatDetectedByName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ThreatDetectedByName]
$creadListPrec :: ReadPrec [ThreatDetectedByName]
readPrec :: ReadPrec ThreatDetectedByName
$creadPrec :: ReadPrec ThreatDetectedByName
readList :: ReadS [ThreatDetectedByName]
$creadList :: ReadS [ThreatDetectedByName]
readsPrec :: Int -> ReadS ThreatDetectedByName
$creadsPrec :: Int -> ReadS ThreatDetectedByName
Prelude.Read, Int -> ThreatDetectedByName -> ShowS
[ThreatDetectedByName] -> ShowS
ThreatDetectedByName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ThreatDetectedByName] -> ShowS
$cshowList :: [ThreatDetectedByName] -> ShowS
show :: ThreatDetectedByName -> String
$cshow :: ThreatDetectedByName -> String
showsPrec :: Int -> ThreatDetectedByName -> ShowS
$cshowsPrec :: Int -> ThreatDetectedByName -> ShowS
Prelude.Show, forall x. Rep ThreatDetectedByName x -> ThreatDetectedByName
forall x. ThreatDetectedByName -> Rep ThreatDetectedByName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ThreatDetectedByName x -> ThreatDetectedByName
$cfrom :: forall x. ThreatDetectedByName -> Rep ThreatDetectedByName x
Prelude.Generic)

-- |
-- Create a value of 'ThreatDetectedByName' 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:
--
-- 'itemCount', 'threatDetectedByName_itemCount' - Total number of infected files identified.
--
-- 'shortened', 'threatDetectedByName_shortened' - Flag to determine if the finding contains every single infected
-- file-path and\/or every threat.
--
-- 'threatNames', 'threatDetectedByName_threatNames' - List of identified threats with details, organized by threat name.
--
-- 'uniqueThreatNameCount', 'threatDetectedByName_uniqueThreatNameCount' - Total number of unique threats by name identified, as part of the
-- malware scan.
newThreatDetectedByName ::
  ThreatDetectedByName
newThreatDetectedByName :: ThreatDetectedByName
newThreatDetectedByName =
  ThreatDetectedByName'
    { $sel:itemCount:ThreatDetectedByName' :: Maybe Int
itemCount = forall a. Maybe a
Prelude.Nothing,
      $sel:shortened:ThreatDetectedByName' :: Maybe Bool
shortened = forall a. Maybe a
Prelude.Nothing,
      $sel:threatNames:ThreatDetectedByName' :: Maybe [ScanThreatName]
threatNames = forall a. Maybe a
Prelude.Nothing,
      $sel:uniqueThreatNameCount:ThreatDetectedByName' :: Maybe Int
uniqueThreatNameCount = forall a. Maybe a
Prelude.Nothing
    }

-- | Total number of infected files identified.
threatDetectedByName_itemCount :: Lens.Lens' ThreatDetectedByName (Prelude.Maybe Prelude.Int)
threatDetectedByName_itemCount :: Lens' ThreatDetectedByName (Maybe Int)
threatDetectedByName_itemCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThreatDetectedByName' {Maybe Int
itemCount :: Maybe Int
$sel:itemCount:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Int
itemCount} -> Maybe Int
itemCount) (\s :: ThreatDetectedByName
s@ThreatDetectedByName' {} Maybe Int
a -> ThreatDetectedByName
s {$sel:itemCount:ThreatDetectedByName' :: Maybe Int
itemCount = Maybe Int
a} :: ThreatDetectedByName)

-- | Flag to determine if the finding contains every single infected
-- file-path and\/or every threat.
threatDetectedByName_shortened :: Lens.Lens' ThreatDetectedByName (Prelude.Maybe Prelude.Bool)
threatDetectedByName_shortened :: Lens' ThreatDetectedByName (Maybe Bool)
threatDetectedByName_shortened = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThreatDetectedByName' {Maybe Bool
shortened :: Maybe Bool
$sel:shortened:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Bool
shortened} -> Maybe Bool
shortened) (\s :: ThreatDetectedByName
s@ThreatDetectedByName' {} Maybe Bool
a -> ThreatDetectedByName
s {$sel:shortened:ThreatDetectedByName' :: Maybe Bool
shortened = Maybe Bool
a} :: ThreatDetectedByName)

-- | List of identified threats with details, organized by threat name.
threatDetectedByName_threatNames :: Lens.Lens' ThreatDetectedByName (Prelude.Maybe [ScanThreatName])
threatDetectedByName_threatNames :: Lens' ThreatDetectedByName (Maybe [ScanThreatName])
threatDetectedByName_threatNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThreatDetectedByName' {Maybe [ScanThreatName]
threatNames :: Maybe [ScanThreatName]
$sel:threatNames:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe [ScanThreatName]
threatNames} -> Maybe [ScanThreatName]
threatNames) (\s :: ThreatDetectedByName
s@ThreatDetectedByName' {} Maybe [ScanThreatName]
a -> ThreatDetectedByName
s {$sel:threatNames:ThreatDetectedByName' :: Maybe [ScanThreatName]
threatNames = Maybe [ScanThreatName]
a} :: ThreatDetectedByName) 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

-- | Total number of unique threats by name identified, as part of the
-- malware scan.
threatDetectedByName_uniqueThreatNameCount :: Lens.Lens' ThreatDetectedByName (Prelude.Maybe Prelude.Int)
threatDetectedByName_uniqueThreatNameCount :: Lens' ThreatDetectedByName (Maybe Int)
threatDetectedByName_uniqueThreatNameCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ThreatDetectedByName' {Maybe Int
uniqueThreatNameCount :: Maybe Int
$sel:uniqueThreatNameCount:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Int
uniqueThreatNameCount} -> Maybe Int
uniqueThreatNameCount) (\s :: ThreatDetectedByName
s@ThreatDetectedByName' {} Maybe Int
a -> ThreatDetectedByName
s {$sel:uniqueThreatNameCount:ThreatDetectedByName' :: Maybe Int
uniqueThreatNameCount = Maybe Int
a} :: ThreatDetectedByName)

instance Data.FromJSON ThreatDetectedByName where
  parseJSON :: Value -> Parser ThreatDetectedByName
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ThreatDetectedByName"
      ( \Object
x ->
          Maybe Int
-> Maybe Bool
-> Maybe [ScanThreatName]
-> Maybe Int
-> ThreatDetectedByName
ThreatDetectedByName'
            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
"itemCount")
            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
"shortened")
            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
"threatNames" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"uniqueThreatNameCount")
      )

instance Prelude.Hashable ThreatDetectedByName where
  hashWithSalt :: Int -> ThreatDetectedByName -> Int
hashWithSalt Int
_salt ThreatDetectedByName' {Maybe Bool
Maybe Int
Maybe [ScanThreatName]
uniqueThreatNameCount :: Maybe Int
threatNames :: Maybe [ScanThreatName]
shortened :: Maybe Bool
itemCount :: Maybe Int
$sel:uniqueThreatNameCount:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Int
$sel:threatNames:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe [ScanThreatName]
$sel:shortened:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Bool
$sel:itemCount:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
itemCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
shortened
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ScanThreatName]
threatNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
uniqueThreatNameCount

instance Prelude.NFData ThreatDetectedByName where
  rnf :: ThreatDetectedByName -> ()
rnf ThreatDetectedByName' {Maybe Bool
Maybe Int
Maybe [ScanThreatName]
uniqueThreatNameCount :: Maybe Int
threatNames :: Maybe [ScanThreatName]
shortened :: Maybe Bool
itemCount :: Maybe Int
$sel:uniqueThreatNameCount:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Int
$sel:threatNames:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe [ScanThreatName]
$sel:shortened:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Bool
$sel:itemCount:ThreatDetectedByName' :: ThreatDetectedByName -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
itemCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
shortened
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ScanThreatName]
threatNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
uniqueThreatNameCount