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

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types.RemediationActionWithOrder
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A list of remediation actions.
--
-- /See:/ 'newPossibleRemediationAction' smart constructor.
data PossibleRemediationAction = PossibleRemediationAction'
  { -- | Information about whether an action is taken by default.
    PossibleRemediationAction -> Maybe Bool
isDefaultAction :: Prelude.Maybe Prelude.Bool,
    -- | A description of the list of remediation actions.
    PossibleRemediationAction -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ordered list of remediation actions.
    PossibleRemediationAction -> [RemediationActionWithOrder]
orderedRemediationActions :: [RemediationActionWithOrder]
  }
  deriving (PossibleRemediationAction -> PossibleRemediationAction -> Bool
(PossibleRemediationAction -> PossibleRemediationAction -> Bool)
-> (PossibleRemediationAction -> PossibleRemediationAction -> Bool)
-> Eq PossibleRemediationAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PossibleRemediationAction -> PossibleRemediationAction -> Bool
$c/= :: PossibleRemediationAction -> PossibleRemediationAction -> Bool
== :: PossibleRemediationAction -> PossibleRemediationAction -> Bool
$c== :: PossibleRemediationAction -> PossibleRemediationAction -> Bool
Prelude.Eq, ReadPrec [PossibleRemediationAction]
ReadPrec PossibleRemediationAction
Int -> ReadS PossibleRemediationAction
ReadS [PossibleRemediationAction]
(Int -> ReadS PossibleRemediationAction)
-> ReadS [PossibleRemediationAction]
-> ReadPrec PossibleRemediationAction
-> ReadPrec [PossibleRemediationAction]
-> Read PossibleRemediationAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PossibleRemediationAction]
$creadListPrec :: ReadPrec [PossibleRemediationAction]
readPrec :: ReadPrec PossibleRemediationAction
$creadPrec :: ReadPrec PossibleRemediationAction
readList :: ReadS [PossibleRemediationAction]
$creadList :: ReadS [PossibleRemediationAction]
readsPrec :: Int -> ReadS PossibleRemediationAction
$creadsPrec :: Int -> ReadS PossibleRemediationAction
Prelude.Read, Int -> PossibleRemediationAction -> ShowS
[PossibleRemediationAction] -> ShowS
PossibleRemediationAction -> String
(Int -> PossibleRemediationAction -> ShowS)
-> (PossibleRemediationAction -> String)
-> ([PossibleRemediationAction] -> ShowS)
-> Show PossibleRemediationAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PossibleRemediationAction] -> ShowS
$cshowList :: [PossibleRemediationAction] -> ShowS
show :: PossibleRemediationAction -> String
$cshow :: PossibleRemediationAction -> String
showsPrec :: Int -> PossibleRemediationAction -> ShowS
$cshowsPrec :: Int -> PossibleRemediationAction -> ShowS
Prelude.Show, (forall x.
 PossibleRemediationAction -> Rep PossibleRemediationAction x)
-> (forall x.
    Rep PossibleRemediationAction x -> PossibleRemediationAction)
-> Generic PossibleRemediationAction
forall x.
Rep PossibleRemediationAction x -> PossibleRemediationAction
forall x.
PossibleRemediationAction -> Rep PossibleRemediationAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PossibleRemediationAction x -> PossibleRemediationAction
$cfrom :: forall x.
PossibleRemediationAction -> Rep PossibleRemediationAction x
Prelude.Generic)

-- |
-- Create a value of 'PossibleRemediationAction' 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', 'possibleRemediationAction_isDefaultAction' - Information about whether an action is taken by default.
--
-- 'description', 'possibleRemediationAction_description' - A description of the list of remediation actions.
--
-- 'orderedRemediationActions', 'possibleRemediationAction_orderedRemediationActions' - The ordered list of remediation actions.
newPossibleRemediationAction ::
  PossibleRemediationAction
newPossibleRemediationAction :: PossibleRemediationAction
newPossibleRemediationAction =
  PossibleRemediationAction' :: Maybe Bool
-> Maybe Text
-> [RemediationActionWithOrder]
-> PossibleRemediationAction
PossibleRemediationAction'
    { $sel:isDefaultAction:PossibleRemediationAction' :: Maybe Bool
isDefaultAction =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PossibleRemediationAction' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:orderedRemediationActions:PossibleRemediationAction' :: [RemediationActionWithOrder]
orderedRemediationActions = [RemediationActionWithOrder]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Information about whether an action is taken by default.
possibleRemediationAction_isDefaultAction :: Lens.Lens' PossibleRemediationAction (Prelude.Maybe Prelude.Bool)
possibleRemediationAction_isDefaultAction :: (Maybe Bool -> f (Maybe Bool))
-> PossibleRemediationAction -> f PossibleRemediationAction
possibleRemediationAction_isDefaultAction = (PossibleRemediationAction -> Maybe Bool)
-> (PossibleRemediationAction
    -> Maybe Bool -> PossibleRemediationAction)
-> Lens
     PossibleRemediationAction
     PossibleRemediationAction
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PossibleRemediationAction' {Maybe Bool
isDefaultAction :: Maybe Bool
$sel:isDefaultAction:PossibleRemediationAction' :: PossibleRemediationAction -> Maybe Bool
isDefaultAction} -> Maybe Bool
isDefaultAction) (\s :: PossibleRemediationAction
s@PossibleRemediationAction' {} Maybe Bool
a -> PossibleRemediationAction
s {$sel:isDefaultAction:PossibleRemediationAction' :: Maybe Bool
isDefaultAction = Maybe Bool
a} :: PossibleRemediationAction)

