{-# 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.AccountAggregationResponse
-- 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.AccountAggregationResponse 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

-- | An aggregation of findings by Amazon Web Services account ID.
--
-- /See:/ 'newAccountAggregationResponse' smart constructor.
data AccountAggregationResponse = AccountAggregationResponse'
  { -- | The Amazon Web Services account ID.
    AccountAggregationResponse -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The number of findings by severity.
    AccountAggregationResponse -> Maybe SeverityCounts
severityCounts :: Prelude.Maybe SeverityCounts
  }
  deriving (AccountAggregationResponse -> AccountAggregationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountAggregationResponse -> AccountAggregationResponse -> Bool
$c/= :: AccountAggregationResponse -> AccountAggregationResponse -> Bool
== :: AccountAggregationResponse -> AccountAggregationResponse -> Bool
$c== :: AccountAggregationResponse -> AccountAggregationResponse -> Bool
Prelude.Eq, ReadPrec [AccountAggregationResponse]
ReadPrec AccountAggregationResponse
Int -> ReadS AccountAggregationResponse
ReadS [AccountAggregationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountAggregationResponse]
$creadListPrec :: ReadPrec [AccountAggregationResponse]
readPrec :: ReadPrec AccountAggregationResponse
$creadPrec :: ReadPrec AccountAggregationResponse
readList :: ReadS [AccountAggregationResponse]
$creadList :: ReadS [AccountAggregationResponse]
readsPrec :: Int -> ReadS AccountAggregationResponse
$creadsPrec :: Int -> ReadS AccountAggregationResponse
Prelude.Read, Int -> AccountAggregationResponse -> ShowS
[AccountAggregationResponse] -> ShowS
AccountAggregationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountAggregationResponse] -> ShowS
$cshowList :: [AccountAggregationResponse] -> ShowS
show :: AccountAggregationResponse -> String
$cshow :: AccountAggregationResponse -> String
showsPrec :: Int -> AccountAggregationResponse -> ShowS
$cshowsPrec :: Int -> AccountAggregationResponse -> ShowS
Prelude.Show, forall x.
Rep AccountAggregationResponse x -> AccountAggregationResponse
forall x.
AccountAggregationResponse -> Rep AccountAggregationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AccountAggregationResponse x -> AccountAggregationResponse
$cfrom :: forall x.
AccountAggregationResponse -> Rep AccountAggregationResponse x
Prelude.Generic)

-- |
-- Create a value of 'AccountAggregationResponse' 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', 'accountAggregationResponse_accountId' - The Amazon Web Services account ID.
--
-- 'severityCounts', 'accountAggregationResponse_severityCounts' - The number of findings by severity.
newAccountAggregationResponse ::
  AccountAggregationResponse
newAccountAggregationResponse :: AccountAggregationResponse
newAccountAggregationResponse =
  AccountAggregationResponse'
    { $sel:accountId:AccountAggregationResponse' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:severityCounts:AccountAggregationResponse' :: Maybe SeverityCounts
severityCounts = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID.
accountAggregationResponse_accountId :: Lens.Lens' AccountAggregationResponse (Prelude.Maybe Prelude.Text)
accountAggregationResponse_accountId :: Lens' AccountAggregationResponse (Maybe Text)
accountAggregationResponse_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAggregationResponse' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AccountAggregationResponse' :: AccountAggregationResponse -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AccountAggregationResponse
s@AccountAggregationResponse' {} Maybe Text
a -> AccountAggregationResponse
s {$sel:accountId:AccountAggregationResponse' :: Maybe Text
accountId = Maybe Text
a} :: AccountAggregationResponse)

-- | The number of findings by severity.
accountAggregationResponse_severityCounts :: Lens.Lens' AccountAggregationResponse (Prelude.Maybe SeverityCounts)
accountAggregationResponse_severityCounts :: Lens' AccountAggregationResponse (Maybe SeverityCounts)
accountAggregationResponse_severityCounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAggregationResponse' {Maybe SeverityCounts
severityCounts :: Maybe SeverityCounts
$sel:severityCounts:AccountAggregationResponse' :: AccountAggregationResponse -> Maybe SeverityCounts
severityCounts} -> Maybe SeverityCounts
severityCounts) (\s :: AccountAggregationResponse
s@AccountAggregationResponse' {} Maybe SeverityCounts
a -> AccountAggregationResponse
s {$sel:severityCounts:AccountAggregationResponse' :: Maybe SeverityCounts
severityCounts = Maybe SeverityCounts
a} :: AccountAggregationResponse)

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

instance Prelude.Hashable AccountAggregationResponse where
  hashWithSalt :: Int -> AccountAggregationResponse -> Int
hashWithSalt Int
_salt AccountAggregationResponse' {Maybe Text
Maybe SeverityCounts
severityCounts :: Maybe SeverityCounts
accountId :: Maybe Text
$sel:severityCounts:AccountAggregationResponse' :: AccountAggregationResponse -> Maybe SeverityCounts
$sel:accountId:AccountAggregationResponse' :: AccountAggregationResponse -> 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

instance Prelude.NFData AccountAggregationResponse where
  rnf :: AccountAggregationResponse -> ()
rnf AccountAggregationResponse' {Maybe Text
Maybe SeverityCounts
severityCounts :: Maybe SeverityCounts
accountId :: Maybe Text
$sel:severityCounts:AccountAggregationResponse' :: AccountAggregationResponse -> Maybe SeverityCounts
$sel:accountId:AccountAggregationResponse' :: AccountAggregationResponse -> 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