{-# 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.ScanDetections
-- 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.ScanDetections 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.HighestSeverityThreatDetails
import Amazonka.GuardDuty.Types.ScannedItemCount
import Amazonka.GuardDuty.Types.ThreatDetectedByName
import Amazonka.GuardDuty.Types.ThreatsDetectedItemCount
import qualified Amazonka.Prelude as Prelude

-- | Contains a complete view providing malware scan result details.
--
-- /See:/ 'newScanDetections' smart constructor.
data ScanDetections = ScanDetections'
  { -- | Details of the highest severity threat detected during malware scan and
    -- number of infected files.
    ScanDetections -> Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails :: Prelude.Maybe HighestSeverityThreatDetails,
    -- | Total number of scanned files.
    ScanDetections -> Maybe ScannedItemCount
scannedItemCount :: Prelude.Maybe ScannedItemCount,
    -- | Contains details about identified threats organized by threat name.
    ScanDetections -> Maybe ThreatDetectedByName
threatDetectedByName :: Prelude.Maybe ThreatDetectedByName,
    -- | Total number of infected files.
    ScanDetections -> Maybe ThreatsDetectedItemCount
threatsDetectedItemCount :: Prelude.Maybe ThreatsDetectedItemCount
  }
  deriving (ScanDetections -> ScanDetections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScanDetections -> ScanDetections -> Bool
$c/= :: ScanDetections -> ScanDetections -> Bool
== :: ScanDetections -> ScanDetections -> Bool
$c== :: ScanDetections -> ScanDetections -> Bool
Prelude.Eq, ReadPrec [ScanDetections]
ReadPrec ScanDetections
Int -> ReadS ScanDetections
ReadS [ScanDetections]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScanDetections]
$creadListPrec :: ReadPrec [ScanDetections]
readPrec :: ReadPrec ScanDetections
$creadPrec :: ReadPrec ScanDetections
readList :: ReadS [ScanDetections]
$creadList :: ReadS [ScanDetections]
readsPrec :: Int -> ReadS ScanDetections
$creadsPrec :: Int -> ReadS ScanDetections
Prelude.Read, Int -> ScanDetections -> ShowS
[ScanDetections] -> ShowS
ScanDetections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScanDetections] -> ShowS
$cshowList :: [ScanDetections] -> ShowS
show :: ScanDetections -> String
$cshow :: ScanDetections -> String
showsPrec :: Int -> ScanDetections -> ShowS
$cshowsPrec :: Int -> ScanDetections -> ShowS
Prelude.Show, forall x. Rep ScanDetections x -> ScanDetections
forall x. ScanDetections -> Rep ScanDetections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScanDetections x -> ScanDetections
$cfrom :: forall x. ScanDetections -> Rep ScanDetections x
Prelude.Generic)

-- |
-- Create a value of 'ScanDetections' 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:
--
-- 'highestSeverityThreatDetails', 'scanDetections_highestSeverityThreatDetails' - Details of the highest severity threat detected during malware scan and
-- number of infected files.
--
-- 'scannedItemCount', 'scanDetections_scannedItemCount' - Total number of scanned files.
--
-- 'threatDetectedByName', 'scanDetections_threatDetectedByName' - Contains details about identified threats organized by threat name.
--
-- 'threatsDetectedItemCount', 'scanDetections_threatsDetectedItemCount' - Total number of infected files.
newScanDetections ::
  ScanDetections
newScanDetections :: ScanDetections
newScanDetections =
  ScanDetections'
    { $sel:highestSeverityThreatDetails:ScanDetections' :: Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scannedItemCount:ScanDetections' :: Maybe ScannedItemCount
scannedItemCount = forall a. Maybe a
Prelude.Nothing,
      $sel:threatDetectedByName:ScanDetections' :: Maybe ThreatDetectedByName
threatDetectedByName = forall a. Maybe a
Prelude.Nothing,
      $sel:threatsDetectedItemCount:ScanDetections' :: Maybe ThreatsDetectedItemCount
threatsDetectedItemCount = forall a. Maybe a
Prelude.Nothing
    }

-- | Details of the highest severity threat detected during malware scan and
-- number of infected files.
scanDetections_highestSeverityThreatDetails :: Lens.Lens' ScanDetections (Prelude.Maybe HighestSeverityThreatDetails)
scanDetections_highestSeverityThreatDetails :: Lens' ScanDetections (Maybe HighestSeverityThreatDetails)
scanDetections_highestSeverityThreatDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScanDetections' {Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails :: Maybe HighestSeverityThreatDetails
$sel:highestSeverityThreatDetails:ScanDetections' :: ScanDetections -> Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails} -> Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails) (\s :: ScanDetections
s@ScanDetections' {} Maybe HighestSeverityThreatDetails
a -> ScanDetections
s {$sel:highestSeverityThreatDetails:ScanDetections' :: Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails = Maybe HighestSeverityThreatDetails
a} :: ScanDetections)

-- | Total number of scanned files.
scanDetections_scannedItemCount :: Lens.Lens' ScanDetections (Prelude.Maybe ScannedItemCount)
scanDetections_scannedItemCount :: Lens' ScanDetections (Maybe ScannedItemCount)
scanDetections_scannedItemCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScanDetections' {Maybe ScannedItemCount
scannedItemCount :: Maybe ScannedItemCount
$sel:scannedItemCount:ScanDetections' :: ScanDetections -> Maybe ScannedItemCount
scannedItemCount} -> Maybe ScannedItemCount
scannedItemCount) (\s :: ScanDetections
s@ScanDetections' {} Maybe ScannedItemCount
a -> ScanDetections
s {$sel:scannedItemCount:ScanDetections' :: Maybe ScannedItemCount
scannedItemCount = Maybe ScannedItemCount
a} :: ScanDetections)

