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

import Amazonka.Config.Types.AggregateConformancePackCompliance
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 aggregate compliance of the conformance pack. Indicates whether
-- a conformance pack is compliant based on the name of the conformance
-- pack, account ID, and region.
--
-- 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:/ 'newAggregateComplianceByConformancePack' smart constructor.
data AggregateComplianceByConformancePack = AggregateComplianceByConformancePack'
  { -- | The 12-digit Amazon Web Services account ID of the source account.
    AggregateComplianceByConformancePack -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The source Amazon Web Services Region from where the data is aggregated.
    AggregateComplianceByConformancePack -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
    -- | The compliance status of the conformance pack.
    AggregateComplianceByConformancePack
-> Maybe AggregateConformancePackCompliance
compliance :: Prelude.Maybe AggregateConformancePackCompliance,
    -- | The name of the conformance pack.
    AggregateComplianceByConformancePack -> Maybe Text
conformancePackName :: Prelude.Maybe Prelude.Text
  }
  deriving (AggregateComplianceByConformancePack
-> AggregateComplianceByConformancePack -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregateComplianceByConformancePack
-> AggregateComplianceByConformancePack -> Bool
$c/= :: AggregateComplianceByConformancePack
-> AggregateComplianceByConformancePack -> Bool
== :: AggregateComplianceByConformancePack
-> AggregateComplianceByConformancePack -> Bool
$c== :: AggregateComplianceByConformancePack
-> AggregateComplianceByConformancePack -> Bool
Prelude.Eq, ReadPrec [AggregateComplianceByConformancePack]
ReadPrec AggregateComplianceByConformancePack
Int -> ReadS AggregateComplianceByConformancePack
ReadS [AggregateComplianceByConformancePack]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregateComplianceByConformancePack]
$creadListPrec :: ReadPrec [AggregateComplianceByConformancePack]
readPrec :: ReadPrec AggregateComplianceByConformancePack
$creadPrec :: ReadPrec AggregateComplianceByConformancePack
readList :: ReadS [AggregateComplianceByConformancePack]
$creadList :: ReadS [AggregateComplianceByConformancePack]
readsPrec :: Int -> ReadS AggregateComplianceByConformancePack
$creadsPrec :: Int -> ReadS AggregateComplianceByConformancePack
Prelude.Read, Int -> AggregateComplianceByConformancePack -> ShowS
[AggregateComplianceByConformancePack] -> ShowS
AggregateComplianceByConformancePack -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregateComplianceByConformancePack] -> ShowS
$cshowList :: [AggregateComplianceByConformancePack] -> ShowS
show :: AggregateComplianceByConformancePack -> String
$cshow :: AggregateComplianceByConformancePack -> String
showsPrec :: Int -> AggregateComplianceByConformancePack -> ShowS
$cshowsPrec :: Int -> AggregateComplianceByConformancePack -> ShowS
Prelude.Show, forall x.
Rep AggregateComplianceByConformancePack x
-> AggregateComplianceByConformancePack
forall x.
AggregateComplianceByConformancePack
-> Rep AggregateComplianceByConformancePack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AggregateComplianceByConformancePack x
-> AggregateComplianceByConformancePack
$cfrom :: forall x.
AggregateComplianceByConformancePack
-> Rep AggregateComplianceByConformancePack x
Prelude.Generic)

-- |
-- Create a value of 'AggregateComplianceByConformancePack' 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', 'aggregateComplianceByConformancePack_accountId' - The 12-digit Amazon Web Services account ID of the source account.
--
-- 'awsRegion', 'aggregateComplianceByConformancePack_awsRegion' - The source Amazon Web Services Region from where the data is aggregated.
--
-- 'compliance', 'aggregateComplianceByConformancePack_compliance' - The compliance status of the conformance pack.
--
-- 'conformancePackName', 'aggregateComplianceByConformancePack_conformancePackName' - The name of the conformance pack.
newAggregateComplianceByConformancePack ::
  AggregateComplianceByConformancePack
