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

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

-- | An ordered list of actions you can take to remediate a violation.
--
-- /See:/ 'newRemediationActionWithOrder' smart constructor.
data RemediationActionWithOrder = RemediationActionWithOrder'
  { -- | Information about an action you can take to remediate a violation.
    RemediationActionWithOrder -> Maybe RemediationAction
remediationAction :: Prelude.Maybe RemediationAction,
    -- | The order of the remediation actions in the list.
    RemediationActionWithOrder -> Maybe Int
order :: Prelude.Maybe Prelude.Int
  }
  deriving (RemediationActionWithOrder -> RemediationActionWithOrder -> Bool
(RemediationActionWithOrder -> RemediationActionWithOrder -> Bool)
-> (RemediationActionWithOrder
    -> RemediationActionWithOrder -> Bool)
-> Eq RemediationActionWithOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemediationActionWithOrder -> RemediationActionWithOrder -> Bool
$c/= :: RemediationActionWithOrder -> RemediationActionWithOrder -> Bool
== :: RemediationActionWithOrder -> RemediationActionWithOrder -> Bool
$c== :: RemediationActionWithOrder -> RemediationActionWithOrder -> Bool
Prelude.Eq, ReadPrec [RemediationActionWithOrder]
ReadPrec RemediationActionWithOrder
Int -> ReadS RemediationActionWithOrder
ReadS [RemediationActionWithOrder]
(Int -> ReadS RemediationActionWithOrder)
-> ReadS [RemediationActionWithOrder]
-> ReadPrec RemediationActionWithOrder
-> ReadPrec [RemediationActionWithOrder]
-> Read RemediationActionWithOrder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemediationActionWithOrder]
$creadListPrec :: ReadPrec [RemediationActionWithOrder]
readPrec :: ReadPrec RemediationActionWithOrder
$creadPrec :: ReadPrec RemediationActionWithOrder
readList :: ReadS [RemediationActionWithOrder]
$creadList :: ReadS [RemediationActionWithOrder]
readsPrec :: Int -> ReadS RemediationActionWithOrder
$creadsPrec :: Int -> ReadS RemediationActionWithOrder
Prelude.Read, Int -> RemediationActionWithOrder -> ShowS
[RemediationActionWithOrder] -> ShowS
RemediationActionWithOrder -> String
(Int -> RemediationActionWithOrder -> ShowS)
-> (RemediationActionWithOrder -> String)
-> ([RemediationActionWithOrder] -> ShowS)
-> Show RemediationActionWithOrder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemediationActionWithOrder] -> ShowS
$cshowList :: [RemediationActionWithOrder] -> ShowS
show :: RemediationActionWithOrder -> String
$cshow :: RemediationActionWithOrder -> String
showsPrec :: Int -> RemediationActionWithOrder -> ShowS
$cshowsPrec :: Int -> RemediationActionWithOrder -> ShowS
Prelude.Show, (forall x.
 RemediationActionWithOrder -> Rep RemediationActionWithOrder x)
-> (forall x.
    Rep RemediationActionWithOrder x -> RemediationActionWithOrder)
-> Generic RemediationActionWithOrder
forall x.
Rep RemediationActionWithOrder x -> RemediationActionWithOrder
forall x.
RemediationActionWithOrder -> Rep RemediationActionWithOrder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemediationActionWithOrder x -> RemediationActionWithOrder
$cfrom :: forall x.
RemediationActionWithOrder -> Rep RemediationActionWithOrder x
Prelude.Generic)

-- |
-- Create a value of 'RemediationActionWithOrder' 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:
--
-- 'remediationAction', 'remediationActionWithOrder_remediationAction' - Information about an action you can take to remediate a violation.
--
-- 'order', 'remediationActionWithOrder_order' - The order of the remediation actions in the list.
newRemediationActionWithOrder ::
  RemediationActionWithOrder
