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

import Amazonka.Config.Types.ConformancePackComplianceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the number of compliant and noncompliant rules within a
-- conformance pack. Also provides the compliance status of the conformance
-- pack and the total rule count which includes compliant rules,
-- noncompliant rules, and rules that cannot be evaluated due to
-- insufficient data.
--
-- A conformance pack is compliant if all of the rules in a conformance
-- packs are compliant. It is noncompliant if any of the rules are not
-- compliant. The compliance status of a conformance pack is
-- INSUFFICIENT_DATA only if all rules within a conformance pack cannot be
-- evaluated due to insufficient data. If some of the rules in a
-- conformance pack are compliant but the compliance status of other rules
-- in that same conformance pack is INSUFFICIENT_DATA, the conformance pack
-- shows compliant.
--
-- /See:/ 'newAggregateConformancePackCompliance' smart constructor.
data AggregateConformancePackCompliance = AggregateConformancePackCompliance'
  { -- | Total number of compliant rules, noncompliant rules, and the rules that
    -- do not have any applicable resources to evaluate upon resulting in
    -- insufficient data.
    AggregateConformancePackCompliance -> Maybe Int
totalRuleCount :: Prelude.Maybe Prelude.Int,
    -- | The number of compliant Config Rules.
    AggregateConformancePackCompliance -> Maybe Int
compliantRuleCount :: Prelude.Maybe Prelude.Int,
    -- | The number of noncompliant Config Rules.
    AggregateConformancePackCompliance -> Maybe Int
nonCompliantRuleCount :: Prelude.Maybe Prelude.Int,
    -- | The compliance status of the conformance pack.
    AggregateConformancePackCompliance
-> Maybe ConformancePackComplianceType
complianceType :: Prelude.Maybe ConformancePackComplianceType
  }
  deriving (AggregateConformancePackCompliance
-> AggregateConformancePackCompliance -> Bool
(AggregateConformancePackCompliance
 -> AggregateConformancePackCompliance -> Bool)
-> (AggregateConformancePackCompliance
    -> AggregateConformancePackCompliance -> Bool)
-> Eq AggregateConformancePackCompliance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregateConformancePackCompliance
-> AggregateConformancePackCompliance -> Bool
$c/= :: AggregateConformancePackCompliance
-> AggregateConformancePackCompliance -> Bool
== :: AggregateConformancePackCompliance
-> AggregateConformancePackCompliance -> Bool
$c== :: AggregateConformancePackCompliance
-> AggregateConformancePackCompliance -> Bool
Prelude.Eq, ReadPrec [AggregateConformancePackCompliance]
ReadPrec AggregateConformancePackCompliance
Int -> ReadS AggregateConformancePackCompliance
ReadS [AggregateConformancePackCompliance]
(Int -> ReadS AggregateConformancePackCompliance)
-> ReadS [AggregateConformancePackCompliance]
-> ReadPrec AggregateConformancePackCompliance
-> ReadPrec [AggregateConformancePackCompliance]
-> Read AggregateConformancePackCompliance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregateConformancePackCompliance]
$creadListPrec :: ReadPrec [AggregateConformancePackCompliance]
readPrec :: ReadPrec AggregateConformancePackCompliance
$creadPrec :: ReadPrec AggregateConformancePackCompliance
readList :: ReadS [AggregateConformancePackCompliance]
$creadList :: ReadS [AggregateConformancePackCompliance]
readsPrec :: Int -> ReadS AggregateConformancePackCompliance
$creadsPrec :: Int -> ReadS AggregateConformancePackCompliance
Prelude.Read, Int -> AggregateConformancePackCompliance -> ShowS
[AggregateConformancePackCompliance] -> ShowS
AggregateConformancePackCompliance -> String
(Int -> AggregateConformancePackCompliance -> ShowS)
-> (AggregateConformancePackCompliance -> String)
-> ([AggregateConformancePackCompliance] -> ShowS)
-> Show AggregateConformancePackCompliance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregateConformancePackCompliance] -> ShowS
$cshowList :: [AggregateConformancePackCompliance] -> ShowS
show :: AggregateConformancePackCompliance -> String
$cshow :: AggregateConformancePackCompliance -> String
showsPrec :: Int -> AggregateConformancePackCompliance -> ShowS
$cshowsPrec :: Int -> AggregateConformancePackCompliance -> ShowS
Prelude.Show, (forall x.
 AggregateConformancePackCompliance
 -> Rep AggregateConformancePackCompliance x)
-> (forall x.
    Rep AggregateConformancePackCompliance x
    -> AggregateConformancePackCompliance)