-- | A description of the list of remediation actions.
possibleRemediationAction_description :: Lens.Lens' PossibleRemediationAction (Prelude.Maybe Prelude.Text)
possibleRemediationAction_description :: (Maybe Text -> f (Maybe Text))
-> PossibleRemediationAction -> f PossibleRemediationAction
possibleRemediationAction_description = (PossibleRemediationAction -> Maybe Text)
-> (PossibleRemediationAction
    -> Maybe Text -> PossibleRemediationAction)
-> Lens
     PossibleRemediationAction
     PossibleRemediationAction
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PossibleRemediationAction' {Maybe Text
description :: Maybe Text
$sel:description:PossibleRemediationAction' :: PossibleRemediationAction -> Maybe Text
description} -> Maybe Text
description) (\s :: PossibleRemediationAction
s@PossibleRemediationAction' {} Maybe Text
a -> PossibleRemediationAction
s {$sel:description:PossibleRemediationAction' :: Maybe Text
description = Maybe Text
a} :: PossibleRemediationAction)

-- | The ordered list of remediation actions.
possibleRemediationAction_orderedRemediationActions :: Lens.Lens' PossibleRemediationAction [RemediationActionWithOrder]
possibleRemediationAction_orderedRemediationActions :: ([RemediationActionWithOrder] -> f [RemediationActionWithOrder])
-> PossibleRemediationAction -> f PossibleRemediationAction
possibleRemediationAction_orderedRemediationActions = (PossibleRemediationAction -> [RemediationActionWithOrder])
-> (PossibleRemediationAction
    -> [RemediationActionWithOrder] -> PossibleRemediationAction)
-> Lens
     PossibleRemediationAction
     PossibleRemediationAction
     [RemediationActionWithOrder]
     [RemediationActionWithOrder]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PossibleRemediationAction' {[RemediationActionWithOrder]
orderedRemediationActions :: [RemediationActionWithOrder]
$sel:orderedRemediationActions:PossibleRemediationAction' :: PossibleRemediationAction -> [RemediationActionWithOrder]
orderedRemediationActions} -> [RemediationActionWithOrder]
orderedRemediationActions) (\s :: PossibleRemediationAction
s@PossibleRemediationAction' {} [RemediationActionWithOrder]
a -> PossibleRemediationAction
s {$sel:orderedRemediationActions:PossibleRemediationAction' :: [RemediationActionWithOrder]
orderedRemediationActions = [RemediationActionWithOrder]
a} :: PossibleRemediationAction) (([RemediationActionWithOrder] -> f [RemediationActionWithOrder])
 -> PossibleRemediationAction -> f PossibleRemediationAction)
-> (([RemediationActionWithOrder]
     -> f [RemediationActionWithOrder])
    -> [RemediationActionWithOrder] -> f [RemediationActionWithOrder])
-> ([RemediationActionWithOrder] -> f [RemediationActionWithOrder])
-> PossibleRemediationAction
-> f PossibleRemediationAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RemediationActionWithOrder] -> f [RemediationActionWithOrder])
-> [RemediationActionWithOrder] -> f [RemediationActionWithOrder]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PossibleRemediationAction where
  parseJSON :: Value -> Parser PossibleRemediationAction
parseJSON =
    String
-> (Object -> Parser PossibleRemediationAction)
-> Value
-> Parser PossibleRemediationAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PossibleRemediationAction"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> [RemediationActionWithOrder]
-> PossibleRemediationAction
PossibleRemediationAction'
            (Maybe Bool
 -> Maybe Text
 -> [RemediationActionWithOrder]
 -> PossibleRemediationAction)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> [RemediationActionWithOrder] -> PossibleRemediationAction)
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 Text
   -> [RemediationActionWithOrder] -> PossibleRemediationAction)
-> Parser (Maybe Text)
-> Parser
     ([RemediationActionWithOrder] -> PossibleRemediationAction)
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 ([RemediationActionWithOrder] -> PossibleRemediationAction)
-> Parser [RemediationActionWithOrder]
-> Parser PossibleRemediationAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [RemediationActionWithOrder])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OrderedRemediationActions"
                            Parser (Maybe [RemediationActionWithOrder])
-> [RemediationActionWithOrder]
-> Parser [RemediationActionWithOrder]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [RemediationActionWithOrder]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable PossibleRemediationAction

instance Prelude.NFData PossibleRemediationAction