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

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

-- | The details of a conformance pack evaluation. Provides Config rule and
-- Amazon Web Services resource type that was evaluated, the compliance of
-- the conformance pack, related time stamps, and supplementary
-- information.
--
-- /See:/ 'newConformancePackEvaluationResult' smart constructor.
data ConformancePackEvaluationResult = ConformancePackEvaluationResult'
  { -- | Supplementary information about how the evaluation determined the
    -- compliance.
    ConformancePackEvaluationResult -> Maybe Text
annotation :: Prelude.Maybe Prelude.Text,
    -- | The compliance type. The allowed values are @COMPLIANT@ and
    -- @NON_COMPLIANT@. @INSUFFICIENT_DATA@ is not supported.
    ConformancePackEvaluationResult -> ConformancePackComplianceType
complianceType :: ConformancePackComplianceType,
    ConformancePackEvaluationResult -> EvaluationResultIdentifier
evaluationResultIdentifier :: EvaluationResultIdentifier,
    -- | The time when Config rule evaluated Amazon Web Services resource.
    ConformancePackEvaluationResult -> POSIX
configRuleInvokedTime :: Data.POSIX,
    -- | The time when Config recorded the evaluation result.
    ConformancePackEvaluationResult -> POSIX
resultRecordedTime :: Data.POSIX
  }
  deriving (ConformancePackEvaluationResult
-> ConformancePackEvaluationResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConformancePackEvaluationResult
-> ConformancePackEvaluationResult -> Bool
$c/= :: ConformancePackEvaluationResult
-> ConformancePackEvaluationResult -> Bool
== :: ConformancePackEvaluationResult
-> ConformancePackEvaluationResult -> Bool
$c== :: ConformancePackEvaluationResult
-> ConformancePackEvaluationResult -> Bool
Prelude.Eq, ReadPrec [ConformancePackEvaluationResult]
ReadPrec ConformancePackEvaluationResult
Int -> ReadS ConformancePackEvaluationResult
ReadS [ConformancePackEvaluationResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConformancePackEvaluationResult]
$creadListPrec :: ReadPrec [ConformancePackEvaluationResult]
readPrec :: ReadPrec ConformancePackEvaluationResult
$creadPrec :: ReadPrec ConformancePackEvaluationResult
readList :: ReadS [ConformancePackEvaluationResult]
$creadList :: ReadS [ConformancePackEvaluationResult]
readsPrec :: Int -> ReadS ConformancePackEvaluationResult
$creadsPrec :: Int -> ReadS ConformancePackEvaluationResult
Prelude.Read, Int -> ConformancePackEvaluationResult -> ShowS
[ConformancePackEvaluationResult] -> ShowS
ConformancePackEvaluationResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConformancePackEvaluationResult] -> ShowS
$cshowList :: [ConformancePackEvaluationResult] -> ShowS
show :: ConformancePackEvaluationResult -> String
$cshow :: ConformancePackEvaluationResult -> String
showsPrec :: Int -> ConformancePackEvaluationResult -> ShowS
$cshowsPrec :: Int -> ConformancePackEvaluationResult -> ShowS
Prelude.Show, forall x.
Rep ConformancePackEvaluationResult x
-> ConformancePackEvaluationResult
forall x.
ConformancePackEvaluationResult
-> Rep ConformancePackEvaluationResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConformancePackEvaluationResult x
-> ConformancePackEvaluationResult
$cfrom :: forall x.
ConformancePackEvaluationResult
-> Rep ConformancePackEvaluationResult x
Prelude.Generic)

-- |
-- Create a value of 'ConformancePackEvaluationResult' 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:
--
-- 'annotation', 'conformancePackEvaluationResult_annotation' - Supplementary information about how the evaluation determined the
-- compliance.
--
-- 'complianceType', 'conformancePackEvaluationResult_complianceType' - The compliance type. The allowed values are @COMPLIANT@ and
-- @NON_COMPLIANT@. @INSUFFICIENT_DATA@ is not supported.
--
-- 'evaluationResultIdentifier', 'conformancePackEvaluationResult_evaluationResultIdentifier' - Undocumented member.
--
-- 'configRuleInvokedTime', 'conformancePackEvaluationResult_configRuleInvokedTime' - The time when Config rule evaluated Amazon Web Services resource.
--
-- 'resultRecordedTime', 'conformancePackEvaluationResult_resultRecordedTime' - The time when Config recorded the evaluation result.
newConformancePackEvaluationResult ::
  -- | 'complianceType'
  ConformancePackComplianceType ->
  -- | 'evaluationResultIdentifier'
  EvaluationResultIdentifier ->
  -- | 'configRuleInvokedTime'
  Prelude.UTCTime ->
  -- | 'resultRecordedTime'
  Prelude.UTCTime ->
  ConformancePackEvaluationResult
