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

import Amazonka.Config.Types.RemediationExecutionState
import Amazonka.Config.Types.RemediationExecutionStep
import Amazonka.Config.Types.ResourceKey
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides details of the current status of the invoked remediation action
-- for that resource.
--
-- /See:/ 'newRemediationExecutionStatus' smart constructor.
data RemediationExecutionStatus = RemediationExecutionStatus'
  { -- | ENUM of the values.
    RemediationExecutionStatus -> Maybe RemediationExecutionState
state :: Prelude.Maybe RemediationExecutionState,
    -- | The time when the remediation execution was last updated.
    RemediationExecutionStatus -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Core.POSIX,
    RemediationExecutionStatus -> Maybe ResourceKey
resourceKey :: Prelude.Maybe ResourceKey,
    -- | Details of every step.
    RemediationExecutionStatus -> Maybe [RemediationExecutionStep]
stepDetails :: Prelude.Maybe [RemediationExecutionStep],
    -- | Start time when the remediation was executed.
    RemediationExecutionStatus -> Maybe POSIX
invocationTime :: Prelude.Maybe Core.POSIX
  }
  deriving (RemediationExecutionStatus -> RemediationExecutionStatus -> Bool
(RemediationExecutionStatus -> RemediationExecutionStatus -> Bool)
-> (RemediationExecutionStatus
    -> RemediationExecutionStatus -> Bool)
-> Eq RemediationExecutionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemediationExecutionStatus -> RemediationExecutionStatus -> Bool
$c/= :: RemediationExecutionStatus -> RemediationExecutionStatus -> Bool
== :: RemediationExecutionStatus -> RemediationExecutionStatus -> Bool
$c== :: RemediationExecutionStatus -> RemediationExecutionStatus -> Bool
Prelude.Eq, ReadPrec [RemediationExecutionStatus]
ReadPrec RemediationExecutionStatus
Int -> ReadS RemediationExecutionStatus
ReadS [RemediationExecutionStatus]
(Int -> ReadS RemediationExecutionStatus)
-> ReadS [RemediationExecutionStatus]
-> ReadPrec RemediationExecutionStatus
-> ReadPrec [RemediationExecutionStatus]
-> Read RemediationExecutionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemediationExecutionStatus]
$creadListPrec :: ReadPrec [RemediationExecutionStatus]
readPrec :: ReadPrec RemediationExecutionStatus
$creadPrec :: ReadPrec RemediationExecutionStatus
readList :: ReadS [RemediationExecutionStatus]
$creadList :: ReadS [RemediationExecutionStatus]
readsPrec :: Int -> ReadS RemediationExecutionStatus
$creadsPrec :: Int -> ReadS RemediationExecutionStatus
Prelude.Read, Int -> RemediationExecutionStatus -> ShowS
[RemediationExecutionStatus] -> ShowS
RemediationExecutionStatus -> String
(Int -> RemediationExecutionStatus -> ShowS)
-> (RemediationExecutionStatus -> String)
-> ([RemediationExecutionStatus] -> ShowS)
-> Show RemediationExecutionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemediationExecutionStatus] -> ShowS
$cshowList :: [RemediationExecutionStatus] -> ShowS
show :: RemediationExecutionStatus -> String
$cshow :: RemediationExecutionStatus -> String
showsPrec :: Int -> RemediationExecutionStatus -> ShowS
$cshowsPrec :: Int -> RemediationExecutionStatus -> ShowS
Prelude.Show, (forall x.
 RemediationExecutionStatus -> Rep RemediationExecutionStatus x)
-> (forall x.
    Rep RemediationExecutionStatus x -> RemediationExecutionStatus)
-> Generic RemediationExecutionStatus
forall x.
Rep RemediationExecutionStatus x -> RemediationExecutionStatus
forall x.
RemediationExecutionStatus -> Rep RemediationExecutionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemediationExecutionStatus x -> RemediationExecutionStatus
$cfrom :: forall x.
RemediationExecutionStatus -> Rep RemediationExecutionStatus x
Prelude.Generic)