-- | Contains details about identified threats organized by threat name.
scanDetections_threatDetectedByName :: Lens.Lens' ScanDetections (Prelude.Maybe ThreatDetectedByName)
scanDetections_threatDetectedByName :: Lens' ScanDetections (Maybe ThreatDetectedByName)
scanDetections_threatDetectedByName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScanDetections' {Maybe ThreatDetectedByName
threatDetectedByName :: Maybe ThreatDetectedByName
$sel:threatDetectedByName:ScanDetections' :: ScanDetections -> Maybe ThreatDetectedByName
threatDetectedByName} -> Maybe ThreatDetectedByName
threatDetectedByName) (\s :: ScanDetections
s@ScanDetections' {} Maybe ThreatDetectedByName
a -> ScanDetections
s {$sel:threatDetectedByName:ScanDetections' :: Maybe ThreatDetectedByName
threatDetectedByName = Maybe ThreatDetectedByName
a} :: ScanDetections)

-- | Total number of infected files.
scanDetections_threatsDetectedItemCount :: Lens.Lens' ScanDetections (Prelude.Maybe ThreatsDetectedItemCount)
scanDetections_threatsDetectedItemCount :: Lens' ScanDetections (Maybe ThreatsDetectedItemCount)
scanDetections_threatsDetectedItemCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScanDetections' {Maybe ThreatsDetectedItemCount
threatsDetectedItemCount :: Maybe ThreatsDetectedItemCount
$sel:threatsDetectedItemCount:ScanDetections' :: ScanDetections -> Maybe ThreatsDetectedItemCount
threatsDetectedItemCount} -> Maybe ThreatsDetectedItemCount
threatsDetectedItemCount) (\s :: ScanDetections
s@ScanDetections' {} Maybe ThreatsDetectedItemCount
a -> ScanDetections
s {$sel:threatsDetectedItemCount:ScanDetections' :: Maybe ThreatsDetectedItemCount
threatsDetectedItemCount = Maybe ThreatsDetectedItemCount
a} :: ScanDetections)

instance Data.FromJSON ScanDetections where
  parseJSON :: Value -> Parser ScanDetections
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScanDetections"
      ( \Object
x ->
          Maybe HighestSeverityThreatDetails
-> Maybe ScannedItemCount
-> Maybe ThreatDetectedByName
-> Maybe ThreatsDetectedItemCount
-> ScanDetections
ScanDetections'
            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
"highestSeverityThreatDetails")
            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
"scannedItemCount")
            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
"threatDetectedByName")
            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
"threatsDetectedItemCount")
      )

instance Prelude.Hashable ScanDetections where
  hashWithSalt :: Int -> ScanDetections -> Int
hashWithSalt Int
_salt ScanDetections' {Maybe HighestSeverityThreatDetails
Maybe ScannedItemCount
Maybe ThreatDetectedByName
Maybe ThreatsDetectedItemCount
threatsDetectedItemCount :: Maybe ThreatsDetectedItemCount
threatDetectedByName :: Maybe ThreatDetectedByName
scannedItemCount :: Maybe ScannedItemCount
highestSeverityThreatDetails :: Maybe HighestSeverityThreatDetails
$sel:threatsDetectedItemCount:ScanDetections' :: ScanDetections -> Maybe ThreatsDetectedItemCount
$sel:threatDetectedByName:ScanDetections' :: ScanDetections -> Maybe ThreatDetectedByName
$sel:scannedItemCount:ScanDetections' :: ScanDetections -> Maybe ScannedItemCount
$sel:highestSeverityThreatDetails:ScanDetections' :: ScanDetections -> Maybe HighestSeverityThreatDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScannedItemCount
scannedItemCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThreatDetectedByName
threatDetectedByName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ThreatsDetectedItemCount
threatsDetectedItemCount

instance Prelude.NFData ScanDetections where
  rnf :: ScanDetections -> ()
rnf ScanDetections' {Maybe HighestSeverityThreatDetails
Maybe ScannedItemCount
Maybe ThreatDetectedByName
Maybe ThreatsDetectedItemCount
threatsDetectedItemCount :: Maybe ThreatsDetectedItemCount
threatDetectedByName :: Maybe ThreatDetectedByName
scannedItemCount :: Maybe ScannedItemCount
highestSeverityThreatDetails :: Maybe HighestSeverityThreatDetails
$sel:threatsDetectedItemCount:ScanDetections' :: ScanDetections -> Maybe ThreatsDetectedItemCount
$sel:threatDetectedByName:ScanDetections' :: ScanDetections -> Maybe ThreatDetectedByName
$sel:scannedItemCount:ScanDetections' :: ScanDetections -> Maybe ScannedItemCount
$sel:highestSeverityThreatDetails:ScanDetections' :: ScanDetections -> Maybe HighestSeverityThreatDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HighestSeverityThreatDetails
highestSeverityThreatDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScannedItemCount
scannedItemCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThreatDetectedByName
threatDetectedByName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ThreatsDetectedItemCount
threatsDetectedItemCount