{-# 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.Shield.Types.Mitigation
-- 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.Shield.Types.Mitigation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The mitigation applied to a DDoS attack.
--
-- /See:/ 'newMitigation' smart constructor.
data Mitigation = Mitigation'
  { -- | The name of the mitigation taken for this attack.
    Mitigation -> Maybe Text
mitigationName :: Prelude.Maybe Prelude.Text
  }
  deriving (Mitigation -> Mitigation -> Bool
(Mitigation -> Mitigation -> Bool)
-> (Mitigation -> Mitigation -> Bool) -> Eq Mitigation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Mitigation -> Mitigation -> Bool
$c/= :: Mitigation -> Mitigation -> Bool
== :: Mitigation -> Mitigation -> Bool
$c== :: Mitigation -> Mitigation -> Bool
Prelude.Eq, ReadPrec [Mitigation]
ReadPrec Mitigation
Int -> ReadS Mitigation
ReadS [Mitigation]
(Int -> ReadS Mitigation)
-> ReadS [Mitigation]
-> ReadPrec Mitigation
-> ReadPrec [Mitigation]
-> Read Mitigation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Mitigation]
$creadListPrec :: ReadPrec [Mitigation]
readPrec :: ReadPrec Mitigation
$creadPrec :: ReadPrec Mitigation
readList :: ReadS [Mitigation]
$creadList :: ReadS [Mitigation]
readsPrec :: Int -> ReadS Mitigation
$creadsPrec :: Int -> ReadS Mitigation
Prelude.Read, Int -> Mitigation -> ShowS
[Mitigation] -> ShowS
Mitigation -> String
(Int -> Mitigation -> ShowS)
-> (Mitigation -> String)
-> ([Mitigation] -> ShowS)
-> Show Mitigation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Mitigation] -> ShowS
$cshowList :: [Mitigation] -> ShowS
show :: Mitigation -> String
$cshow :: Mitigation -> String
showsPrec :: Int -> Mitigation -> ShowS
$cshowsPrec :: Int -> Mitigation -> ShowS
Prelude.Show, (forall x. Mitigation -> Rep Mitigation x)
-> (forall x. Rep Mitigation x -> Mitigation) -> Generic Mitigation
forall x. Rep Mitigation x -> Mitigation
forall x. Mitigation -> Rep Mitigation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Mitigation x -> Mitigation
$cfrom :: forall x. Mitigation -> Rep Mitigation x
Prelude.Generic)

-- |
-- Create a value of 'Mitigation' 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:
--
-- 'mitigationName', 'mitigation_mitigationName' - The name of the mitigation taken for this attack.
newMitigation ::
  Mitigation
newMitigation :: Mitigation
newMitigation =
  Mitigation' :: Maybe Text -> Mitigation
Mitigation' {$sel:mitigationName:Mitigation' :: Maybe Text
mitigationName = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The name of the mitigation taken for this attack.
mitigation_mitigationName :: Lens.Lens' Mitigation (Prelude.Maybe Prelude.Text)
mitigation_mitigationName :: (Maybe Text -> f (Maybe Text)) -> Mitigation -> f Mitigation
mitigation_mitigationName = (Mitigation -> Maybe Text)
-> (Mitigation -> Maybe Text -> Mitigation)
-> Lens Mitigation Mitigation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Mitigation' {Maybe Text
mitigationName :: Maybe Text
$sel:mitigationName:Mitigation' :: Mitigation -> Maybe Text
mitigationName} -> Maybe Text
mitigationName) (\s :: Mitigation
s@Mitigation' {} Maybe Text
a -> Mitigation
s {$sel:mitigationName:Mitigation' :: Maybe Text
mitigationName = Maybe Text
a} :: Mitigation)

instance Core.FromJSON Mitigation where
  parseJSON :: Value -> Parser Mitigation
parseJSON =
    String
-> (Object -> Parser Mitigation) -> Value -> Parser Mitigation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Mitigation"
      ( \Object
x ->
          Maybe Text -> Mitigation
Mitigation'
            (Maybe Text -> Mitigation)
-> Parser (Maybe Text) -> Parser Mitigation
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
"MitigationName")
      )

instance Prelude.Hashable Mitigation

instance Prelude.NFData Mitigation