{-# 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.TitleAggregationResponse
-- 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.TitleAggregationResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.SeverityCounts
import qualified Amazonka.Prelude as Prelude

-- | A response that contains details on the results of a finding aggregation
-- by title.
--
-- /See:/ 'newTitleAggregationResponse' smart constructor.
data TitleAggregationResponse = TitleAggregationResponse'
  { -- | The ID of the Amazon Web Services account associated with the findings.
    TitleAggregationResponse -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | An object that represent the count of matched findings per severity.
    TitleAggregationResponse -> Maybe SeverityCounts
severityCounts :: Prelude.Maybe SeverityCounts,
    -- | The vulnerability ID of the finding.
    TitleAggregationResponse -> Maybe Text
vulnerabilityId :: Prelude.Maybe Prelude.Text,
    -- | The title that the findings were aggregated on.
    TitleAggregationResponse -> Text
title :: Prelude.Text
  }
  deriving (TitleAggregationResponse -> TitleAggregationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TitleAggregationResponse -> TitleAggregationResponse -> Bool
$c/= :: TitleAggregationResponse -> TitleAggregationResponse -> Bool
== :: TitleAggregationResponse -> TitleAggregationResponse -> Bool
$c== :: TitleAggregationResponse -> TitleAggregationResponse -> Bool
Prelude.Eq, ReadPrec [TitleAggregationResponse]
ReadPrec TitleAggregationResponse
Int -> ReadS TitleAggregationResponse
ReadS [TitleAggregationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TitleAggregationResponse]
$creadListPrec :: ReadPrec [TitleAggregationResponse]
readPrec :: ReadPrec TitleAggregationResponse
$creadPrec :: ReadPrec TitleAggregationResponse
readList :: ReadS [TitleAggregationResponse]
$creadList :: ReadS [TitleAggregationResponse]
readsPrec :: Int -> ReadS TitleAggregationResponse
$creadsPrec :: Int -> ReadS TitleAggregationResponse
Prelude.Read, Int -> TitleAggregationResponse -> ShowS
[TitleAggregationResponse] -> ShowS
TitleAggregationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TitleAggregationResponse] -> ShowS
$cshowList :: [TitleAggregationResponse] -> ShowS
show :: TitleAggregationResponse -> String
$cshow :: TitleAggregationResponse -> String
showsPrec :: Int -> TitleAggregationResponse -> ShowS
$cshowsPrec :: Int -> TitleAggregationResponse -> ShowS
Prelude.Show, forall x.
Rep TitleAggregationResponse x -> TitleAggregationResponse
forall x.
TitleAggregationResponse -> Rep TitleAggregationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TitleAggregationResponse x -> TitleAggregationResponse
$cfrom :: forall x.
TitleAggregationResponse -> Rep TitleAggregationResponse x
Prelude.Generic)

-- |
-- Create a value of 'TitleAggregationResponse' 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:
--
-- 'accountId', 'titleAggregationResponse_accountId' - The ID of the Amazon Web Services account associated with the findings.
--
-- 'severityCounts', 'titleAggregationResponse_severityCounts' - An object that represent the count of matched findings per severity.
--
-- 'vulnerabilityId', 'titleAggregationResponse_vulnerabilityId' - The vulnerability ID of the finding.
--
-- 'title', 'titleAggregationResponse_title' - The title that the findings were aggregated on.
newTitleAggregationResponse ::
  -- | 'title'
  Prelude.Text ->
  TitleAggregationResponse
newTitleAggregationResponse :: Text -> TitleAggregationResponse
newTitleAggregationResponse Text
pTitle_ =
  TitleAggregationResponse'
    { $sel:accountId:TitleAggregationResponse' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:severityCounts:TitleAggregationResponse' :: Maybe SeverityCounts
severityCounts = forall a. Maybe a
Prelude.Nothing,
      $sel:vulnerabilityId:TitleAggregationResponse' :: Maybe Text
vulnerabilityId = forall a. Maybe a
Prelude.Nothing,
      $sel:title:TitleAggregationResponse' :: Text
title = Text
pTitle_
    }

