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

import Amazonka.Config.Types.ExecutionControls
import Amazonka.Config.Types.RemediationParameterValue
import Amazonka.Config.Types.RemediationTargetType
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
-- configuration that includes the remediation action, parameters, and data
-- to execute the action.
--
-- /See:/ 'newRemediationConfiguration' smart constructor.
data RemediationConfiguration = RemediationConfiguration'
  { -- | The type of a resource.
    RemediationConfiguration -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | Amazon Resource Name (ARN) of remediation configuration.
    RemediationConfiguration -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The remediation is triggered automatically.
    RemediationConfiguration -> Maybe Bool
automatic :: Prelude.Maybe Prelude.Bool,
    -- | Name of the service that owns the service linked rule, if applicable.
    RemediationConfiguration -> Maybe Text
createdByService :: Prelude.Maybe Prelude.Text,
    -- | Maximum time in seconds that Config runs auto-remediation. If you do not
    -- select a number, the default is 60 seconds.
    --
    -- For example, if you specify RetryAttemptSeconds as 50 seconds and
    -- MaximumAutomaticAttempts as 5, Config will run auto-remediations 5 times
    -- within 50 seconds before throwing an exception.
    RemediationConfiguration -> Maybe Natural
retryAttemptSeconds :: Prelude.Maybe Prelude.Natural,
    -- | An ExecutionControls object.
    RemediationConfiguration -> Maybe ExecutionControls
executionControls :: Prelude.Maybe ExecutionControls,
    -- | An object of the RemediationParameterValue.
    RemediationConfiguration
-> Maybe (HashMap Text RemediationParameterValue)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text RemediationParameterValue),
    -- | The maximum number of failed attempts for auto-remediation. If you do
    -- not select a number, the default is 5.
    --
    -- For example, if you specify MaximumAutomaticAttempts as 5 with
    -- RetryAttemptSeconds as 50 seconds, Config will put a
    -- RemediationException on your behalf for the failing resource after the
    -- 5th failed attempt within 50 seconds.
    RemediationConfiguration -> Maybe Natural
maximumAutomaticAttempts :: Prelude.Maybe Prelude.Natural,
    -- | Version of the target. For example, version of the SSM document.
    --
    -- If you make backward incompatible changes to the SSM document, you must
    -- call PutRemediationConfiguration API again to ensure the remediations
    -- can run.
    RemediationConfiguration -> Maybe Text
targetVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the Config rule.
    RemediationConfiguration -> Text
configRuleName :: Prelude.Text,
    -- | The type of the target. Target executes remediation. For example, SSM
    -- document.
    RemediationConfiguration -> RemediationTargetType
targetType :: RemediationTargetType,
    -- | Target ID is the name of the public document.
    RemediationConfiguration -> Text
targetId :: Prelude.Text
  }
  deriving (RemediationConfiguration -> RemediationConfiguration -> Bool
(RemediationConfiguration -> RemediationConfiguration -> Bool)
-> (RemediationConfiguration -> RemediationConfiguration -> Bool)
-> Eq RemediationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemediationConfiguration -> RemediationConfiguration -> Bool
$c/= :: RemediationConfiguration -> RemediationConfiguration -> Bool
== :: RemediationConfiguration -> RemediationConfiguration -> Bool
$c== :: RemediationConfiguration -> RemediationConfiguration -> Bool
Prelude.Eq, ReadPrec [RemediationConfiguration]
ReadPrec RemediationConfiguration
Int -> ReadS RemediationConfiguration
ReadS [RemediationConfiguration]
(Int -> ReadS RemediationConfiguration)
-> ReadS [RemediationConfiguration]
-> ReadPrec RemediationConfiguration
-> ReadPrec [RemediationConfiguration]
-> Read RemediationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemediationConfiguration]
$creadListPrec :: ReadPrec [RemediationConfiguration]
readPrec :: ReadPrec RemediationConfiguration
$creadPrec :: ReadPrec RemediationConfiguration
readList :: ReadS [RemediationConfiguration]
$creadList :: ReadS [RemediationConfiguration]
readsPrec :: Int -> ReadS RemediationConfiguration
$creadsPrec :: Int -> ReadS RemediationConfiguration
Prelude.Read, Int -> RemediationConfiguration -> ShowS
[RemediationConfiguration] -> ShowS
RemediationConfiguration -> String
(Int -> RemediationConfiguration -> ShowS)
-> (RemediationConfiguration -> String)
-> ([RemediationConfiguration] -> ShowS)
-> Show RemediationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemediationConfiguration] -> ShowS
$cshowList :: [RemediationConfiguration] -> ShowS
show :: RemediationConfiguration -> String
$cshow :: RemediationConfiguration -> String
showsPrec :: Int -> RemediationConfiguration -> ShowS
$cshowsPrec :: Int -> RemediationConfiguration -> ShowS
Prelude.Show, (forall x.
 RemediationConfiguration -> Rep RemediationConfiguration x)
