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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the details about the remediation exception.
-- The details include the rule name, an explanation of an exception, the
-- time when the exception will be deleted, the resource ID, and resource
-- type.
--
-- /See:/ 'newRemediationException' smart constructor.
data RemediationException = RemediationException'
  { -- | An explanation of an remediation exception.
    RemediationException -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The time when the remediation exception will be deleted.
    RemediationException -> Maybe POSIX
expirationTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the Config rule.
    RemediationException -> Text
configRuleName :: Prelude.Text,
    -- | The type of a resource.
    RemediationException -> Text
resourceType :: Prelude.Text,
    -- | The ID of the resource (for example., sg-xxxxxx).
    RemediationException -> Text
resourceId :: Prelude.Text
  }
  deriving (RemediationException -> RemediationException -> Bool
(RemediationException -> RemediationException -> Bool)
-> (RemediationException -> RemediationException -> Bool)
-> Eq RemediationException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemediationException -> RemediationException -> Bool
$c/= :: RemediationException -> RemediationException -> Bool
== :: RemediationException -> RemediationException -> Bool
$c== :: RemediationException -> RemediationException -> Bool
Prelude.Eq, ReadPrec [RemediationException]
ReadPrec RemediationException
Int -> ReadS RemediationException
ReadS [RemediationException]
(Int -> ReadS RemediationException)
-> ReadS [RemediationException]
-> ReadPrec RemediationException
-> ReadPrec [RemediationException]
-> Read RemediationException
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemediationException]
$creadListPrec :: ReadPrec [RemediationException]
readPrec :: ReadPrec RemediationException
$creadPrec :: ReadPrec RemediationException
readList :: ReadS [RemediationException]
$creadList :: ReadS [RemediationException]
readsPrec :: Int -> ReadS RemediationException
$creadsPrec :: Int -> ReadS RemediationException
Prelude.Read, Int -> RemediationException -> ShowS
[RemediationException] -> ShowS
RemediationException -> String
(Int -> RemediationException -> ShowS)
-> (RemediationException -> String)
-> ([RemediationException] -> ShowS)
-> Show RemediationException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemediationException] -> ShowS
$cshowList :: [RemediationException] -> ShowS
show :: RemediationException -> String
$cshow :: RemediationException -> String
showsPrec :: Int -> RemediationException -> ShowS
$cshowsPrec :: Int -> RemediationException -> ShowS
Prelude.Show, (forall x. RemediationException -> Rep RemediationException x)
-> (forall x. Rep RemediationException x -> RemediationException)
-> Generic RemediationException
forall x. Rep RemediationException x -> RemediationException
forall x. RemediationException -> Rep RemediationException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemediationException x -> RemediationException
$cfrom :: forall x. RemediationException -> Rep RemediationException x
Prelude.Generic)

-- |
-- Create a value of 'RemediationException' 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:
--
-- 'message', 'remediationException_message' - An explanation of an remediation exception.
--
-- 'expirationTime', 'remediationException_expirationTime' - The time when the remediation exception will be deleted.
--
-- 'configRuleName', 'remediationException_configRuleName' - The name of the Config rule.
--
-- 'resourceType', 'remediationException_resourceType' - The type of a resource.
--
-- 'resourceId', 'remediationException_resourceId' - The ID of the resource (for example., sg-xxxxxx).
newRemediationException ::
  -- | 'configRuleName'
  Prelude.Text ->
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  RemediationException
newRemediationException :: Text -> Text -> Text -> RemediationException
newRemediationException
  Text
pConfigRuleName_
  Text
pResourceType_
  Text
pResourceId_ =
    RemediationException' :: Maybe Text
-> Maybe POSIX -> Text -> Text -> Text -> RemediationException
RemediationException'
      { $sel:message:RemediationException' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:expirationTime:RemediationException' :: Maybe POSIX
expirationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:configRuleName:RemediationException' :: Text
configRuleName = Text
pConfigRuleName_,
        $sel:resourceType:RemediationException' :: Text
resourceType = Text
pResourceType_,
        $sel:resourceId:RemediationException' :: Text
resourceId = Text
pResourceId_
      }

-- | An explanation of an remediation exception.
remediationException_message :: Lens.Lens' RemediationException (Prelude.Maybe Prelude.Text)
remediationException_message :: (Maybe Text -> f (Maybe Text))
-> RemediationException -> f RemediationException
remediationException_message = (RemediationException -> Maybe Text)
-> (RemediationException -> Maybe Text -> RemediationException)
-> Lens
     RemediationException RemediationException (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationException' {Maybe Text
message :: Maybe Text
$sel:message:RemediationException' :: RemediationException -> Maybe Text
message} -> Maybe Text
message) (\s :: RemediationException
s@RemediationException' {} Maybe Text
a -> RemediationException
s {$sel:message:RemediationException' :: Maybe Text
message = Maybe Text
a} :: RemediationException)