-> Generic AggregateConformancePackCompliance
forall x.
Rep AggregateConformancePackCompliance x
-> AggregateConformancePackCompliance
forall x.
AggregateConformancePackCompliance
-> Rep AggregateConformancePackCompliance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AggregateConformancePackCompliance x
-> AggregateConformancePackCompliance
$cfrom :: forall x.
AggregateConformancePackCompliance
-> Rep AggregateConformancePackCompliance x
Prelude.Generic)

-- |
-- Create a value of 'AggregateConformancePackCompliance' 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:
--
-- 'totalRuleCount', 'aggregateConformancePackCompliance_totalRuleCount' - Total number of compliant rules, noncompliant rules, and the rules that
-- do not have any applicable resources to evaluate upon resulting in
-- insufficient data.
--
-- 'compliantRuleCount', 'aggregateConformancePackCompliance_compliantRuleCount' - The number of compliant Config Rules.
--
-- 'nonCompliantRuleCount', 'aggregateConformancePackCompliance_nonCompliantRuleCount' - The number of noncompliant Config Rules.
--
-- 'complianceType', 'aggregateConformancePackCompliance_complianceType' - The compliance status of the conformance pack.
newAggregateConformancePackCompliance ::
  AggregateConformancePackCompliance
newAggregateConformancePackCompliance :: AggregateConformancePackCompliance
newAggregateConformancePackCompliance =
  AggregateConformancePackCompliance' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe ConformancePackComplianceType
-> AggregateConformancePackCompliance
AggregateConformancePackCompliance'
    { $sel:totalRuleCount:AggregateConformancePackCompliance' :: Maybe Int
totalRuleCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:compliantRuleCount:AggregateConformancePackCompliance' :: Maybe Int
compliantRuleCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:nonCompliantRuleCount:AggregateConformancePackCompliance' :: Maybe Int
nonCompliantRuleCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceType:AggregateConformancePackCompliance' :: Maybe ConformancePackComplianceType
complianceType = Maybe ConformancePackComplianceType
forall a. Maybe a
Prelude.Nothing
    }

-- | Total number of compliant rules, noncompliant rules, and the rules that
-- do not have any applicable resources to evaluate upon resulting in
-- insufficient data.
aggregateConformancePackCompliance_totalRuleCount :: Lens.Lens' AggregateConformancePackCompliance (Prelude.Maybe Prelude.Int)
aggregateConformancePackCompliance_totalRuleCount :: (Maybe Int -> f (Maybe Int))
-> AggregateConformancePackCompliance
-> f AggregateConformancePackCompliance
aggregateConformancePackCompliance_totalRuleCount = (AggregateConformancePackCompliance -> Maybe Int)
-> (AggregateConformancePackCompliance
    -> Maybe Int -> AggregateConformancePackCompliance)
-> Lens
     AggregateConformancePackCompliance
     AggregateConformancePackCompliance
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateConformancePackCompliance' {Maybe Int
totalRuleCount :: Maybe Int
$sel:totalRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
totalRuleCount} -> Maybe Int
totalRuleCount) (\s :: AggregateConformancePackCompliance
s@AggregateConformancePackCompliance' {} Maybe Int
a -> AggregateConformancePackCompliance
s {$sel:totalRuleCount:AggregateConformancePackCompliance' :: Maybe Int
totalRuleCount = Maybe Int
a} :: AggregateConformancePackCompliance)

-- | The number of compliant Config Rules.
aggregateConformancePackCompliance_compliantRuleCount :: Lens.Lens' AggregateConformancePackCompliance (Prelude.Maybe Prelude.Int)
aggregateConformancePackCompliance_compliantRuleCount :: (Maybe Int -> f (Maybe Int))
-> AggregateConformancePackCompliance
-> f AggregateConformancePackCompliance
aggregateConformancePackCompliance_compliantRuleCount = (AggregateConformancePackCompliance -> Maybe Int)
-> (AggregateConformancePackCompliance
    -> Maybe Int -> AggregateConformancePackCompliance)
-> Lens
     AggregateConformancePackCompliance
     AggregateConformancePackCompliance
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateConformancePackCompliance' {Maybe Int
compliantRuleCount :: Maybe Int
$sel:compliantRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
compliantRuleCount} -> Maybe Int
compliantRuleCount) (\s :: AggregateConformancePackCompliance
s@AggregateConformancePackCompliance' {} Maybe Int
a -> AggregateConformancePackCompliance
s {$sel:compliantRuleCount:AggregateConformancePackCompliance' :: Maybe Int
compliantRuleCount = Maybe Int
a} :: AggregateConformancePackCompliance)