-> (forall x.
    Rep RemediationConfiguration x -> RemediationConfiguration)
-> Generic RemediationConfiguration
forall x.
Rep RemediationConfiguration x -> RemediationConfiguration
forall x.
RemediationConfiguration -> Rep RemediationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemediationConfiguration x -> RemediationConfiguration
$cfrom :: forall x.
RemediationConfiguration -> Rep RemediationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'RemediationConfiguration' 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:
--
-- 'resourceType', 'remediationConfiguration_resourceType' - The type of a resource.
--
-- 'arn', 'remediationConfiguration_arn' - Amazon Resource Name (ARN) of remediation configuration.
--
-- 'automatic', 'remediationConfiguration_automatic' - The remediation is triggered automatically.
--
-- 'createdByService', 'remediationConfiguration_createdByService' - Name of the service that owns the service linked rule, if applicable.
--
-- 'retryAttemptSeconds', 'remediationConfiguration_retryAttemptSeconds' - Maximum time in seconds that Config runs auto-remediation. If you do not
-- select a number, the default is 60 seconds.
--
-- For example, if you specify RetryAttemptSeconds as 50 seconds and
-- MaximumAutomaticAttempts as 5, Config will run auto-remediations 5 times
-- within 50 seconds before throwing an exception.
--
-- 'executionControls', 'remediationConfiguration_executionControls' - An ExecutionControls object.
--
-- 'parameters', 'remediationConfiguration_parameters' - An object of the RemediationParameterValue.
--
-- 'maximumAutomaticAttempts', 'remediationConfiguration_maximumAutomaticAttempts' - The maximum number of failed attempts for auto-remediation. If you do
-- not select a number, the default is 5.
--
-- For example, if you specify MaximumAutomaticAttempts as 5 with
-- RetryAttemptSeconds as 50 seconds, Config will put a
-- RemediationException on your behalf for the failing resource after the
-- 5th failed attempt within 50 seconds.
--
-- 'targetVersion', 'remediationConfiguration_targetVersion' - Version of the target. For example, version of the SSM document.
--
-- If you make backward incompatible changes to the SSM document, you must
-- call PutRemediationConfiguration API again to ensure the remediations
-- can run.
--
-- 'configRuleName', 'remediationConfiguration_configRuleName' - The name of the Config rule.
--
-- 'targetType', 'remediationConfiguration_targetType' - The type of the target. Target executes remediation. For example, SSM
-- document.
--
-- 'targetId', 'remediationConfiguration_targetId' - Target ID is the name of the public document.
newRemediationConfiguration ::
  -- | 'configRuleName'
  Prelude.Text ->
  -- | 'targetType'
  RemediationTargetType ->
  -- | 'targetId'
  Prelude.Text ->
  RemediationConfiguration
newRemediationConfiguration :: Text -> RemediationTargetType -> Text -> RemediationConfiguration
newRemediationConfiguration
  Text
pConfigRuleName_
  RemediationTargetType
pTargetType_
  Text
pTargetId_ =
    RemediationConfiguration' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Maybe ExecutionControls
-> Maybe (HashMap Text RemediationParameterValue)
-> Maybe Natural
-> Maybe Text
-> Text
-> RemediationTargetType
-> Text
-> RemediationConfiguration
RemediationConfiguration'
      { $sel:resourceType:RemediationConfiguration' :: Maybe Text
resourceType =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:arn:RemediationConfiguration' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:automatic:RemediationConfiguration' :: Maybe Bool
automatic = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:createdByService:RemediationConfiguration' :: Maybe Text
createdByService = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:retryAttemptSeconds:RemediationConfiguration' :: Maybe Natural
retryAttemptSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:executionControls:RemediationConfiguration' :: Maybe ExecutionControls
executionControls = Maybe ExecutionControls
forall a. Maybe a
Prelude.Nothing,
        $sel:parameters:RemediationConfiguration' :: Maybe (HashMap Text RemediationParameterValue)
parameters = Maybe (HashMap Text RemediationParameterValue)
forall a. Maybe a
Prelude.Nothing,
        $sel:maximumAutomaticAttempts:RemediationConfiguration' :: Maybe Natural
maximumAutomaticAttempts = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:targetVersion:RemediationConfiguration' :: Maybe Text
targetVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:configRuleName:RemediationConfiguration' :: Text
configRuleName = Text
pConfigRuleName_,
        $sel:targetType:RemediationConfiguration' :: RemediationTargetType
targetType = RemediationTargetType
pTargetType_,
        $sel:targetId:RemediationConfiguration' :: Text
targetId = Text
pTargetId_
      }

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