-- | The time when the remediation exception will be deleted.
remediationException_expirationTime :: Lens.Lens' RemediationException (Prelude.Maybe Prelude.UTCTime)
remediationException_expirationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RemediationException -> f RemediationException
remediationException_expirationTime = (RemediationException -> Maybe POSIX)
-> (RemediationException -> Maybe POSIX -> RemediationException)
-> Lens
     RemediationException
     RemediationException
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationException' {Maybe POSIX
expirationTime :: Maybe POSIX
$sel:expirationTime:RemediationException' :: RemediationException -> Maybe POSIX
expirationTime} -> Maybe POSIX
expirationTime) (\s :: RemediationException
s@RemediationException' {} Maybe POSIX
a -> RemediationException
s {$sel:expirationTime:RemediationException' :: Maybe POSIX
expirationTime = Maybe POSIX
a} :: RemediationException) ((Maybe POSIX -> f (Maybe POSIX))
 -> RemediationException -> f RemediationException)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RemediationException
-> f RemediationException
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

-- | The name of the Config rule.
remediationException_configRuleName :: Lens.Lens' RemediationException Prelude.Text
remediationException_configRuleName :: (Text -> f Text) -> RemediationException -> f RemediationException
remediationException_configRuleName = (RemediationException -> Text)
-> (RemediationException -> Text -> RemediationException)
-> Lens RemediationException RemediationException Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationException' {Text
configRuleName :: Text
$sel:configRuleName:RemediationException' :: RemediationException -> Text
configRuleName} -> Text
configRuleName) (\s :: RemediationException
s@RemediationException' {} Text
a -> RemediationException
s {$sel:configRuleName:RemediationException' :: Text
configRuleName = Text
a} :: RemediationException)

-- | The type of a resource.
remediationException_resourceType :: Lens.Lens' RemediationException Prelude.Text
remediationException_resourceType :: (Text -> f Text) -> RemediationException -> f RemediationException
remediationException_resourceType = (RemediationException -> Text)
-> (RemediationException -> Text -> RemediationException)
-> Lens RemediationException RemediationException Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationException' {Text
resourceType :: Text
$sel:resourceType:RemediationException' :: RemediationException -> Text
resourceType} -> Text
resourceType) (\s :: RemediationException
s@RemediationException' {} Text
a -> RemediationException
s {$sel:resourceType:RemediationException' :: Text
resourceType = Text
a} :: RemediationException)

-- | The ID of the resource (for example., sg-xxxxxx).
remediationException_resourceId :: Lens.Lens' RemediationException Prelude.Text
remediationException_resourceId :: (Text -> f Text) -> RemediationException -> f RemediationException
remediationException_resourceId = (RemediationException -> Text)
-> (RemediationException -> Text -> RemediationException)
-> Lens RemediationException RemediationException Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationException' {Text
resourceId :: Text
$sel:resourceId:RemediationException' :: RemediationException -> Text
resourceId} -> Text
resourceId) (\s :: RemediationException
s@RemediationException' {} Text
a -> RemediationException
s {$sel:resourceId:RemediationException' :: Text
resourceId = Text
a} :: RemediationException)

instance Core.FromJSON RemediationException where
  parseJSON :: Value -> Parser RemediationException
parseJSON =
    String
-> (Object -> Parser RemediationException)
-> Value
-> Parser RemediationException
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RemediationException"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX -> Text -> Text -> Text -> RemediationException
RemediationException'
            (Maybe Text
 -> Maybe POSIX -> Text -> Text -> Text -> RemediationException)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Text -> Text -> Text -> RemediationException)
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
"Message")
            Parser
  (Maybe POSIX -> Text -> Text -> Text -> RemediationException)
-> Parser (Maybe POSIX)
-> Parser (Text -> Text -> Text -> RemediationException)
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
"ExpirationTime")
            Parser (Text -> Text -> Text -> RemediationException)
-> Parser Text -> Parser (Text -> Text -> RemediationException)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ConfigRuleName")
            Parser (Text -> Text -> RemediationException)
-> Parser Text -> Parser (Text -> RemediationException)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceType")
            Parser (Text -> RemediationException)
-> Parser Text -> Parser RemediationException
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceId")
      )

instance Prelude.Hashable RemediationException

instance Prelude.NFData RemediationException