-- | The number of noncompliant Config Rules.
aggregateConformancePackCompliance_nonCompliantRuleCount :: Lens.Lens' AggregateConformancePackCompliance (Prelude.Maybe Prelude.Int)
aggregateConformancePackCompliance_nonCompliantRuleCount :: (Maybe Int -> f (Maybe Int))
-> AggregateConformancePackCompliance
-> f AggregateConformancePackCompliance
aggregateConformancePackCompliance_nonCompliantRuleCount = (AggregateConformancePackCompliance -> Maybe Int)
-> (AggregateConformancePackCompliance
    -> Maybe Int -> AggregateConformancePackCompliance)
-> Lens
     AggregateConformancePackCompliance
     AggregateConformancePackCompliance
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateConformancePackCompliance' {Maybe Int
nonCompliantRuleCount :: Maybe Int
$sel:nonCompliantRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
nonCompliantRuleCount} -> Maybe Int
nonCompliantRuleCount) (\s :: AggregateConformancePackCompliance
s@AggregateConformancePackCompliance' {} Maybe Int
a -> AggregateConformancePackCompliance
s {$sel:nonCompliantRuleCount:AggregateConformancePackCompliance' :: Maybe Int
nonCompliantRuleCount = Maybe Int
a} :: AggregateConformancePackCompliance)

-- | The compliance status of the conformance pack.
aggregateConformancePackCompliance_complianceType :: Lens.Lens' AggregateConformancePackCompliance (Prelude.Maybe ConformancePackComplianceType)
aggregateConformancePackCompliance_complianceType :: (Maybe ConformancePackComplianceType
 -> f (Maybe ConformancePackComplianceType))
-> AggregateConformancePackCompliance
-> f AggregateConformancePackCompliance
aggregateConformancePackCompliance_complianceType = (AggregateConformancePackCompliance
 -> Maybe ConformancePackComplianceType)
-> (AggregateConformancePackCompliance
    -> Maybe ConformancePackComplianceType
    -> AggregateConformancePackCompliance)
-> Lens
     AggregateConformancePackCompliance
     AggregateConformancePackCompliance
     (Maybe ConformancePackComplianceType)
     (Maybe ConformancePackComplianceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateConformancePackCompliance' {Maybe ConformancePackComplianceType
complianceType :: Maybe ConformancePackComplianceType
$sel:complianceType:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance
-> Maybe ConformancePackComplianceType
complianceType} -> Maybe ConformancePackComplianceType
complianceType) (\s :: AggregateConformancePackCompliance
s@AggregateConformancePackCompliance' {} Maybe ConformancePackComplianceType
a -> AggregateConformancePackCompliance
s {$sel:complianceType:AggregateConformancePackCompliance' :: Maybe ConformancePackComplianceType
complianceType = Maybe ConformancePackComplianceType
a} :: AggregateConformancePackCompliance)

instance
  Core.FromJSON
    AggregateConformancePackCompliance
  where
  parseJSON :: Value -> Parser AggregateConformancePackCompliance
parseJSON =
    String
-> (Object -> Parser AggregateConformancePackCompliance)
-> Value
-> Parser AggregateConformancePackCompliance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AggregateConformancePackCompliance"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe ConformancePackComplianceType
-> AggregateConformancePackCompliance
AggregateConformancePackCompliance'
            (Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe ConformancePackComplianceType
 -> AggregateConformancePackCompliance)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe ConformancePackComplianceType
      -> AggregateConformancePackCompliance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TotalRuleCount")
            Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe ConformancePackComplianceType
   -> AggregateConformancePackCompliance)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe ConformancePackComplianceType
      -> AggregateConformancePackCompliance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompliantRuleCount")
            Parser
  (Maybe Int
   -> Maybe ConformancePackComplianceType
   -> AggregateConformancePackCompliance)
-> Parser (Maybe Int)
-> Parser
     (Maybe ConformancePackComplianceType
      -> AggregateConformancePackCompliance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonCompliantRuleCount")
            Parser
  (Maybe ConformancePackComplianceType
   -> AggregateConformancePackCompliance)
-> Parser (Maybe ConformancePackComplianceType)
-> Parser AggregateConformancePackCompliance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConformancePackComplianceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceType")
      )

instance
  Prelude.Hashable
    AggregateConformancePackCompliance

instance
  Prelude.NFData
    AggregateConformancePackCompliance