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

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

-- | 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'
  { -- | The compliance status of the conformance pack.
    AggregateConformancePackCompliance
-> Maybe ConformancePackComplianceType
complianceType :: Prelude.Maybe ConformancePackComplianceType,
    -- | 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,
    -- | 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
  }
  deriving (AggregateConformancePackCompliance
-> AggregateConformancePackCompliance -> Bool
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]
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
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.
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:
--
-- 'complianceType', 'aggregateConformancePackCompliance_complianceType' - The compliance status of the conformance pack.
--
-- 'compliantRuleCount', 'aggregateConformancePackCompliance_compliantRuleCount' - The number of compliant Config Rules.
--
-- 'nonCompliantRuleCount', 'aggregateConformancePackCompliance_nonCompliantRuleCount' - The number of noncompliant Config Rules.
--
-- '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.
newAggregateConformancePackCompliance ::
  AggregateConformancePackCompliance
newAggregateConformancePackCompliance :: AggregateConformancePackCompliance
newAggregateConformancePackCompliance =
  AggregateConformancePackCompliance'
    { $sel:complianceType:AggregateConformancePackCompliance' :: Maybe ConformancePackComplianceType
complianceType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:compliantRuleCount:AggregateConformancePackCompliance' :: Maybe Int
compliantRuleCount = forall a. Maybe a
Prelude.Nothing,
      $sel:nonCompliantRuleCount:AggregateConformancePackCompliance' :: Maybe Int
nonCompliantRuleCount = forall a. Maybe a
Prelude.Nothing,
      $sel:totalRuleCount:AggregateConformancePackCompliance' :: Maybe Int
totalRuleCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The compliance status of the conformance pack.
aggregateConformancePackCompliance_complianceType :: Lens.Lens' AggregateConformancePackCompliance (Prelude.Maybe ConformancePackComplianceType)
aggregateConformancePackCompliance_complianceType :: Lens'
  AggregateConformancePackCompliance
  (Maybe ConformancePackComplianceType)
aggregateConformancePackCompliance_complianceType = 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)

-- | The number of compliant Config Rules.
aggregateConformancePackCompliance_compliantRuleCount :: Lens.Lens' AggregateConformancePackCompliance (Prelude.Maybe Prelude.Int)
aggregateConformancePackCompliance_compliantRuleCount :: Lens' AggregateConformancePackCompliance (Maybe Int)
aggregateConformancePackCompliance_compliantRuleCount = 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 :: Lens' AggregateConformancePackCompliance (Maybe Int)
aggregateConformancePackCompliance_nonCompliantRuleCount = 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)

-- | 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 :: Lens' AggregateConformancePackCompliance (Maybe Int)
aggregateConformancePackCompliance_totalRuleCount = 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)

instance
  Data.FromJSON
    AggregateConformancePackCompliance
  where
  parseJSON :: Value -> Parser AggregateConformancePackCompliance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AggregateConformancePackCompliance"
      ( \Object
x ->
          Maybe ConformancePackComplianceType
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> AggregateConformancePackCompliance
AggregateConformancePackCompliance'
            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
"ComplianceType")
            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
"CompliantRuleCount")
            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
"NonCompliantRuleCount")
            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
"TotalRuleCount")
      )

instance
  Prelude.Hashable
    AggregateConformancePackCompliance
  where
  hashWithSalt :: Int -> AggregateConformancePackCompliance -> Int
hashWithSalt
    Int
_salt
    AggregateConformancePackCompliance' {Maybe Int
Maybe ConformancePackComplianceType
totalRuleCount :: Maybe Int
nonCompliantRuleCount :: Maybe Int
compliantRuleCount :: Maybe Int
complianceType :: Maybe ConformancePackComplianceType
$sel:totalRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
$sel:nonCompliantRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
$sel:compliantRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
$sel:complianceType:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance
-> Maybe ConformancePackComplianceType
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConformancePackComplianceType
complianceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
compliantRuleCount
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
nonCompliantRuleCount
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
totalRuleCount

instance
  Prelude.NFData
    AggregateConformancePackCompliance
  where
  rnf :: AggregateConformancePackCompliance -> ()
rnf AggregateConformancePackCompliance' {Maybe Int
Maybe ConformancePackComplianceType
totalRuleCount :: Maybe Int
nonCompliantRuleCount :: Maybe Int
compliantRuleCount :: Maybe Int
complianceType :: Maybe ConformancePackComplianceType
$sel:totalRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
$sel:nonCompliantRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
$sel:compliantRuleCount:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance -> Maybe Int
$sel:complianceType:AggregateConformancePackCompliance' :: AggregateConformancePackCompliance
-> Maybe ConformancePackComplianceType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConformancePackComplianceType
complianceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
compliantRuleCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
nonCompliantRuleCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
totalRuleCount