newConformancePackEvaluationResult :: ConformancePackComplianceType
-> EvaluationResultIdentifier
-> UTCTime
-> UTCTime
-> ConformancePackEvaluationResult
newConformancePackEvaluationResult
  ConformancePackComplianceType
pComplianceType_
  EvaluationResultIdentifier
pEvaluationResultIdentifier_
  UTCTime
pConfigRuleInvokedTime_
  UTCTime
pResultRecordedTime_ =
    ConformancePackEvaluationResult'
      { $sel:annotation:ConformancePackEvaluationResult' :: Maybe Text
annotation =
          forall a. Maybe a
Prelude.Nothing,
        $sel:complianceType:ConformancePackEvaluationResult' :: ConformancePackComplianceType
complianceType = ConformancePackComplianceType
pComplianceType_,
        $sel:evaluationResultIdentifier:ConformancePackEvaluationResult' :: EvaluationResultIdentifier
evaluationResultIdentifier =
          EvaluationResultIdentifier
pEvaluationResultIdentifier_,
        $sel:configRuleInvokedTime:ConformancePackEvaluationResult' :: POSIX
configRuleInvokedTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
            forall t b. AReview t b -> b -> t
Lens.# UTCTime
pConfigRuleInvokedTime_,
        $sel:resultRecordedTime:ConformancePackEvaluationResult' :: POSIX
resultRecordedTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pResultRecordedTime_
      }

-- | Supplementary information about how the evaluation determined the
-- compliance.
conformancePackEvaluationResult_annotation :: Lens.Lens' ConformancePackEvaluationResult (Prelude.Maybe Prelude.Text)
conformancePackEvaluationResult_annotation :: Lens' ConformancePackEvaluationResult (Maybe Text)
conformancePackEvaluationResult_annotation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationResult' {Maybe Text
annotation :: Maybe Text
$sel:annotation:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> Maybe Text
annotation} -> Maybe Text
annotation) (\s :: ConformancePackEvaluationResult
s@ConformancePackEvaluationResult' {} Maybe Text
a -> ConformancePackEvaluationResult
s {$sel:annotation:ConformancePackEvaluationResult' :: Maybe Text
annotation = Maybe Text
a} :: ConformancePackEvaluationResult)

-- | The compliance type. The allowed values are @COMPLIANT@ and
-- @NON_COMPLIANT@. @INSUFFICIENT_DATA@ is not supported.
conformancePackEvaluationResult_complianceType :: Lens.Lens' ConformancePackEvaluationResult ConformancePackComplianceType
conformancePackEvaluationResult_complianceType :: Lens' ConformancePackEvaluationResult ConformancePackComplianceType
conformancePackEvaluationResult_complianceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationResult' {ConformancePackComplianceType
complianceType :: ConformancePackComplianceType
$sel:complianceType:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> ConformancePackComplianceType
complianceType} -> ConformancePackComplianceType
complianceType) (\s :: ConformancePackEvaluationResult
s@ConformancePackEvaluationResult' {} ConformancePackComplianceType
a -> ConformancePackEvaluationResult
s {$sel:complianceType:ConformancePackEvaluationResult' :: ConformancePackComplianceType
complianceType = ConformancePackComplianceType
a} :: ConformancePackEvaluationResult)

-- | Undocumented member.
conformancePackEvaluationResult_evaluationResultIdentifier :: Lens.Lens' ConformancePackEvaluationResult EvaluationResultIdentifier
conformancePackEvaluationResult_evaluationResultIdentifier :: Lens' ConformancePackEvaluationResult EvaluationResultIdentifier
conformancePackEvaluationResult_evaluationResultIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationResult' {EvaluationResultIdentifier
evaluationResultIdentifier :: EvaluationResultIdentifier
$sel:evaluationResultIdentifier:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> EvaluationResultIdentifier
evaluationResultIdentifier} -> EvaluationResultIdentifier
evaluationResultIdentifier) (\s :: ConformancePackEvaluationResult
s@ConformancePackEvaluationResult' {} EvaluationResultIdentifier
a -> ConformancePackEvaluationResult
s {$sel:evaluationResultIdentifier:ConformancePackEvaluationResult' :: EvaluationResultIdentifier
evaluationResultIdentifier = EvaluationResultIdentifier
a} :: ConformancePackEvaluationResult)