-- | Amazon Resource Name (ARN) of remediation configuration.
remediationConfiguration_arn :: Lens.Lens' RemediationConfiguration (Prelude.Maybe Prelude.Text)
remediationConfiguration_arn :: (Maybe Text -> f (Maybe Text))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_arn = (RemediationConfiguration -> Maybe Text)
-> (RemediationConfiguration
    -> Maybe Text -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe Text
arn :: Maybe Text
$sel:arn:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe Text
a -> RemediationConfiguration
s {$sel:arn:RemediationConfiguration' :: Maybe Text
arn = Maybe Text
a} :: RemediationConfiguration)

-- | The remediation is triggered automatically.
remediationConfiguration_automatic :: Lens.Lens' RemediationConfiguration (Prelude.Maybe Prelude.Bool)
remediationConfiguration_automatic :: (Maybe Bool -> f (Maybe Bool))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_automatic = (RemediationConfiguration -> Maybe Bool)
-> (RemediationConfiguration
    -> Maybe Bool -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe Bool
automatic :: Maybe Bool
$sel:automatic:RemediationConfiguration' :: RemediationConfiguration -> Maybe Bool
automatic} -> Maybe Bool
automatic) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe Bool
a -> RemediationConfiguration
s {$sel:automatic:RemediationConfiguration' :: Maybe Bool
automatic = Maybe Bool
a} :: RemediationConfiguration)

-- | Name of the service that owns the service linked rule, if applicable.
remediationConfiguration_createdByService :: Lens.Lens' RemediationConfiguration (Prelude.Maybe Prelude.Text)
remediationConfiguration_createdByService :: (Maybe Text -> f (Maybe Text))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_createdByService = (RemediationConfiguration -> Maybe Text)
-> (RemediationConfiguration
    -> Maybe Text -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe Text
createdByService :: Maybe Text
$sel:createdByService:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
createdByService} -> Maybe Text
createdByService) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe Text
a -> RemediationConfiguration
s {$sel:createdByService:RemediationConfiguration' :: Maybe Text
createdByService = Maybe Text
a} :: RemediationConfiguration)

-- | Maximum time in seconds that Config runs auto-remediation. If you do not
-- select a number, the default is 60 seconds.
--
-- For example, if you specify RetryAttemptSeconds as 50 seconds and
-- MaximumAutomaticAttempts as 5, Config will run auto-remediations 5 times
-- within 50 seconds before throwing an exception.
remediationConfiguration_retryAttemptSeconds :: Lens.Lens' RemediationConfiguration (Prelude.Maybe Prelude.Natural)
remediationConfiguration_retryAttemptSeconds :: (Maybe Natural -> f (Maybe Natural))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_retryAttemptSeconds = (RemediationConfiguration -> Maybe Natural)
-> (RemediationConfiguration
    -> Maybe Natural -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe Natural
retryAttemptSeconds :: Maybe Natural
$sel:retryAttemptSeconds:RemediationConfiguration' :: RemediationConfiguration -> Maybe Natural
retryAttemptSeconds} -> Maybe Natural
retryAttemptSeconds) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe Natural
a -> RemediationConfiguration
s {$sel:retryAttemptSeconds:RemediationConfiguration' :: Maybe Natural
retryAttemptSeconds = Maybe Natural
a} :: RemediationConfiguration)

-- | An ExecutionControls object.
remediationConfiguration_executionControls :: Lens.Lens' RemediationConfiguration (Prelude.Maybe ExecutionControls)
remediationConfiguration_executionControls :: (Maybe ExecutionControls -> f (Maybe ExecutionControls))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_executionControls = (RemediationConfiguration -> Maybe ExecutionControls)
-> (RemediationConfiguration
    -> Maybe ExecutionControls -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe ExecutionControls)
     (Maybe ExecutionControls)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe ExecutionControls