-- |
-- Create a value of 'RemediationExecutionStatus' 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:
--
-- 'state', 'remediationExecutionStatus_state' - ENUM of the values.
--
-- 'lastUpdatedTime', 'remediationExecutionStatus_lastUpdatedTime' - The time when the remediation execution was last updated.
--
-- 'resourceKey', 'remediationExecutionStatus_resourceKey' - Undocumented member.
--
-- 'stepDetails', 'remediationExecutionStatus_stepDetails' - Details of every step.
--
-- 'invocationTime', 'remediationExecutionStatus_invocationTime' - Start time when the remediation was executed.
newRemediationExecutionStatus ::
  RemediationExecutionStatus
newRemediationExecutionStatus :: RemediationExecutionStatus
newRemediationExecutionStatus =
  RemediationExecutionStatus' :: Maybe RemediationExecutionState
-> Maybe POSIX
-> Maybe ResourceKey
-> Maybe [RemediationExecutionStep]
-> Maybe POSIX
-> RemediationExecutionStatus
RemediationExecutionStatus'
    { $sel:state:RemediationExecutionStatus' :: Maybe RemediationExecutionState
state =
        Maybe RemediationExecutionState
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:RemediationExecutionStatus' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceKey:RemediationExecutionStatus' :: Maybe ResourceKey
resourceKey = Maybe ResourceKey
forall a. Maybe a
Prelude.Nothing,
      $sel:stepDetails:RemediationExecutionStatus' :: Maybe [RemediationExecutionStep]
stepDetails = Maybe [RemediationExecutionStep]
forall a. Maybe a
Prelude.Nothing,
      $sel:invocationTime:RemediationExecutionStatus' :: Maybe POSIX
invocationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | ENUM of the values.
remediationExecutionStatus_state :: Lens.Lens' RemediationExecutionStatus (Prelude.Maybe RemediationExecutionState)
remediationExecutionStatus_state :: (Maybe RemediationExecutionState
 -> f (Maybe RemediationExecutionState))
-> RemediationExecutionStatus -> f RemediationExecutionStatus
remediationExecutionStatus_state = (RemediationExecutionStatus -> Maybe RemediationExecutionState)
-> (RemediationExecutionStatus
    -> Maybe RemediationExecutionState -> RemediationExecutionStatus)
-> Lens
     RemediationExecutionStatus
     RemediationExecutionStatus
     (Maybe RemediationExecutionState)
     (Maybe RemediationExecutionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationExecutionStatus' {Maybe RemediationExecutionState
state :: Maybe RemediationExecutionState
$sel:state:RemediationExecutionStatus' :: RemediationExecutionStatus -> Maybe RemediationExecutionState
state} -> Maybe RemediationExecutionState
state) (\s :: RemediationExecutionStatus
s@RemediationExecutionStatus' {} Maybe RemediationExecutionState
a -> RemediationExecutionStatus
s {$sel:state:RemediationExecutionStatus' :: Maybe RemediationExecutionState
state = Maybe RemediationExecutionState
a} :: RemediationExecutionStatus)

-- | The time when the remediation execution was last updated.
remediationExecutionStatus_lastUpdatedTime :: Lens.Lens' RemediationExecutionStatus (Prelude.Maybe Prelude.UTCTime)
remediationExecutionStatus_lastUpdatedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RemediationExecutionStatus -> f RemediationExecutionStatus
remediationExecutionStatus_lastUpdatedTime = (RemediationExecutionStatus -> Maybe POSIX)
-> (RemediationExecutionStatus
    -> Maybe POSIX -> RemediationExecutionStatus)