-- | The ID of the Amazon Web Services account associated with the findings.
titleAggregationResponse_accountId :: Lens.Lens' TitleAggregationResponse (Prelude.Maybe Prelude.Text)
titleAggregationResponse_accountId :: Lens' TitleAggregationResponse (Maybe Text)
titleAggregationResponse_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TitleAggregationResponse' {Maybe Text
accountId :: Maybe Text
$sel:accountId:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: TitleAggregationResponse
s@TitleAggregationResponse' {} Maybe Text
a -> TitleAggregationResponse
s {$sel:accountId:TitleAggregationResponse' :: Maybe Text
accountId = Maybe Text
a} :: TitleAggregationResponse)

-- | An object that represent the count of matched findings per severity.
titleAggregationResponse_severityCounts :: Lens.Lens' TitleAggregationResponse (Prelude.Maybe SeverityCounts)
titleAggregationResponse_severityCounts :: Lens' TitleAggregationResponse (Maybe SeverityCounts)
titleAggregationResponse_severityCounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TitleAggregationResponse' {Maybe SeverityCounts
severityCounts :: Maybe SeverityCounts
$sel:severityCounts:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe SeverityCounts
severityCounts} -> Maybe SeverityCounts
severityCounts) (\s :: TitleAggregationResponse
s@TitleAggregationResponse' {} Maybe SeverityCounts
a -> TitleAggregationResponse
s {$sel:severityCounts:TitleAggregationResponse' :: Maybe SeverityCounts
severityCounts = Maybe SeverityCounts
a} :: TitleAggregationResponse)

-- | The vulnerability ID of the finding.
titleAggregationResponse_vulnerabilityId :: Lens.Lens' TitleAggregationResponse (Prelude.Maybe Prelude.Text)
titleAggregationResponse_vulnerabilityId :: Lens' TitleAggregationResponse (Maybe Text)
titleAggregationResponse_vulnerabilityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TitleAggregationResponse' {Maybe Text
vulnerabilityId :: Maybe Text
$sel:vulnerabilityId:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe Text
vulnerabilityId} -> Maybe Text
vulnerabilityId) (\s :: TitleAggregationResponse
s@TitleAggregationResponse' {} Maybe Text
a -> TitleAggregationResponse
s {$sel:vulnerabilityId:TitleAggregationResponse' :: Maybe Text
vulnerabilityId = Maybe Text
a} :: TitleAggregationResponse)

-- | The title that the findings were aggregated on.
titleAggregationResponse_title :: Lens.Lens' TitleAggregationResponse Prelude.Text
titleAggregationResponse_title :: Lens' TitleAggregationResponse Text
titleAggregationResponse_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TitleAggregationResponse' {Text
title :: Text
$sel:title:TitleAggregationResponse' :: TitleAggregationResponse -> Text
title} -> Text
title) (\s :: TitleAggregationResponse
s@TitleAggregationResponse' {} Text
a -> TitleAggregationResponse
s {$sel:title:TitleAggregationResponse' :: Text
title = Text
a} :: TitleAggregationResponse)

instance Data.FromJSON TitleAggregationResponse where
  parseJSON :: Value -> Parser TitleAggregationResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TitleAggregationResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe SeverityCounts
-> Maybe Text
-> Text
-> TitleAggregationResponse
TitleAggregationResponse'
            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
"accountId")
            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
"severityCounts")
            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
"vulnerabilityId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"title")
      )

instance Prelude.Hashable TitleAggregationResponse where
  hashWithSalt :: Int -> TitleAggregationResponse -> Int
hashWithSalt Int
_salt TitleAggregationResponse' {Maybe Text
Maybe SeverityCounts
Text
title :: Text
vulnerabilityId :: Maybe Text
severityCounts :: Maybe SeverityCounts
accountId :: Maybe Text
$sel:title:TitleAggregationResponse' :: TitleAggregationResponse -> Text
$sel:vulnerabilityId:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe Text
$sel:severityCounts:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe SeverityCounts
$sel:accountId:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SeverityCounts
severityCounts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vulnerabilityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title

instance Prelude.NFData TitleAggregationResponse where
  rnf :: TitleAggregationResponse -> ()
rnf TitleAggregationResponse' {Maybe Text
Maybe SeverityCounts
Text
title :: Text
vulnerabilityId :: Maybe Text
severityCounts :: Maybe SeverityCounts
accountId :: Maybe Text
$sel:title:TitleAggregationResponse' :: TitleAggregationResponse -> Text
$sel:vulnerabilityId:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe Text
$sel:severityCounts:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe SeverityCounts
$sel:accountId:TitleAggregationResponse' :: TitleAggregationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SeverityCounts
severityCounts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vulnerabilityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title