{-# 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.Inspector2.Types.SeverityCounts
-- 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.Inspector2.Types.SeverityCounts where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An object that contains the counts of aggregated finding per severity.
--
-- /See:/ 'newSeverityCounts' smart constructor.
data SeverityCounts = SeverityCounts'
  { -- | The total count of findings from all severities.
    SeverityCounts -> Maybe Integer
all :: Prelude.Maybe Prelude.Integer,
    -- | The total count of critical severity findings.
    SeverityCounts -> Maybe Integer
critical :: Prelude.Maybe Prelude.Integer,
    -- | The total count of high severity findings.
    SeverityCounts -> Maybe Integer
high :: Prelude.Maybe Prelude.Integer,
    -- | The total count of medium severity findings.
    SeverityCounts -> Maybe Integer
medium :: Prelude.Maybe Prelude.Integer
  }
  deriving (SeverityCounts -> SeverityCounts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SeverityCounts -> SeverityCounts -> Bool
$c/= :: SeverityCounts -> SeverityCounts -> Bool
== :: SeverityCounts -> SeverityCounts -> Bool
$c== :: SeverityCounts -> SeverityCounts -> Bool
Prelude.Eq, ReadPrec [SeverityCounts]
ReadPrec SeverityCounts
Int -> ReadS SeverityCounts
ReadS [SeverityCounts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SeverityCounts]
$creadListPrec :: ReadPrec [SeverityCounts]
readPrec :: ReadPrec SeverityCounts
$creadPrec :: ReadPrec SeverityCounts
readList :: ReadS [SeverityCounts]
$creadList :: ReadS [SeverityCounts]
readsPrec :: Int -> ReadS SeverityCounts
$creadsPrec :: Int -> ReadS SeverityCounts
Prelude.Read, Int -> SeverityCounts -> ShowS
[SeverityCounts] -> ShowS
SeverityCounts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SeverityCounts] -> ShowS
$cshowList :: [SeverityCounts] -> ShowS
show :: SeverityCounts -> String
$cshow :: SeverityCounts -> String
showsPrec :: Int -> SeverityCounts -> ShowS
$cshowsPrec :: Int -> SeverityCounts -> ShowS
Prelude.Show, forall x. Rep SeverityCounts x -> SeverityCounts
forall x. SeverityCounts -> Rep SeverityCounts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SeverityCounts x -> SeverityCounts
$cfrom :: forall x. SeverityCounts -> Rep SeverityCounts x
Prelude.Generic)

-- |
-- Create a value of 'SeverityCounts' 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:
--
-- 'all', 'severityCounts_all' - The total count of findings from all severities.
--
-- 'critical', 'severityCounts_critical' - The total count of critical severity findings.
--
-- 'high', 'severityCounts_high' - The total count of high severity findings.
--
-- 'medium', 'severityCounts_medium' - The total count of medium severity findings.
newSeverityCounts ::
  SeverityCounts
newSeverityCounts :: SeverityCounts
newSeverityCounts =
  SeverityCounts'
    { $sel:all:SeverityCounts' :: Maybe Integer
all = forall a. Maybe a
Prelude.Nothing,
      $sel:critical:SeverityCounts' :: Maybe Integer
critical = forall a. Maybe a
Prelude.Nothing,
      $sel:high:SeverityCounts' :: Maybe Integer
high = forall a. Maybe a
Prelude.Nothing,
      $sel:medium:SeverityCounts' :: Maybe Integer
medium = forall a. Maybe a
Prelude.Nothing
    }

-- | The total count of findings from all severities.
severityCounts_all :: Lens.Lens' SeverityCounts (Prelude.Maybe Prelude.Integer)
severityCounts_all :: Lens' SeverityCounts (Maybe Integer)
severityCounts_all = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SeverityCounts' {Maybe Integer
all :: Maybe Integer
$sel:all:SeverityCounts' :: SeverityCounts -> Maybe Integer
all} -> Maybe Integer
all) (\s :: SeverityCounts
s@SeverityCounts' {} Maybe Integer
a -> SeverityCounts
s {$sel:all:SeverityCounts' :: Maybe Integer
all = Maybe Integer
a} :: SeverityCounts)