-> Lens
     RemediationExecutionStatus
     RemediationExecutionStatus
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationExecutionStatus' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:RemediationExecutionStatus' :: RemediationExecutionStatus -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: RemediationExecutionStatus
s@RemediationExecutionStatus' {} Maybe POSIX
a -> RemediationExecutionStatus
s {$sel:lastUpdatedTime:RemediationExecutionStatus' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: RemediationExecutionStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> RemediationExecutionStatus -> f RemediationExecutionStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RemediationExecutionStatus
-> f RemediationExecutionStatus
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

-- | Undocumented member.
remediationExecutionStatus_resourceKey :: Lens.Lens' RemediationExecutionStatus (Prelude.Maybe ResourceKey)
remediationExecutionStatus_resourceKey :: (Maybe ResourceKey -> f (Maybe ResourceKey))
-> RemediationExecutionStatus -> f RemediationExecutionStatus
remediationExecutionStatus_resourceKey = (RemediationExecutionStatus -> Maybe ResourceKey)
-> (RemediationExecutionStatus
    -> Maybe ResourceKey -> RemediationExecutionStatus)
-> Lens
     RemediationExecutionStatus
     RemediationExecutionStatus
     (Maybe ResourceKey)
     (Maybe ResourceKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationExecutionStatus' {Maybe ResourceKey
resourceKey :: Maybe ResourceKey
$sel:resourceKey:RemediationExecutionStatus' :: RemediationExecutionStatus -> Maybe ResourceKey
resourceKey} -> Maybe ResourceKey
resourceKey) (\s :: RemediationExecutionStatus
s@RemediationExecutionStatus' {} Maybe ResourceKey
a -> RemediationExecutionStatus
s {$sel:resourceKey:RemediationExecutionStatus' :: Maybe ResourceKey
resourceKey = Maybe ResourceKey
a} :: RemediationExecutionStatus)

-- | Details of every step.
remediationExecutionStatus_stepDetails :: Lens.Lens' RemediationExecutionStatus (Prelude.Maybe [RemediationExecutionStep])
remediationExecutionStatus_stepDetails :: (Maybe [RemediationExecutionStep]
 -> f (Maybe [RemediationExecutionStep]))
-> RemediationExecutionStatus -> f RemediationExecutionStatus
remediationExecutionStatus_stepDetails = (RemediationExecutionStatus -> Maybe [RemediationExecutionStep])
-> (RemediationExecutionStatus
    -> Maybe [RemediationExecutionStep] -> RemediationExecutionStatus)
-> Lens
     RemediationExecutionStatus
     RemediationExecutionStatus
     (Maybe [RemediationExecutionStep])
     (Maybe [RemediationExecutionStep])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationExecutionStatus' {Maybe [RemediationExecutionStep]
stepDetails :: Maybe [RemediationExecutionStep]
$sel:stepDetails:RemediationExecutionStatus' :: RemediationExecutionStatus -> Maybe [RemediationExecutionStep]
stepDetails} -> Maybe [RemediationExecutionStep]
stepDetails) (\s :: RemediationExecutionStatus
s@RemediationExecutionStatus' {} Maybe [RemediationExecutionStep]
a -> RemediationExecutionStatus
s {$sel:stepDetails:RemediationExecutionStatus' :: Maybe [RemediationExecutionStep]
stepDetails = Maybe [RemediationExecutionStep]
a} :: RemediationExecutionStatus) ((Maybe [RemediationExecutionStep]
  -> f (Maybe [RemediationExecutionStep]))
 -> RemediationExecutionStatus -> f RemediationExecutionStatus)
-> ((Maybe [RemediationExecutionStep]
     -> f (Maybe [RemediationExecutionStep]))
    -> Maybe [RemediationExecutionStep]
    -> f (Maybe [RemediationExecutionStep]))
-> (Maybe [RemediationExecutionStep]
    -> f (Maybe [RemediationExecutionStep]))
-> RemediationExecutionStatus
-> f RemediationExecutionStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RemediationExecutionStep]
  [RemediationExecutionStep]
  [RemediationExecutionStep]
  [RemediationExecutionStep]