newRemediationActionWithOrder :: RemediationActionWithOrder
newRemediationActionWithOrder =
  RemediationActionWithOrder' :: Maybe RemediationAction -> Maybe Int -> RemediationActionWithOrder
RemediationActionWithOrder'
    { $sel:remediationAction:RemediationActionWithOrder' :: Maybe RemediationAction
remediationAction =
        Maybe RemediationAction
forall a. Maybe a
Prelude.Nothing,
      $sel:order:RemediationActionWithOrder' :: Maybe Int
order = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about an action you can take to remediate a violation.
remediationActionWithOrder_remediationAction :: Lens.Lens' RemediationActionWithOrder (Prelude.Maybe RemediationAction)
remediationActionWithOrder_remediationAction :: (Maybe RemediationAction -> f (Maybe RemediationAction))
-> RemediationActionWithOrder -> f RemediationActionWithOrder
remediationActionWithOrder_remediationAction = (RemediationActionWithOrder -> Maybe RemediationAction)
-> (RemediationActionWithOrder
    -> Maybe RemediationAction -> RemediationActionWithOrder)
-> Lens
     RemediationActionWithOrder
     RemediationActionWithOrder
     (Maybe RemediationAction)
     (Maybe RemediationAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationActionWithOrder' {Maybe RemediationAction
remediationAction :: Maybe RemediationAction
$sel:remediationAction:RemediationActionWithOrder' :: RemediationActionWithOrder -> Maybe RemediationAction
remediationAction} -> Maybe RemediationAction
remediationAction) (\s :: RemediationActionWithOrder
s@RemediationActionWithOrder' {} Maybe RemediationAction
a -> RemediationActionWithOrder
s {$sel:remediationAction:RemediationActionWithOrder' :: Maybe RemediationAction
remediationAction = Maybe RemediationAction
a} :: RemediationActionWithOrder)

-- | The order of the remediation actions in the list.
remediationActionWithOrder_order :: Lens.Lens' RemediationActionWithOrder (Prelude.Maybe Prelude.Int)
remediationActionWithOrder_order :: (Maybe Int -> f (Maybe Int))
-> RemediationActionWithOrder -> f RemediationActionWithOrder
remediationActionWithOrder_order = (RemediationActionWithOrder -> Maybe Int)
-> (RemediationActionWithOrder
    -> Maybe Int -> RemediationActionWithOrder)
-> Lens
     RemediationActionWithOrder
     RemediationActionWithOrder
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemediationActionWithOrder' {Maybe Int
order :: Maybe Int
$sel:order:RemediationActionWithOrder' :: RemediationActionWithOrder -> Maybe Int
order} -> Maybe Int
order) (\s :: RemediationActionWithOrder
s@RemediationActionWithOrder' {} Maybe Int
a -> RemediationActionWithOrder
s {$sel:order:RemediationActionWithOrder' :: Maybe Int
order = Maybe Int
a} :: RemediationActionWithOrder)

instance Core.FromJSON RemediationActionWithOrder where
  parseJSON :: Value -> Parser RemediationActionWithOrder
parseJSON =
    String
-> (Object -> Parser RemediationActionWithOrder)
-> Value
-> Parser RemediationActionWithOrder
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RemediationActionWithOrder"
      ( \Object
x ->
          Maybe RemediationAction -> Maybe Int -> RemediationActionWithOrder
RemediationActionWithOrder'
            (Maybe RemediationAction
 -> Maybe Int -> RemediationActionWithOrder)
-> Parser (Maybe RemediationAction)
-> Parser (Maybe Int -> RemediationActionWithOrder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RemediationAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RemediationAction")
            Parser (Maybe Int -> RemediationActionWithOrder)
-> Parser (Maybe Int) -> Parser RemediationActionWithOrder
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Order")
      )

instance Prelude.Hashable RemediationActionWithOrder

instance Prelude.NFData RemediationActionWithOrder