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

import Amazonka.Config.Types.ConformancePackComplianceType
import Amazonka.Config.Types.EvaluationResultIdentifier
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 :: Core.POSIX,
    -- | The time when Config recorded the evaluation result.
    ConformancePackEvaluationResult -> POSIX
resultRecordedTime :: Core.POSIX
  }
  deriving (ConformancePackEvaluationResult
-> ConformancePackEvaluationResult -> Bool
(ConformancePackEvaluationResult
 -> ConformancePackEvaluationResult -> Bool)
-> (ConformancePackEvaluationResult
    -> ConformancePackEvaluationResult -> Bool)
-> Eq ConformancePackEvaluationResult
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]
(Int -> ReadS ConformancePackEvaluationResult)
-> ReadS [ConformancePackEvaluationResult]
-> ReadPrec ConformancePackEvaluationResult
-> ReadPrec [ConformancePackEvaluationResult]
-> Read 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
(Int -> ConformancePackEvaluationResult -> ShowS)
-> (ConformancePackEvaluationResult -> String)
-> ([ConformancePackEvaluationResult] -> ShowS)
-> Show ConformancePackEvaluationResult
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.
 ConformancePackEvaluationResult
 -> Rep ConformancePackEvaluationResult x)
-> (forall x.
    Rep ConformancePackEvaluationResult x
    -> ConformancePackEvaluationResult)
-> Generic ConformancePackEvaluationResult
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' :: Maybe Text
-> ConformancePackComplianceType
-> EvaluationResultIdentifier
-> POSIX
-> POSIX
-> ConformancePackEvaluationResult
ConformancePackEvaluationResult'
      { $sel:annotation:ConformancePackEvaluationResult' :: Maybe Text
annotation =
          Maybe Text
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 =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
            (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pConfigRuleInvokedTime_,
        $sel:resultRecordedTime:ConformancePackEvaluationResult' :: POSIX
resultRecordedTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
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 :: (Maybe Text -> f (Maybe Text))
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
conformancePackEvaluationResult_annotation = (ConformancePackEvaluationResult -> Maybe Text)
-> (ConformancePackEvaluationResult
    -> Maybe Text -> ConformancePackEvaluationResult)
-> Lens
     ConformancePackEvaluationResult
     ConformancePackEvaluationResult
     (Maybe Text)
     (Maybe Text)
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 :: (ConformancePackComplianceType -> f ConformancePackComplianceType)
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
conformancePackEvaluationResult_complianceType = (ConformancePackEvaluationResult -> ConformancePackComplianceType)
-> (ConformancePackEvaluationResult
    -> ConformancePackComplianceType
    -> ConformancePackEvaluationResult)
-> Lens
     ConformancePackEvaluationResult
     ConformancePackEvaluationResult
     ConformancePackComplianceType
     ConformancePackComplianceType
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 :: (EvaluationResultIdentifier -> f EvaluationResultIdentifier)
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
conformancePackEvaluationResult_evaluationResultIdentifier = (ConformancePackEvaluationResult -> EvaluationResultIdentifier)
-> (ConformancePackEvaluationResult
    -> EvaluationResultIdentifier -> ConformancePackEvaluationResult)
-> Lens
     ConformancePackEvaluationResult
     ConformancePackEvaluationResult
     EvaluationResultIdentifier
     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 :: (UTCTime -> f UTCTime)
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
conformancePackEvaluationResult_configRuleInvokedTime = (ConformancePackEvaluationResult -> POSIX)
-> (ConformancePackEvaluationResult
    -> POSIX -> ConformancePackEvaluationResult)
-> Lens
     ConformancePackEvaluationResult
     ConformancePackEvaluationResult
     POSIX
     POSIX
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) ((POSIX -> f POSIX)
 -> ConformancePackEvaluationResult
 -> f ConformancePackEvaluationResult)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time when Config recorded the evaluation result.
conformancePackEvaluationResult_resultRecordedTime :: Lens.Lens' ConformancePackEvaluationResult Prelude.UTCTime
conformancePackEvaluationResult_resultRecordedTime :: (UTCTime -> f UTCTime)
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
conformancePackEvaluationResult_resultRecordedTime = (ConformancePackEvaluationResult -> POSIX)
-> (ConformancePackEvaluationResult
    -> POSIX -> ConformancePackEvaluationResult)
-> Lens
     ConformancePackEvaluationResult
     ConformancePackEvaluationResult
     POSIX
     POSIX
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) ((POSIX -> f POSIX)
 -> ConformancePackEvaluationResult
 -> f ConformancePackEvaluationResult)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ConformancePackEvaluationResult
-> f ConformancePackEvaluationResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance
  Prelude.Hashable
    ConformancePackEvaluationResult

instance
  Prelude.NFData
    ConformancePackEvaluationResult