executionControls :: Maybe ExecutionControls
$sel:executionControls:RemediationConfiguration' :: RemediationConfiguration -> Maybe ExecutionControls
executionControls} -> Maybe ExecutionControls
executionControls) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe ExecutionControls
a -> RemediationConfiguration
s {$sel:executionControls:RemediationConfiguration' :: Maybe ExecutionControls
executionControls = Maybe ExecutionControls
a} :: RemediationConfiguration)

-- | An object of the RemediationParameterValue.
remediationConfiguration_parameters :: Lens.Lens' RemediationConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text RemediationParameterValue))
remediationConfiguration_parameters :: (Maybe (HashMap Text RemediationParameterValue)
 -> f (Maybe (HashMap Text RemediationParameterValue)))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_parameters = (RemediationConfiguration
 -> Maybe (HashMap Text RemediationParameterValue))
-> (RemediationConfiguration
    -> Maybe (HashMap Text RemediationParameterValue)
    -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe (HashMap Text RemediationParameterValue))
     (Maybe (HashMap Text RemediationParameterValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe (HashMap Text RemediationParameterValue)
parameters :: Maybe (HashMap Text RemediationParameterValue)
$sel:parameters:RemediationConfiguration' :: RemediationConfiguration
-> Maybe (HashMap Text RemediationParameterValue)
parameters} -> Maybe (HashMap Text RemediationParameterValue)
parameters) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe (HashMap Text RemediationParameterValue)
a -> RemediationConfiguration
s {$sel:parameters:RemediationConfiguration' :: Maybe (HashMap Text RemediationParameterValue)
parameters = Maybe (HashMap Text RemediationParameterValue)
a} :: RemediationConfiguration) ((Maybe (HashMap Text RemediationParameterValue)
  -> f (Maybe (HashMap Text RemediationParameterValue)))
 -> RemediationConfiguration -> f RemediationConfiguration)
-> ((Maybe (HashMap Text RemediationParameterValue)
     -> f (Maybe (HashMap Text RemediationParameterValue)))
    -> Maybe (HashMap Text RemediationParameterValue)
    -> f (Maybe (HashMap Text RemediationParameterValue)))
-> (Maybe (HashMap Text RemediationParameterValue)
    -> f (Maybe (HashMap Text RemediationParameterValue)))
-> RemediationConfiguration
-> f RemediationConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text RemediationParameterValue)
  (HashMap Text RemediationParameterValue)
  (HashMap Text RemediationParameterValue)
  (HashMap Text RemediationParameterValue)
-> Iso
     (Maybe (HashMap Text RemediationParameterValue))
     (Maybe (HashMap Text RemediationParameterValue))
     (Maybe (HashMap Text RemediationParameterValue))
     (Maybe (HashMap Text RemediationParameterValue))
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
  (HashMap Text RemediationParameterValue)
  (HashMap Text RemediationParameterValue)
  (HashMap Text RemediationParameterValue)
  (HashMap Text RemediationParameterValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of failed attempts for auto-remediation. If you do
-- not select a number, the default is 5.
--
-- For example, if you specify MaximumAutomaticAttempts as 5 with
-- RetryAttemptSeconds as 50 seconds, Config will put a
-- RemediationException on your behalf for the failing resource after the
-- 5th failed attempt within 50 seconds.
remediationConfiguration_maximumAutomaticAttempts :: Lens.Lens' RemediationConfiguration (Prelude.Maybe Prelude.Natural)
remediationConfiguration_maximumAutomaticAttempts :: (Maybe Natural -> f (Maybe Natural))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_maximumAutomaticAttempts = (RemediationConfiguration -> Maybe Natural)
-> (RemediationConfiguration
    -> Maybe Natural -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe Natural
maximumAutomaticAttempts :: Maybe Natural
$sel:maximumAutomaticAttempts:RemediationConfiguration' :: RemediationConfiguration -> Maybe Natural
maximumAutomaticAttempts} -> Maybe Natural
maximumAutomaticAttempts) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe Natural
a -> RemediationConfiguration
s {$sel:maximumAutomaticAttempts:RemediationConfiguration' :: Maybe Natural
maximumAutomaticAttempts = Maybe Natural
a} :: RemediationConfiguration)