-> Iso
     (Maybe [RemediationExecutionStep])
     (Maybe [RemediationExecutionStep])
     (Maybe [RemediationExecutionStep])
     (Maybe [RemediationExecutionStep])
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
  [RemediationExecutionStep]
  [RemediationExecutionStep]
  [RemediationExecutionStep]
  [RemediationExecutionStep]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Start time when the remediation was executed.
remediationExecutionStatus_invocationTime :: Lens.Lens' RemediationExecutionStatus (Prelude.Maybe Prelude.UTCTime)
remediationExecutionStatus_invocationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RemediationExecutionStatus -> f RemediationExecutionStatus
remediationExecutionStatus_invocationTime = (RemediationExecutionStatus -> Maybe POSIX)
-> (RemediationExecutionStatus
    -> Maybe POSIX -> RemediationExecutionStatus)
-> Lens
     RemediationExecutionStatus
     RemediationExecutionStatus
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationExecutionStatus' {Maybe POSIX
invocationTime :: Maybe POSIX
$sel:invocationTime:RemediationExecutionStatus' :: RemediationExecutionStatus -> Maybe POSIX
invocationTime} -> Maybe POSIX
invocationTime) (\s :: RemediationExecutionStatus
s@RemediationExecutionStatus' {} Maybe POSIX
a -> RemediationExecutionStatus
s {$sel:invocationTime:RemediationExecutionStatus' :: Maybe POSIX
invocationTime = Maybe POSIX
a} :: RemediationExecutionStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> RemediationExecutionStatus -> f RemediationExecutionStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RemediationExecutionStatus
-> f RemediationExecutionStatus
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 RemediationExecutionStatus where
  parseJSON :: Value -> Parser RemediationExecutionStatus
parseJSON =
    String
-> (Object -> Parser RemediationExecutionStatus)
-> Value
-> Parser RemediationExecutionStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RemediationExecutionStatus"
      ( \Object
x ->
          Maybe RemediationExecutionState
-> Maybe POSIX
-> Maybe ResourceKey
-> Maybe [RemediationExecutionStep]
-> Maybe POSIX
-> RemediationExecutionStatus
RemediationExecutionStatus'
            (Maybe RemediationExecutionState
 -> Maybe POSIX
 -> Maybe ResourceKey
 -> Maybe [RemediationExecutionStep]
 -> Maybe POSIX
 -> RemediationExecutionStatus)
-> Parser (Maybe RemediationExecutionState)
-> Parser
     (Maybe POSIX
      -> Maybe ResourceKey
      -> Maybe [RemediationExecutionStep]
      -> Maybe POSIX
      -> RemediationExecutionStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RemediationExecutionState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe POSIX
   -> Maybe ResourceKey
   -> Maybe [RemediationExecutionStep]
   -> Maybe POSIX
   -> RemediationExecutionStatus)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ResourceKey
      -> Maybe [RemediationExecutionStep]
      -> Maybe POSIX
      -> RemediationExecutionStatus)
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
"LastUpdatedTime")
            Parser
  (Maybe ResourceKey
   -> Maybe [RemediationExecutionStep]
   -> Maybe POSIX
   -> RemediationExecutionStatus)
-> Parser (Maybe ResourceKey)
-> Parser
     (Maybe [RemediationExecutionStep]
      -> Maybe POSIX -> RemediationExecutionStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceKey)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceKey")
            Parser
  (Maybe [RemediationExecutionStep]
   -> Maybe POSIX -> RemediationExecutionStatus)
-> Parser (Maybe [RemediationExecutionStep])
-> Parser (Maybe POSIX -> RemediationExecutionStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [RemediationExecutionStep]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StepDetails" Parser (Maybe (Maybe [RemediationExecutionStep]))
-> Maybe [RemediationExecutionStep]
-> Parser (Maybe [RemediationExecutionStep])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RemediationExecutionStep]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe POSIX -> RemediationExecutionStatus)
-> Parser (Maybe POSIX) -> Parser RemediationExecutionStatus
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
"InvocationTime")
      )

instance Prelude.Hashable RemediationExecutionStatus

instance Prelude.NFData RemediationExecutionStatus