{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FMS.Types.SecurityGroupRemediationAction where

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

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

-- | Brief description of the action that will be performed.
securityGroupRemediationAction_description :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe Prelude.Text)
securityGroupRemediationAction_description :: Lens' SecurityGroupRemediationAction (Maybe Text)
securityGroupRemediationAction_description = 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)

-- | Indicates if the current action is the default action.
securityGroupRemediationAction_isDefaultAction :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe Prelude.Bool)
securityGroupRemediationAction_isDefaultAction :: Lens' SecurityGroupRemediationAction (Maybe Bool)
securityGroupRemediationAction_isDefaultAction = 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 remediation action that will be performed.
securityGroupRemediationAction_remediationActionType :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe RemediationActionType)
securityGroupRemediationAction_remediationActionType :: Lens' SecurityGroupRemediationAction (Maybe RemediationActionType)
securityGroupRemediationAction_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)

-- | The final state of the rule specified in the @ViolationTarget@ after it
-- is remediated.
securityGroupRemediationAction_remediationResult :: Lens.Lens' SecurityGroupRemediationAction (Prelude.Maybe SecurityGroupRuleDescription)
securityGroupRemediationAction_remediationResult :: Lens'
  SecurityGroupRemediationAction (Maybe SecurityGroupRuleDescription)
securityGroupRemediationAction_remediationResult = 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)

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

instance
  Prelude.Hashable
    SecurityGroupRemediationAction
  where
  hashWithSalt :: Int -> SecurityGroupRemediationAction -> Int
hashWithSalt
    Int
_salt
    SecurityGroupRemediationAction' {Maybe Bool
Maybe Text
Maybe RemediationActionType
Maybe SecurityGroupRuleDescription
remediationResult :: Maybe SecurityGroupRuleDescription
remediationActionType :: Maybe RemediationActionType
isDefaultAction :: Maybe Bool
description :: Maybe Text
$sel:remediationResult:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction
-> Maybe SecurityGroupRuleDescription
$sel:remediationActionType:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe RemediationActionType
$sel:isDefaultAction:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe Bool
$sel:description:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isDefaultAction
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RemediationActionType
remediationActionType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SecurityGroupRuleDescription
remediationResult

instance
  Prelude.NFData
    SecurityGroupRemediationAction
  where
  rnf :: SecurityGroupRemediationAction -> ()
rnf SecurityGroupRemediationAction' {Maybe Bool
Maybe Text
Maybe RemediationActionType
Maybe SecurityGroupRuleDescription
remediationResult :: Maybe SecurityGroupRuleDescription
remediationActionType :: Maybe RemediationActionType
isDefaultAction :: Maybe Bool
description :: Maybe Text
$sel:remediationResult:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction
-> Maybe SecurityGroupRuleDescription
$sel:remediationActionType:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe RemediationActionType
$sel:isDefaultAction:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe Bool
$sel:description:SecurityGroupRemediationAction' :: SecurityGroupRemediationAction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isDefaultAction
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RemediationActionType
remediationActionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityGroupRuleDescription
remediationResult