-- | Version of the target. For example, version of the SSM document.
--
-- If you make backward incompatible changes to the SSM document, you must
-- call PutRemediationConfiguration API again to ensure the remediations
-- can run.
remediationConfiguration_targetVersion :: Lens.Lens' RemediationConfiguration (Prelude.Maybe Prelude.Text)
remediationConfiguration_targetVersion :: (Maybe Text -> f (Maybe Text))
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_targetVersion = (RemediationConfiguration -> Maybe Text)
-> (RemediationConfiguration
    -> Maybe Text -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Maybe Text
targetVersion :: Maybe Text
$sel:targetVersion:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
targetVersion} -> Maybe Text
targetVersion) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Maybe Text
a -> RemediationConfiguration
s {$sel:targetVersion:RemediationConfiguration' :: Maybe Text
targetVersion = Maybe Text
a} :: RemediationConfiguration)

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

-- | The type of the target. Target executes remediation. For example, SSM
-- document.
remediationConfiguration_targetType :: Lens.Lens' RemediationConfiguration RemediationTargetType
remediationConfiguration_targetType :: (RemediationTargetType -> f RemediationTargetType)
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_targetType = (RemediationConfiguration -> RemediationTargetType)
-> (RemediationConfiguration
    -> RemediationTargetType -> RemediationConfiguration)
-> Lens
     RemediationConfiguration
     RemediationConfiguration
     RemediationTargetType
     RemediationTargetType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {RemediationTargetType
targetType :: RemediationTargetType
$sel:targetType:RemediationConfiguration' :: RemediationConfiguration -> RemediationTargetType
targetType} -> RemediationTargetType
targetType) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} RemediationTargetType
a -> RemediationConfiguration
s {$sel:targetType:RemediationConfiguration' :: RemediationTargetType
targetType = RemediationTargetType
a} :: RemediationConfiguration)

-- | Target ID is the name of the public document.
remediationConfiguration_targetId :: Lens.Lens' RemediationConfiguration Prelude.Text
remediationConfiguration_targetId :: (Text -> f Text)
-> RemediationConfiguration -> f RemediationConfiguration
remediationConfiguration_targetId = (RemediationConfiguration -> Text)
-> (RemediationConfiguration -> Text -> RemediationConfiguration)
-> Lens RemediationConfiguration RemediationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationConfiguration' {Text
targetId :: Text
$sel:targetId:RemediationConfiguration' :: RemediationConfiguration -> Text
targetId} -> Text
targetId) (\s :: RemediationConfiguration
s@RemediationConfiguration' {} Text
a -> RemediationConfiguration
s {$sel:targetId:RemediationConfiguration' :: Text
targetId = Text
a} :: RemediationConfiguration)

instance Core.FromJSON RemediationConfiguration where
  parseJSON :: Value -> Parser RemediationConfiguration
parseJSON =
    String
-> (Object -> Parser RemediationConfiguration)
-> Value
-> Parser RemediationConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RemediationConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Maybe ExecutionControls
-> Maybe (HashMap Text RemediationParameterValue)
-> Maybe Natural
-> Maybe Text
-> Text
-> RemediationTargetType
-> Text
-> RemediationConfiguration
RemediationConfiguration'
            (Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Natural
 -> Maybe ExecutionControls
 -> Maybe (HashMap Text RemediationParameterValue)
 -> Maybe Natural
 -> Maybe Text
 -> Text
 -> RemediationTargetType
 -> Text
 -> RemediationConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Natural
      -> Maybe ExecutionControls
      -> Maybe (HashMap Text RemediationParameterValue)
      -> Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
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
"ResourceType")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Natural
   -> Maybe ExecutionControls
   -> Maybe (HashMap Text RemediationParameterValue)
   -> Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Natural
      -> Maybe ExecutionControls
      -> Maybe (HashMap Text RemediationParameterValue)
      -> Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => 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
"Arn")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Natural
   -> Maybe ExecutionControls
   -> Maybe (HashMap Text RemediationParameterValue)
   -> Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe ExecutionControls
      -> Maybe (HashMap Text RemediationParameterValue)
      -> Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Automatic")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe ExecutionControls
   -> Maybe (HashMap Text RemediationParameterValue)
   -> Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe ExecutionControls
      -> Maybe (HashMap Text RemediationParameterValue)
      -> Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => 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
"CreatedByService")
            Parser
  (Maybe Natural
   -> Maybe ExecutionControls
   -> Maybe (HashMap Text RemediationParameterValue)
   -> Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe Natural)
