{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.Lens as Lens
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 12-digit account ID or region based on the GroupByKey value.
    AggregateComplianceCount -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | The number of compliant and noncompliant Config rules.
    AggregateComplianceCount -> Maybe ComplianceSummary
complianceSummary :: Prelude.Maybe ComplianceSummary
  }
  deriving (AggregateComplianceCount -> AggregateComplianceCount -> Bool
(AggregateComplianceCount -> AggregateComplianceCount -> Bool)
-> (AggregateComplianceCount -> AggregateComplianceCount -> Bool)
-> Eq AggregateComplianceCount
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]
(Int -> ReadS AggregateComplianceCount)
-> ReadS [AggregateComplianceCount]
-> ReadPrec AggregateComplianceCount
-> ReadPrec [AggregateComplianceCount]
-> Read 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
(Int -> AggregateComplianceCount -> ShowS)
-> (AggregateComplianceCount -> String)
-> ([AggregateComplianceCount] -> ShowS)
-> Show AggregateComplianceCount
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.
 AggregateComplianceCount -> Rep AggregateComplianceCount x)
-> (forall x.
    Rep AggregateComplianceCount x -> AggregateComplianceCount)
-> Generic AggregateComplianceCount
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:
--
-- 'groupName', 'aggregateComplianceCount_groupName' - The 12-digit account ID or region based on the GroupByKey value.
--
-- 'complianceSummary', 'aggregateComplianceCount_complianceSummary' - The number of compliant and noncompliant Config rules.
newAggregateComplianceCount ::
  AggregateComplianceCount
newAggregateComplianceCount :: AggregateComplianceCount
newAggregateComplianceCount =
  AggregateComplianceCount' :: Maybe Text -> Maybe ComplianceSummary -> AggregateComplianceCount
AggregateComplianceCount'
    { $sel:groupName:AggregateComplianceCount' :: Maybe Text
groupName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceSummary:AggregateComplianceCount' :: Maybe ComplianceSummary
complianceSummary = Maybe ComplianceSummary
forall a. Maybe a
Prelude.Nothing
    }

-- | The 12-digit account ID or region based on the GroupByKey value.
aggregateComplianceCount_groupName :: Lens.Lens' AggregateComplianceCount (Prelude.Maybe Prelude.Text)
aggregateComplianceCount_groupName :: (Maybe Text -> f (Maybe Text))
-> AggregateComplianceCount -> f AggregateComplianceCount
aggregateComplianceCount_groupName = (AggregateComplianceCount -> Maybe Text)
-> (AggregateComplianceCount
    -> Maybe Text -> AggregateComplianceCount)
-> Lens
     AggregateComplianceCount
     AggregateComplianceCount
     (Maybe Text)
     (Maybe Text)
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)

-- | The number of compliant and noncompliant Config rules.
aggregateComplianceCount_complianceSummary :: Lens.Lens' AggregateComplianceCount (Prelude.Maybe ComplianceSummary)
aggregateComplianceCount_complianceSummary :: (Maybe ComplianceSummary -> f (Maybe ComplianceSummary))
-> AggregateComplianceCount -> f AggregateComplianceCount
aggregateComplianceCount_complianceSummary = (AggregateComplianceCount -> Maybe ComplianceSummary)
-> (AggregateComplianceCount
    -> Maybe ComplianceSummary -> AggregateComplianceCount)
-> Lens
     AggregateComplianceCount
     AggregateComplianceCount
     (Maybe ComplianceSummary)
     (Maybe 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)

instance Core.FromJSON AggregateComplianceCount where
  parseJSON :: Value -> Parser AggregateComplianceCount
parseJSON =
    String
-> (Object -> Parser AggregateComplianceCount)
-> Value
-> Parser AggregateComplianceCount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AggregateComplianceCount"
      ( \Object
x ->
          Maybe Text -> Maybe ComplianceSummary -> AggregateComplianceCount
AggregateComplianceCount'
            (Maybe Text -> Maybe ComplianceSummary -> AggregateComplianceCount)
-> Parser (Maybe Text)
-> Parser (Maybe ComplianceSummary -> AggregateComplianceCount)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GroupName")
            Parser (Maybe ComplianceSummary -> AggregateComplianceCount)
-> Parser (Maybe ComplianceSummary)
-> Parser AggregateComplianceCount
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComplianceSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceSummary")
      )

instance Prelude.Hashable AggregateComplianceCount

instance Prelude.NFData AggregateComplianceCount