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

import Amazonka.Config.Types.EvaluationResultQualifier
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Uniquely identifies an evaluation result.
--
-- /See:/ 'newEvaluationResultIdentifier' smart constructor.
data EvaluationResultIdentifier = EvaluationResultIdentifier'
  { -- | Identifies an Config rule used to evaluate an Amazon Web Services
    -- resource, and provides the type and ID of the evaluated resource.
    EvaluationResultIdentifier -> Maybe EvaluationResultQualifier
evaluationResultQualifier :: Prelude.Maybe EvaluationResultQualifier,
    -- | The time of the event that triggered the evaluation of your Amazon Web
    -- Services resources. The time can indicate when Config delivered a
    -- configuration item change notification, or it can indicate when Config
    -- delivered the configuration snapshot, depending on which event triggered
    -- the evaluation.
    EvaluationResultIdentifier -> Maybe POSIX
orderingTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (EvaluationResultIdentifier -> EvaluationResultIdentifier -> Bool
(EvaluationResultIdentifier -> EvaluationResultIdentifier -> Bool)
-> (EvaluationResultIdentifier
    -> EvaluationResultIdentifier -> Bool)
-> Eq EvaluationResultIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EvaluationResultIdentifier -> EvaluationResultIdentifier -> Bool
$c/= :: EvaluationResultIdentifier -> EvaluationResultIdentifier -> Bool
== :: EvaluationResultIdentifier -> EvaluationResultIdentifier -> Bool
$c== :: EvaluationResultIdentifier -> EvaluationResultIdentifier -> Bool
Prelude.Eq, ReadPrec [EvaluationResultIdentifier]
ReadPrec EvaluationResultIdentifier
Int -> ReadS EvaluationResultIdentifier
ReadS [EvaluationResultIdentifier]
(Int -> ReadS EvaluationResultIdentifier)
-> ReadS [EvaluationResultIdentifier]
-> ReadPrec EvaluationResultIdentifier
-> ReadPrec [EvaluationResultIdentifier]
-> Read EvaluationResultIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EvaluationResultIdentifier]
$creadListPrec :: ReadPrec [EvaluationResultIdentifier]
readPrec :: ReadPrec EvaluationResultIdentifier
$creadPrec :: ReadPrec EvaluationResultIdentifier
readList :: ReadS [EvaluationResultIdentifier]
$creadList :: ReadS [EvaluationResultIdentifier]
readsPrec :: Int -> ReadS EvaluationResultIdentifier
$creadsPrec :: Int -> ReadS EvaluationResultIdentifier
Prelude.Read, Int -> EvaluationResultIdentifier -> ShowS
[EvaluationResultIdentifier] -> ShowS
EvaluationResultIdentifier -> String
(Int -> EvaluationResultIdentifier -> ShowS)
-> (EvaluationResultIdentifier -> String)
-> ([EvaluationResultIdentifier] -> ShowS)
-> Show EvaluationResultIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvaluationResultIdentifier] -> ShowS
$cshowList :: [EvaluationResultIdentifier] -> ShowS
show :: EvaluationResultIdentifier -> String
$cshow :: EvaluationResultIdentifier -> String
showsPrec :: Int -> EvaluationResultIdentifier -> ShowS
$cshowsPrec :: Int -> EvaluationResultIdentifier -> ShowS
Prelude.Show, (forall x.
 EvaluationResultIdentifier -> Rep EvaluationResultIdentifier x)
-> (forall x.
    Rep EvaluationResultIdentifier x -> EvaluationResultIdentifier)
-> Generic EvaluationResultIdentifier
forall x.
Rep EvaluationResultIdentifier x -> EvaluationResultIdentifier
forall x.
EvaluationResultIdentifier -> Rep EvaluationResultIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EvaluationResultIdentifier x -> EvaluationResultIdentifier
$cfrom :: forall x.
EvaluationResultIdentifier -> Rep EvaluationResultIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'EvaluationResultIdentifier' 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:
--
-- 'evaluationResultQualifier', 'evaluationResultIdentifier_evaluationResultQualifier' - Identifies an Config rule used to evaluate an Amazon Web Services
-- resource, and provides the type and ID of the evaluated resource.
--
-- 'orderingTimestamp', 'evaluationResultIdentifier_orderingTimestamp' - The time of the event that triggered the evaluation of your Amazon Web
-- Services resources. The time can indicate when Config delivered a
-- configuration item change notification, or it can indicate when Config
-- delivered the configuration snapshot, depending on which event triggered
-- the evaluation.
newEvaluationResultIdentifier ::
  EvaluationResultIdentifier
newEvaluationResultIdentifier :: EvaluationResultIdentifier
newEvaluationResultIdentifier =
  EvaluationResultIdentifier' :: Maybe EvaluationResultQualifier
