{-# 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.Config.Types.AggregateComplianceCount
-- 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.Config.Types.AggregateComplianceCount where

import Amazonka.Config.Types.ComplianceSummary
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

-- | Returns the number of compliant and noncompliant rules for one or more
-- accounts and regions in an aggregator.
--
-- /See:/ 'newAggregateComplianceCount' smart constructor.
data AggregateComplianceCount = AggregateComplianceCount'
  { -- | The number of compliant and noncompliant Config rules.
    AggregateComplianceCount -> Maybe ComplianceSummary
complianceSummary :: Prelude.Maybe ComplianceSummary,
    -- | The 12-digit account ID or region based on the GroupByKey value.
    AggregateComplianceCount -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (AggregateComplianceCount -> AggregateComplianceCount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregateComplianceCount -> AggregateComplianceCount -> Bool
$c/= :: AggregateComplianceCount -> AggregateComplianceCount -> Bool
== :: AggregateComplianceCount -> AggregateComplianceCount -> Bool
$c== :: AggregateComplianceCount -> AggregateComplianceCount -> Bool
Prelude.Eq, ReadPrec [AggregateComplianceCount]
ReadPrec AggregateComplianceCount
Int -> ReadS AggregateComplianceCount
ReadS [AggregateComplianceCount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregateComplianceCount]
$creadListPrec :: ReadPrec [AggregateComplianceCount]
readPrec :: ReadPrec AggregateComplianceCount
$creadPrec :: ReadPrec AggregateComplianceCount
readList :: ReadS [AggregateComplianceCount]
$creadList :: ReadS [AggregateComplianceCount]
readsPrec :: Int -> ReadS AggregateComplianceCount
$creadsPrec :: Int -> ReadS AggregateComplianceCount
Prelude.Read, Int -> AggregateComplianceCount -> ShowS
[AggregateComplianceCount] -> ShowS
AggregateComplianceCount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregateComplianceCount] -> ShowS
$cshowList :: [AggregateComplianceCount] -> ShowS
show :: AggregateComplianceCount -> String
$cshow :: AggregateComplianceCount -> String
showsPrec :: Int -> AggregateComplianceCount -> ShowS
$cshowsPrec :: Int -> AggregateComplianceCount -> ShowS
Prelude.Show, forall x.
Rep AggregateComplianceCount x -> AggregateComplianceCount
forall x.
AggregateComplianceCount -> Rep AggregateComplianceCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AggregateComplianceCount x -> AggregateComplianceCount
$cfrom :: forall x.
AggregateComplianceCount -> Rep AggregateComplianceCount x
Prelude.Generic)

-- |
-- Create a value of 'AggregateComplianceCount' 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:
--
-- 'complianceSummary', 'aggregateComplianceCount_complianceSummary' - The number of compliant and noncompliant Config rules.
--
-- 'groupName', 'aggregateComplianceCount_groupName' - The 12-digit account ID or region based on the GroupByKey value.
newAggregateComplianceCount ::
  AggregateComplianceCount
newAggregateComplianceCount :: AggregateComplianceCount
newAggregateComplianceCount =
  AggregateComplianceCount'
    { $sel:complianceSummary:AggregateComplianceCount' :: Maybe ComplianceSummary
complianceSummary =
        forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:AggregateComplianceCount' :: Maybe Text
groupName = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of compliant and noncompliant Config rules.
aggregateComplianceCount_complianceSummary :: Lens.Lens' AggregateComplianceCount (Prelude.Maybe ComplianceSummary)
aggregateComplianceCount_complianceSummary :: Lens' AggregateComplianceCount (Maybe ComplianceSummary)
aggregateComplianceCount_complianceSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateComplianceCount' {Maybe ComplianceSummary
complianceSummary :: Maybe ComplianceSummary
$sel:complianceSummary:AggregateComplianceCount' :: AggregateComplianceCount -> Maybe ComplianceSummary
complianceSummary} -> Maybe ComplianceSummary
complianceSummary) (\s :: AggregateComplianceCount
s@AggregateComplianceCount' {} Maybe ComplianceSummary
a -> AggregateComplianceCount
s {$sel:complianceSummary:AggregateComplianceCount' :: Maybe ComplianceSummary
complianceSummary = Maybe ComplianceSummary
a} :: AggregateComplianceCount)

-- | The 12-digit account ID or region based on the GroupByKey value.
aggregateComplianceCount_groupName :: Lens.Lens' AggregateComplianceCount (Prelude.Maybe Prelude.Text)
aggregateComplianceCount_groupName :: Lens' AggregateComplianceCount (Maybe Text)
aggregateComplianceCount_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateComplianceCount' {Maybe Text
groupName :: Maybe Text
$sel:groupName:AggregateComplianceCount' :: AggregateComplianceCount -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: AggregateComplianceCount
s@AggregateComplianceCount' {} Maybe Text
a -> AggregateComplianceCount
s {$sel:groupName:AggregateComplianceCount' :: Maybe Text
groupName = Maybe Text
a} :: AggregateComplianceCount)

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

instance Prelude.Hashable AggregateComplianceCount where
  hashWithSalt :: Int -> AggregateComplianceCount -> Int
hashWithSalt Int
_salt AggregateComplianceCount' {Maybe Text
Maybe ComplianceSummary
groupName :: Maybe Text
complianceSummary :: Maybe ComplianceSummary
$sel:groupName:AggregateComplianceCount' :: AggregateComplianceCount -> Maybe Text
$sel:complianceSummary:AggregateComplianceCount' :: AggregateComplianceCount -> Maybe ComplianceSummary
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComplianceSummary
complianceSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupName

instance Prelude.NFData AggregateComplianceCount where
  rnf :: AggregateComplianceCount -> ()
rnf AggregateComplianceCount' {Maybe Text
Maybe ComplianceSummary
groupName :: Maybe Text
complianceSummary :: Maybe ComplianceSummary
$sel:groupName:AggregateComplianceCount' :: AggregateComplianceCount -> Maybe Text
$sel:complianceSummary:AggregateComplianceCount' :: AggregateComplianceCount -> Maybe ComplianceSummary
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ComplianceSummary
complianceSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupName