{-# 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.FMS.Types.SecurityGroupRemediationAction
-- 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.FMS.Types.SecurityGroupRemediationAction where

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types.RemediationActionType
import Amazonka.FMS.Types.SecurityGroupRuleDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Remediation option for the rule specified in the @ViolationTarget@.
--
-- /See:/ 'newSecurityGroupRemediationAction' smart constructor.
data SecurityGroupRemediationAction = SecurityGroupRemediationAction'
  { -- | Indicates if the current action is the default action.
    SecurityGroupRemediationAction -> Maybe Bool
isDefaultAction :: Prelude.Maybe Prelude.Bool,
    -- | The final state of the rule specified in the @ViolationTarget@ after it
    -- is remediated.
    SecurityGroupRemediationAction
-> Maybe SecurityGroupRuleDescription
remediationResult :: Prelude.Maybe SecurityGroupRuleDescription,
    -- | Brief description of the action that will be performed.
    SecurityGroupRemediationAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The remediation action that will be performed.
    SecurityGroupRemediationAction -> Maybe RemediationActionType
remediationActionType :: Prelude.Maybe RemediationActionType
  }
  deriving (SecurityGroupRemediationAction
-> SecurityGroupRemediationAction -> Bool
(SecurityGroupRemediationAction
 -> SecurityGroupRemediationAction -> Bool)
-> (SecurityGroupRemediationAction
    -> SecurityGroupRemediationAction -> Bool)
-> Eq SecurityGroupRemediationAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityGroupRemediationAction
-> SecurityGroupRemediationAction -> Bool
$c/= :: SecurityGroupRemediationAction
-> SecurityGroupRemediationAction -> Bool
== :: SecurityGroupRemediationAction
-> SecurityGroupRemediationAction -> Bool
$c== :: SecurityGroupRemediationAction
-> SecurityGroupRemediationAction -> Bool
Prelude.Eq, ReadPrec [SecurityGroupRemediationAction]
ReadPrec SecurityGroupRemediationAction
Int -> ReadS SecurityGroupRemediationAction
ReadS [SecurityGroupRemediationAction]
(Int -> ReadS SecurityGroupRemediationAction)
-> ReadS [SecurityGroupRemediationAction]
-> ReadPrec SecurityGroupRemediationAction
-> ReadPrec [SecurityGroupRemediationAction]
-> Read SecurityGroupRemediationAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityGroupRemediationAction]
$creadListPrec :: ReadPrec [SecurityGroupRemediationAction]
readPrec :: ReadPrec SecurityGroupRemediationAction
$creadPrec :: ReadPrec SecurityGroupRemediationAction
readList :: ReadS [SecurityGroupRemediationAction]
$creadList :: ReadS [SecurityGroupRemediationAction]
readsPrec :: Int -> ReadS SecurityGroupRemediationAction
$creadsPrec :: Int -> ReadS SecurityGroupRemediationAction
Prelude.Read, Int -> SecurityGroupRemediationAction -> ShowS
[SecurityGroupRemediationAction] -> ShowS
SecurityGroupRemediationAction -> String
(Int -> SecurityGroupRemediationAction -> ShowS)
-> (SecurityGroupRemediationAction -> String)
-> ([SecurityGroupRemediationAction] -> ShowS)
-> Show SecurityGroupRemediationAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityGroupRemediationAction] -> ShowS
$cshowList :: [SecurityGroupRemediationAction] -> ShowS
show :: SecurityGroupRemediationAction -> String
$cshow :: SecurityGroupRemediationAction -> String
showsPrec :: Int -> SecurityGroupRemediationAction -> ShowS
$cshowsPrec :: Int -> SecurityGroupRemediationAction -> ShowS
Prelude.Show, (forall x.
 SecurityGroupRemediationAction
 -> Rep SecurityGroupRemediationAction x)
-> (forall x.
    Rep SecurityGroupRemediationAction x
    -> SecurityGroupRemediationAction)
-> Generic SecurityGroupRemediationAction
forall x.
Rep SecurityGroupRemediationAction x
-> SecurityGroupRemediationAction
forall x.
SecurityGroupRemediationAction
-> Rep SecurityGroupRemediationAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SecurityGroupRemediationAction x
-> SecurityGroupRemediationAction
$cfrom :: forall x.
SecurityGroupRemediationAction
-> Rep SecurityGroupRemediationAction x
Prelude.Generic)

-- |
-- Create a value of 'SecurityGroupRemediationAction' 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:
--
-- 'isDefaultAction', 'securityGroupRemediationAction_isDefaultAction' - Indicates if the current action is the default action.
--
-- 'remediationResult', 'securityGroupRemediationAction_remediationResult' - The final state of the rule specified in the @ViolationTarget@ after it
-- is remediated.
--
-- 'description', 'securityGroupRemediationAction_description' - Brief description of the action that will be performed.
--
-- 'remediationActionType', 'securityGroupRemediationAction_remediationActionType' - The remediation action that will be performed.
newSecurityGroupRemediationAction ::
  SecurityGroupRemediationAction
newSecurityGroupRemediationAction :: SecurityGroupRemediationAction
newSecurityGroupRemediationAction =
  SecurityGroupRemediationAction' :: Maybe Bool
-> Maybe SecurityGroupRuleDescription
-> Maybe Text
-> Maybe RemediationActionType
-> SecurityGroupRemediationAction
SecurityGroupRemediationAction'
    { $sel:isDefaultAction:SecurityGroupRemediationAction' :: Maybe Bool
isDefaultAction =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:remediationResult:SecurityGroupRemediationAction' :: Maybe SecurityGroupRuleDescription
remediationResult = Maybe SecurityGroupRuleDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:description:SecurityGroupRemediationAction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:remediationActionType:SecurityGroupRemediationAction' :: Maybe RemediationActionType
remediationActionType = Maybe RemediationActionType
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates if the current action is the default action.
securityGroupRemediationAction_isDefaultAction :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe Prelude.Bool)
securityGroupRemediationAction_isDefaultAction :: (Maybe Bool -> f (Maybe Bool))
-> SecurityGroupRemediationAction
-> f SecurityGroupRemediationAction
securityGroupRemediationAction_isDefaultAction = (SecurityGroupRemediationAction -> Maybe Bool)
-> (SecurityGroupRemediationAction
    -> Maybe Bool -> SecurityGroupRemediationAction)
-> Lens
     SecurityGroupRemediationAction
     SecurityGroupRemediationAction
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupRemediationAction' {Maybe Bool
isDefaultAction :: Maybe Bool
$sel:isDefaultAction:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe Bool
isDefaultAction} -> Maybe Bool
isDefaultAction) (\s :: SecurityGroupRemediationAction
s@SecurityGroupRemediationAction' {} Maybe Bool
a -> SecurityGroupRemediationAction
s {$sel:isDefaultAction:SecurityGroupRemediationAction' :: Maybe Bool
isDefaultAction = Maybe Bool
a} :: SecurityGroupRemediationAction)

-- | The final state of the rule specified in the @ViolationTarget@ after it
-- is remediated.
securityGroupRemediationAction_remediationResult :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe SecurityGroupRuleDescription)
securityGroupRemediationAction_remediationResult :: (Maybe SecurityGroupRuleDescription
 -> f (Maybe SecurityGroupRuleDescription))
-> SecurityGroupRemediationAction
-> f SecurityGroupRemediationAction
securityGroupRemediationAction_remediationResult = (SecurityGroupRemediationAction
 -> Maybe SecurityGroupRuleDescription)
-> (SecurityGroupRemediationAction
    -> Maybe SecurityGroupRuleDescription
    -> SecurityGroupRemediationAction)
-> Lens
     SecurityGroupRemediationAction
     SecurityGroupRemediationAction
     (Maybe SecurityGroupRuleDescription)
     (Maybe SecurityGroupRuleDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupRemediationAction' {Maybe SecurityGroupRuleDescription
remediationResult :: Maybe SecurityGroupRuleDescription
$sel:remediationResult:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction
-> Maybe SecurityGroupRuleDescription
remediationResult} -> Maybe SecurityGroupRuleDescription
remediationResult) (\s :: SecurityGroupRemediationAction
s@SecurityGroupRemediationAction' {} Maybe SecurityGroupRuleDescription
a -> SecurityGroupRemediationAction
s {$sel:remediationResult:SecurityGroupRemediationAction' :: Maybe SecurityGroupRuleDescription
remediationResult = Maybe SecurityGroupRuleDescription
a} :: SecurityGroupRemediationAction)

-- | Brief description of the action that will be performed.
securityGroupRemediationAction_description :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe Prelude.Text)
securityGroupRemediationAction_description :: (Maybe Text -> f (Maybe Text))
-> SecurityGroupRemediationAction
-> f SecurityGroupRemediationAction
securityGroupRemediationAction_description = (SecurityGroupRemediationAction -> Maybe Text)
-> (SecurityGroupRemediationAction
    -> Maybe Text -> SecurityGroupRemediationAction)
-> Lens
     SecurityGroupRemediationAction
     SecurityGroupRemediationAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupRemediationAction' {Maybe Text
description :: Maybe Text
$sel:description:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe Text
description} -> Maybe Text
description) (\s :: SecurityGroupRemediationAction
s@SecurityGroupRemediationAction' {} Maybe Text
a -> SecurityGroupRemediationAction
s {$sel:description:SecurityGroupRemediationAction' :: Maybe Text
description = Maybe Text
a} :: SecurityGroupRemediationAction)

-- | The remediation action that will be performed.
securityGroupRemediationAction_remediationActionType :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe RemediationActionType)
securityGroupRemediationAction_remediationActionType :: (Maybe RemediationActionType -> f (Maybe RemediationActionType))
-> SecurityGroupRemediationAction
-> f SecurityGroupRemediationAction
securityGroupRemediationAction_remediationActionType = (SecurityGroupRemediationAction -> Maybe RemediationActionType)
-> (SecurityGroupRemediationAction
    -> Maybe RemediationActionType -> SecurityGroupRemediationAction)
-> Lens
     SecurityGroupRemediationAction
     SecurityGroupRemediationAction
     (Maybe RemediationActionType)
     (Maybe RemediationActionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupRemediationAction' {Maybe RemediationActionType
remediationActionType :: Maybe RemediationActionType
$sel:remediationActionType:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe RemediationActionType
remediationActionType} -> Maybe RemediationActionType
remediationActionType) (\s :: SecurityGroupRemediationAction
s@SecurityGroupRemediationAction' {} Maybe RemediationActionType
a -> SecurityGroupRemediationAction
s {$sel:remediationActionType:SecurityGroupRemediationAction' :: Maybe RemediationActionType
remediationActionType = Maybe RemediationActionType
a} :: SecurityGroupRemediationAction)

instance Core.FromJSON SecurityGroupRemediationAction where
  parseJSON :: Value -> Parser SecurityGroupRemediationAction
parseJSON =
    String
-> (Object -> Parser SecurityGroupRemediationAction)
-> Value
-> Parser SecurityGroupRemediationAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SecurityGroupRemediationAction"
      ( \Object
x ->
          Maybe Bool
-> Maybe SecurityGroupRuleDescription
-> Maybe Text
-> Maybe RemediationActionType
-> SecurityGroupRemediationAction
SecurityGroupRemediationAction'
            (Maybe Bool
 -> Maybe SecurityGroupRuleDescription
 -> Maybe Text
 -> Maybe RemediationActionType
 -> SecurityGroupRemediationAction)
-> Parser (Maybe Bool)
-> Parser
     (Maybe SecurityGroupRuleDescription
      -> Maybe Text
      -> Maybe RemediationActionType
      -> SecurityGroupRemediationAction)
forall (f :: * -> *) a b. Functor 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
"IsDefaultAction")
            Parser
  (Maybe SecurityGroupRuleDescription
   -> Maybe Text
   -> Maybe RemediationActionType
   -> SecurityGroupRemediationAction)
-> Parser (Maybe SecurityGroupRuleDescription)
-> Parser
     (Maybe Text
      -> Maybe RemediationActionType -> SecurityGroupRemediationAction)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SecurityGroupRuleDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RemediationResult")
            Parser
  (Maybe Text
   -> Maybe RemediationActionType -> SecurityGroupRemediationAction)
-> Parser (Maybe Text)
-> Parser
     (Maybe RemediationActionType -> SecurityGroupRemediationAction)
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
"Description")
            Parser
  (Maybe RemediationActionType -> SecurityGroupRemediationAction)
-> Parser (Maybe RemediationActionType)
-> Parser SecurityGroupRemediationAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RemediationActionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RemediationActionType")
      )

instance
  Prelude.Hashable
    SecurityGroupRemediationAction

instance
  Prelude.NFData
    SecurityGroupRemediationAction