-> Maybe POSIX -> EvaluationResultIdentifier
EvaluationResultIdentifier'
    { $sel:evaluationResultQualifier:EvaluationResultIdentifier' :: Maybe EvaluationResultQualifier
evaluationResultQualifier =
        Maybe EvaluationResultQualifier
forall a. Maybe a
Prelude.Nothing,
      $sel:orderingTimestamp:EvaluationResultIdentifier' :: Maybe POSIX
orderingTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | Identifies an Config rule used to evaluate an Amazon Web Services
-- resource, and provides the type and ID of the evaluated resource.
evaluationResultIdentifier_evaluationResultQualifier :: Lens.Lens' EvaluationResultIdentifier (Prelude.Maybe EvaluationResultQualifier)
evaluationResultIdentifier_evaluationResultQualifier :: (Maybe EvaluationResultQualifier
 -> f (Maybe EvaluationResultQualifier))
-> EvaluationResultIdentifier -> f EvaluationResultIdentifier
evaluationResultIdentifier_evaluationResultQualifier = (EvaluationResultIdentifier -> Maybe EvaluationResultQualifier)
-> (EvaluationResultIdentifier
    -> Maybe EvaluationResultQualifier -> EvaluationResultIdentifier)
-> Lens
     EvaluationResultIdentifier
     EvaluationResultIdentifier
     (Maybe EvaluationResultQualifier)
     (Maybe EvaluationResultQualifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResultIdentifier' {Maybe EvaluationResultQualifier
evaluationResultQualifier :: Maybe EvaluationResultQualifier
$sel:evaluationResultQualifier:EvaluationResultIdentifier' :: EvaluationResultIdentifier -> Maybe EvaluationResultQualifier
evaluationResultQualifier} -> Maybe EvaluationResultQualifier
evaluationResultQualifier) (\s :: EvaluationResultIdentifier
s@EvaluationResultIdentifier' {} Maybe EvaluationResultQualifier
a -> EvaluationResultIdentifier
s {$sel:evaluationResultQualifier:EvaluationResultIdentifier' :: Maybe EvaluationResultQualifier
evaluationResultQualifier = Maybe EvaluationResultQualifier
a} :: EvaluationResultIdentifier)

-- | The time of the event that triggered the evaluation of your Amazon Web
-- Services resources. The time can indicate when Config delivered a
-- configuration item change notification, or it can indicate when Config
-- delivered the configuration snapshot, depending on which event triggered
-- the evaluation.
evaluationResultIdentifier_orderingTimestamp :: Lens.Lens' EvaluationResultIdentifier (Prelude.Maybe Prelude.UTCTime)
evaluationResultIdentifier_orderingTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EvaluationResultIdentifier -> f EvaluationResultIdentifier
evaluationResultIdentifier_orderingTimestamp = (EvaluationResultIdentifier -> Maybe POSIX)
-> (EvaluationResultIdentifier
    -> Maybe POSIX -> EvaluationResultIdentifier)
-> Lens
     EvaluationResultIdentifier
     EvaluationResultIdentifier
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResultIdentifier' {Maybe POSIX
orderingTimestamp :: Maybe POSIX
$sel:orderingTimestamp:EvaluationResultIdentifier' :: EvaluationResultIdentifier -> Maybe POSIX
orderingTimestamp} -> Maybe POSIX
orderingTimestamp) (\s :: EvaluationResultIdentifier
s@EvaluationResultIdentifier' {} Maybe POSIX
a -> EvaluationResultIdentifier
s {$sel:orderingTimestamp:EvaluationResultIdentifier' :: Maybe POSIX
orderingTimestamp = Maybe POSIX
a} :: EvaluationResultIdentifier) ((Maybe POSIX -> f (Maybe POSIX))
 -> EvaluationResultIdentifier -> f EvaluationResultIdentifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EvaluationResultIdentifier
-> f EvaluationResultIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON EvaluationResultIdentifier where
  parseJSON :: Value -> Parser EvaluationResultIdentifier
parseJSON =
    String
-> (Object -> Parser EvaluationResultIdentifier)
-> Value
-> Parser EvaluationResultIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EvaluationResultIdentifier"
      ( \Object
x ->
          Maybe EvaluationResultQualifier
-> Maybe POSIX -> EvaluationResultIdentifier
EvaluationResultIdentifier'
            (Maybe EvaluationResultQualifier
 -> Maybe POSIX -> EvaluationResultIdentifier)
-> Parser (Maybe EvaluationResultQualifier)
-> Parser (Maybe POSIX -> EvaluationResultIdentifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EvaluationResultQualifier)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EvaluationResultQualifier")
            Parser (Maybe POSIX -> EvaluationResultIdentifier)
-> Parser (Maybe POSIX) -> Parser EvaluationResultIdentifier
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OrderingTimestamp")
      )

instance Prelude.Hashable EvaluationResultIdentifier

instance Prelude.NFData EvaluationResultIdentifier