-- | The total count of critical severity findings.
severityCounts_critical :: Lens.Lens' SeverityCounts (Prelude.Maybe Prelude.Integer)
severityCounts_critical :: Lens' SeverityCounts (Maybe Integer)
severityCounts_critical = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SeverityCounts' {Maybe Integer
critical :: Maybe Integer
$sel:critical:SeverityCounts' :: SeverityCounts -> Maybe Integer
critical} -> Maybe Integer
critical) (\s :: SeverityCounts
s@SeverityCounts' {} Maybe Integer
a -> SeverityCounts
s {$sel:critical:SeverityCounts' :: Maybe Integer
critical = Maybe Integer
a} :: SeverityCounts)

-- | The total count of high severity findings.
severityCounts_high :: Lens.Lens' SeverityCounts (Prelude.Maybe Prelude.Integer)
severityCounts_high :: Lens' SeverityCounts (Maybe Integer)
severityCounts_high = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SeverityCounts' {Maybe Integer
high :: Maybe Integer
$sel:high:SeverityCounts' :: SeverityCounts -> Maybe Integer
high} -> Maybe Integer
high) (\s :: SeverityCounts
s@SeverityCounts' {} Maybe Integer
a -> SeverityCounts
s {$sel:high:SeverityCounts' :: Maybe Integer
high = Maybe Integer
a} :: SeverityCounts)

-- | The total count of medium severity findings.
severityCounts_medium :: Lens.Lens' SeverityCounts (Prelude.Maybe Prelude.Integer)
severityCounts_medium :: Lens' SeverityCounts (Maybe Integer)
severityCounts_medium = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SeverityCounts' {Maybe Integer
medium :: Maybe Integer
$sel:medium:SeverityCounts' :: SeverityCounts -> Maybe Integer
medium} -> Maybe Integer
medium) (\s :: SeverityCounts
s@SeverityCounts' {} Maybe Integer
a -> SeverityCounts
s {$sel:medium:SeverityCounts' :: Maybe Integer
medium = Maybe Integer
a} :: SeverityCounts)

instance Data.FromJSON SeverityCounts where
  parseJSON :: Value -> Parser SeverityCounts
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SeverityCounts"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> SeverityCounts
SeverityCounts'
            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
"all")
            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
"critical")
            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
"high")
            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
"medium")
      )

instance Prelude.Hashable SeverityCounts where
  hashWithSalt :: Int -> SeverityCounts -> Int
hashWithSalt Int
_salt SeverityCounts' {Maybe Integer
medium :: Maybe Integer
high :: Maybe Integer
critical :: Maybe Integer
all :: Maybe Integer
$sel:medium:SeverityCounts' :: SeverityCounts -> Maybe Integer
$sel:high:SeverityCounts' :: SeverityCounts -> Maybe Integer
$sel:critical:SeverityCounts' :: SeverityCounts -> Maybe Integer
$sel:all:SeverityCounts' :: SeverityCounts -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
all
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
critical
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
high
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
medium

instance Prelude.NFData SeverityCounts where
  rnf :: SeverityCounts -> ()
rnf SeverityCounts' {Maybe Integer
medium :: Maybe Integer
high :: Maybe Integer
critical :: Maybe Integer
all :: Maybe Integer
$sel:medium:SeverityCounts' :: SeverityCounts -> Maybe Integer
$sel:high:SeverityCounts' :: SeverityCounts -> Maybe Integer
$sel:critical:SeverityCounts' :: SeverityCounts -> Maybe Integer
$sel:all:SeverityCounts' :: SeverityCounts -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
all
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
critical
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
high
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
medium