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

import Amazonka.Config.Types.AggregateConformancePackCompliance
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (AggregateComplianceByConformancePack
-> AggregateComplianceByConformancePack -> Bool
(AggregateComplianceByConformancePack
 -> AggregateComplianceByConformancePack -> Bool)
-> (AggregateComplianceByConformancePack
    -> AggregateComplianceByConformancePack -> Bool)
-> Eq AggregateComplianceByConformancePack
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]
(Int -> ReadS AggregateComplianceByConformancePack)
-> ReadS [AggregateComplianceByConformancePack]
-> ReadPrec AggregateComplianceByConformancePack
-> ReadPrec [AggregateComplianceByConformancePack]
-> Read 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
(Int -> AggregateComplianceByConformancePack -> ShowS)
-> (AggregateComplianceByConformancePack -> String)
-> ([AggregateComplianceByConformancePack] -> ShowS)
-> Show AggregateComplianceByConformancePack
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.
 AggregateComplianceByConformancePack
 -> Rep AggregateComplianceByConformancePack x)
-> (forall x.
    Rep AggregateComplianceByConformancePack x
    -> AggregateComplianceByConformancePack)
-> Generic AggregateComplianceByConformancePack
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:
--
-- 'compliance', 'aggregateComplianceByConformancePack_compliance' - The compliance status of the conformance pack.
--
-- 'conformancePackName', 'aggregateComplianceByConformancePack_conformancePackName' - The name of the conformance pack.
--
-- '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.
newAggregateComplianceByConformancePack ::
  AggregateComplianceByConformancePack
newAggregateComplianceByConformancePack :: AggregateComplianceByConformancePack
newAggregateComplianceByConformancePack =
  AggregateComplianceByConformancePack' :: Maybe AggregateConformancePackCompliance
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AggregateComplianceByConformancePack
AggregateComplianceByConformancePack'
    { $sel:compliance:AggregateComplianceByConformancePack' :: Maybe AggregateConformancePackCompliance
compliance =
        Maybe AggregateConformancePackCompliance
forall a. Maybe a
Prelude.Nothing,
      $sel:conformancePackName:AggregateComplianceByConformancePack' :: Maybe Text
conformancePackName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AggregateComplianceByConformancePack' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsRegion:AggregateComplianceByConformancePack' :: Maybe Text
awsRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The compliance status of the conformance pack.
aggregateComplianceByConformancePack_compliance :: Lens.Lens' AggregateComplianceByConformancePack (Prelude.Maybe AggregateConformancePackCompliance)
aggregateComplianceByConformancePack_compliance :: (Maybe AggregateConformancePackCompliance
 -> f (Maybe AggregateConformancePackCompliance))
-> AggregateComplianceByConformancePack
-> f AggregateComplianceByConformancePack
aggregateComplianceByConformancePack_compliance = (AggregateComplianceByConformancePack
 -> Maybe AggregateConformancePackCompliance)
-> (AggregateComplianceByConformancePack
    -> Maybe AggregateConformancePackCompliance
    -> AggregateComplianceByConformancePack)
-> Lens
     AggregateComplianceByConformancePack
     AggregateComplianceByConformancePack
     (Maybe AggregateConformancePackCompliance)
     (Maybe AggregateConformancePackCompliance)
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 :: (Maybe Text -> f (Maybe Text))
-> AggregateComplianceByConformancePack
-> f AggregateComplianceByConformancePack
aggregateComplianceByConformancePack_conformancePackName = (AggregateComplianceByConformancePack -> Maybe Text)
-> (AggregateComplianceByConformancePack
    -> Maybe Text -> AggregateComplianceByConformancePack)
-> Lens
     AggregateComplianceByConformancePack
     AggregateComplianceByConformancePack
     (Maybe Text)
     (Maybe Text)
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)

-- | The 12-digit Amazon Web Services account ID of the source account.
aggregateComplianceByConformancePack_accountId :: Lens.Lens' AggregateComplianceByConformancePack (Prelude.Maybe Prelude.Text)
aggregateComplianceByConformancePack_accountId :: (Maybe Text -> f (Maybe Text))
-> AggregateComplianceByConformancePack
-> f AggregateComplianceByConformancePack
aggregateComplianceByConformancePack_accountId = (AggregateComplianceByConformancePack -> Maybe Text)
-> (AggregateComplianceByConformancePack
    -> Maybe Text -> AggregateComplianceByConformancePack)
-> Lens
     AggregateComplianceByConformancePack
     AggregateComplianceByConformancePack
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> AggregateComplianceByConformancePack
-> f AggregateComplianceByConformancePack
aggregateComplianceByConformancePack_awsRegion = (AggregateComplianceByConformancePack -> Maybe Text)
-> (AggregateComplianceByConformancePack
    -> Maybe Text -> AggregateComplianceByConformancePack)
-> Lens
     AggregateComplianceByConformancePack
     AggregateComplianceByConformancePack
     (Maybe Text)
     (Maybe Text)
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)

instance
  Core.FromJSON
    AggregateComplianceByConformancePack
  where
  parseJSON :: Value -> Parser AggregateComplianceByConformancePack
parseJSON =
    String
-> (Object -> Parser AggregateComplianceByConformancePack)
-> Value
-> Parser AggregateComplianceByConformancePack
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AggregateComplianceByConformancePack"
      ( \Object
x ->
          Maybe AggregateConformancePackCompliance
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AggregateComplianceByConformancePack
AggregateComplianceByConformancePack'
            (Maybe AggregateConformancePackCompliance
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AggregateComplianceByConformancePack)
-> Parser (Maybe AggregateConformancePackCompliance)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> AggregateComplianceByConformancePack)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AggregateConformancePackCompliance)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Compliance")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> AggregateComplianceByConformancePack)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AggregateComplianceByConformancePack)
forall (f :: * -> *) a b. Applicative f => 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
"ConformancePackName")
            Parser
  (Maybe Text -> Maybe Text -> AggregateComplianceByConformancePack)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AggregateComplianceByConformancePack)
forall (f :: * -> *) a b. Applicative f => 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
"AccountId")
            Parser (Maybe Text -> AggregateComplianceByConformancePack)
-> Parser (Maybe Text)
-> Parser AggregateComplianceByConformancePack
forall (f :: * -> *) a b. Applicative f => 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
"AwsRegion")
      )

instance
  Prelude.Hashable
    AggregateComplianceByConformancePack

instance
  Prelude.NFData
    AggregateComplianceByConformancePack