newAggregateComplianceByConformancePack :: AggregateComplianceByConformancePack
newAggregateComplianceByConformancePack =
  AggregateComplianceByConformancePack'
    { $sel:accountId:AggregateComplianceByConformancePack' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:awsRegion:AggregateComplianceByConformancePack' :: Maybe Text
awsRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:compliance:AggregateComplianceByConformancePack' :: Maybe AggregateConformancePackCompliance
compliance = forall a. Maybe a
Prelude.Nothing,
      $sel:conformancePackName:AggregateComplianceByConformancePack' :: Maybe Text
conformancePackName = forall a. Maybe a
Prelude.Nothing
    }

-- | The 12-digit Amazon Web Services account ID of the source account.
aggregateComplianceByConformancePack_accountId :: Lens.Lens' AggregateComplianceByConformancePack (Prelude.Maybe Prelude.Text)
aggregateComplianceByConformancePack_accountId :: Lens' AggregateComplianceByConformancePack (Maybe Text)
aggregateComplianceByConformancePack_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateComplianceByConformancePack' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AggregateComplianceByConformancePack
s@AggregateComplianceByConformancePack' {} Maybe Text
a -> AggregateComplianceByConformancePack
s {$sel:accountId:AggregateComplianceByConformancePack' :: Maybe Text
accountId = Maybe Text
a} :: AggregateComplianceByConformancePack)

-- | The source Amazon Web Services Region from where the data is aggregated.
aggregateComplianceByConformancePack_awsRegion :: Lens.Lens' AggregateComplianceByConformancePack (Prelude.Maybe Prelude.Text)
aggregateComplianceByConformancePack_awsRegion :: Lens' AggregateComplianceByConformancePack (Maybe Text)
aggregateComplianceByConformancePack_awsRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateComplianceByConformancePack' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: AggregateComplianceByConformancePack
s@AggregateComplianceByConformancePack' {} Maybe Text
a -> AggregateComplianceByConformancePack
s {$sel:awsRegion:AggregateComplianceByConformancePack' :: Maybe Text
awsRegion = Maybe Text
a} :: AggregateComplianceByConformancePack)

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

-- | The name of the conformance pack.
aggregateComplianceByConformancePack_conformancePackName :: Lens.Lens' AggregateComplianceByConformancePack (Prelude.Maybe Prelude.Text)
aggregateComplianceByConformancePack_conformancePackName :: Lens' AggregateComplianceByConformancePack (Maybe Text)
aggregateComplianceByConformancePack_conformancePackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateComplianceByConformancePack' {Maybe Text
conformancePackName :: Maybe Text
$sel:conformancePackName:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
conformancePackName} -> Maybe Text
conformancePackName) (\s :: AggregateComplianceByConformancePack
s@AggregateComplianceByConformancePack' {} Maybe Text
a -> AggregateComplianceByConformancePack
s {$sel:conformancePackName:AggregateComplianceByConformancePack' :: Maybe Text
conformancePackName = Maybe Text
a} :: AggregateComplianceByConformancePack)

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

instance
  Prelude.Hashable
    AggregateComplianceByConformancePack
  where
  hashWithSalt :: Int -> AggregateComplianceByConformancePack -> Int
hashWithSalt
    Int
_salt
    AggregateComplianceByConformancePack' {Maybe Text
Maybe AggregateConformancePackCompliance
conformancePackName :: Maybe Text
compliance :: Maybe AggregateConformancePackCompliance
awsRegion :: Maybe Text
accountId :: Maybe Text
$sel:conformancePackName:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
$sel:compliance:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack
-> Maybe AggregateConformancePackCompliance
$sel:awsRegion:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
$sel:accountId:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> 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 Text
awsRegion
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AggregateConformancePackCompliance
compliance
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
conformancePackName

instance
  Prelude.NFData
    AggregateComplianceByConformancePack
  where
  rnf :: AggregateComplianceByConformancePack -> ()
rnf AggregateComplianceByConformancePack' {Maybe Text
Maybe AggregateConformancePackCompliance
conformancePackName :: Maybe Text
compliance :: Maybe AggregateConformancePackCompliance
awsRegion :: Maybe Text
accountId :: Maybe Text
$sel:conformancePackName:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
$sel:compliance:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack
-> Maybe AggregateConformancePackCompliance
$sel:awsRegion:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> Maybe Text
$sel:accountId:AggregateComplianceByConformancePack' :: AggregateComplianceByConformancePack -> 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 Text
awsRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AggregateConformancePackCompliance
compliance
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
conformancePackName