-- | The time when Config rule evaluated Amazon Web Services resource.
conformancePackEvaluationResult_configRuleInvokedTime :: Lens.Lens' ConformancePackEvaluationResult Prelude.UTCTime
conformancePackEvaluationResult_configRuleInvokedTime :: Lens' ConformancePackEvaluationResult UTCTime
conformancePackEvaluationResult_configRuleInvokedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationResult' {POSIX
configRuleInvokedTime :: POSIX
$sel:configRuleInvokedTime:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> POSIX
configRuleInvokedTime} -> POSIX
configRuleInvokedTime) (\s :: ConformancePackEvaluationResult
s@ConformancePackEvaluationResult' {} POSIX
a -> ConformancePackEvaluationResult
s {$sel:configRuleInvokedTime:ConformancePackEvaluationResult' :: POSIX
configRuleInvokedTime = POSIX
a} :: ConformancePackEvaluationResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time when Config recorded the evaluation result.
conformancePackEvaluationResult_resultRecordedTime :: Lens.Lens' ConformancePackEvaluationResult Prelude.UTCTime
conformancePackEvaluationResult_resultRecordedTime :: Lens' ConformancePackEvaluationResult UTCTime
conformancePackEvaluationResult_resultRecordedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationResult' {POSIX
resultRecordedTime :: POSIX
$sel:resultRecordedTime:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> POSIX
resultRecordedTime} -> POSIX
resultRecordedTime) (\s :: ConformancePackEvaluationResult
s@ConformancePackEvaluationResult' {} POSIX
a -> ConformancePackEvaluationResult
s {$sel:resultRecordedTime:ConformancePackEvaluationResult' :: POSIX
resultRecordedTime = POSIX
a} :: ConformancePackEvaluationResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance
  Data.FromJSON
    ConformancePackEvaluationResult
  where
  parseJSON :: Value -> Parser ConformancePackEvaluationResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConformancePackEvaluationResult"
      ( \Object
x ->
          Maybe Text
-> ConformancePackComplianceType
-> EvaluationResultIdentifier
-> POSIX
-> POSIX
-> ConformancePackEvaluationResult
ConformancePackEvaluationResult'
            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
"Annotation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"EvaluationResultIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConfigRuleInvokedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ResultRecordedTime")
      )

instance
  Prelude.Hashable
    ConformancePackEvaluationResult
  where
  hashWithSalt :: Int -> ConformancePackEvaluationResult -> Int
hashWithSalt
    Int
_salt
    ConformancePackEvaluationResult' {Maybe Text
POSIX
ConformancePackComplianceType
EvaluationResultIdentifier
resultRecordedTime :: POSIX
configRuleInvokedTime :: POSIX
evaluationResultIdentifier :: EvaluationResultIdentifier
complianceType :: ConformancePackComplianceType
annotation :: Maybe Text
$sel:resultRecordedTime:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> POSIX
$sel:configRuleInvokedTime:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> POSIX
$sel:evaluationResultIdentifier:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> EvaluationResultIdentifier
$sel:complianceType:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> ConformancePackComplianceType
$sel:annotation:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
annotation
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConformancePackComplianceType
complianceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EvaluationResultIdentifier
evaluationResultIdentifier
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
configRuleInvokedTime
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
resultRecordedTime

instance
  Prelude.NFData
    ConformancePackEvaluationResult
  where
  rnf :: ConformancePackEvaluationResult -> ()
rnf ConformancePackEvaluationResult' {Maybe Text
POSIX
ConformancePackComplianceType
EvaluationResultIdentifier
resultRecordedTime :: POSIX
configRuleInvokedTime :: POSIX
evaluationResultIdentifier :: EvaluationResultIdentifier
complianceType :: ConformancePackComplianceType
annotation :: Maybe Text
$sel:resultRecordedTime:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> POSIX
$sel:configRuleInvokedTime:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> POSIX
$sel:evaluationResultIdentifier:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> EvaluationResultIdentifier
$sel:complianceType:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> ConformancePackComplianceType
$sel:annotation:ConformancePackEvaluationResult' :: ConformancePackEvaluationResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
annotation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ConformancePackComplianceType
complianceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EvaluationResultIdentifier
evaluationResultIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
configRuleInvokedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
resultRecordedTime