-> Parser
     (Maybe ExecutionControls
      -> Maybe (HashMap Text RemediationParameterValue)
      -> Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RetryAttemptSeconds")
            Parser
  (Maybe ExecutionControls
   -> Maybe (HashMap Text RemediationParameterValue)
   -> Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe ExecutionControls)
-> Parser
     (Maybe (HashMap Text RemediationParameterValue)
      -> Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ExecutionControls)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExecutionControls")
            Parser
  (Maybe (HashMap Text RemediationParameterValue)
   -> Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe (HashMap Text RemediationParameterValue))
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap Text RemediationParameterValue)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parameters" Parser (Maybe (Maybe (HashMap Text RemediationParameterValue)))
-> Maybe (HashMap Text RemediationParameterValue)
-> Parser (Maybe (HashMap Text RemediationParameterValue))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text RemediationParameterValue)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Text
      -> RemediationTargetType
      -> Text
      -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaximumAutomaticAttempts")
            Parser
  (Maybe Text
   -> Text
   -> RemediationTargetType
   -> Text
   -> RemediationConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Text -> RemediationTargetType -> Text -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => 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
"TargetVersion")
            Parser
  (Text -> RemediationTargetType -> Text -> RemediationConfiguration)
-> Parser Text
-> Parser
     (RemediationTargetType -> Text -> RemediationConfiguration)
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 (RemediationTargetType -> Text -> RemediationConfiguration)
-> Parser RemediationTargetType
-> Parser (Text -> RemediationConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RemediationTargetType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TargetType")
            Parser (Text -> RemediationConfiguration)
-> Parser Text -> Parser RemediationConfiguration
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
"TargetId")
      )

instance Prelude.Hashable RemediationConfiguration

instance Prelude.NFData RemediationConfiguration

instance Core.ToJSON RemediationConfiguration where
  toJSON :: RemediationConfiguration -> Value
toJSON RemediationConfiguration' {Maybe Bool
Maybe Natural
Maybe Text
Maybe (HashMap Text RemediationParameterValue)
Maybe ExecutionControls
Text
RemediationTargetType
targetId :: Text
targetType :: RemediationTargetType
configRuleName :: Text
targetVersion :: Maybe Text
maximumAutomaticAttempts :: Maybe Natural
parameters :: Maybe (HashMap Text RemediationParameterValue)
executionControls :: Maybe ExecutionControls
retryAttemptSeconds :: Maybe Natural
createdByService :: Maybe Text
automatic :: Maybe Bool
arn :: Maybe Text
resourceType :: Maybe Text
$sel:targetId:RemediationConfiguration' :: RemediationConfiguration -> Text
$sel:targetType:RemediationConfiguration' :: RemediationConfiguration -> RemediationTargetType
$sel:configRuleName:RemediationConfiguration' :: RemediationConfiguration -> Text
$sel:targetVersion:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
$sel:maximumAutomaticAttempts:RemediationConfiguration' :: RemediationConfiguration -> Maybe Natural
$sel:parameters:RemediationConfiguration' :: RemediationConfiguration
-> Maybe (HashMap Text RemediationParameterValue)
$sel:executionControls:RemediationConfiguration' :: RemediationConfiguration -> Maybe ExecutionControls
$sel:retryAttemptSeconds:RemediationConfiguration' :: RemediationConfiguration -> Maybe Natural
$sel:createdByService:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
$sel:automatic:RemediationConfiguration' :: RemediationConfiguration -> Maybe Bool
$sel:arn:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
$sel:resourceType:RemediationConfiguration' :: RemediationConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceType,
            (Text
"Arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
arn,
            (Text
"Automatic" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
automatic,
            (Text
"CreatedByService" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
createdByService,
            (Text
"RetryAttemptSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
retryAttemptSeconds,
            (Text
"ExecutionControls" Text -> ExecutionControls -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ExecutionControls -> Pair)
-> Maybe ExecutionControls -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExecutionControls
executionControls,
            (Text
"Parameters" Text -> HashMap Text RemediationParameterValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text RemediationParameterValue -> Pair)
-> Maybe (HashMap Text RemediationParameterValue) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text RemediationParameterValue)
parameters,
            (Text
"MaximumAutomaticAttempts" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumAutomaticAttempts,
            (Text
"TargetVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
targetVersion,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ConfigRuleName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
configRuleName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TargetType" Text -> RemediationTargetType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RemediationTargetType
targetType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TargetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetId)
          ]
      )