{-# 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.IoT.Types.MitigationActionIdentifier
-- 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.IoT.Types.MitigationActionIdentifier where

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

-- | Information that identifies a mitigation action. This information is
-- returned by ListMitigationActions.
--
-- /See:/ 'newMitigationActionIdentifier' smart constructor.
data MitigationActionIdentifier = MitigationActionIdentifier'
  { -- | The friendly name of the mitigation action.
    MitigationActionIdentifier -> Maybe Text
actionName :: Prelude.Maybe Prelude.Text,
    -- | The date when this mitigation action was created.
    MitigationActionIdentifier -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The IAM role ARN used to apply this mitigation action.
    MitigationActionIdentifier -> Maybe Text
actionArn :: Prelude.Maybe Prelude.Text
  }
  deriving (MitigationActionIdentifier -> MitigationActionIdentifier -> Bool
(MitigationActionIdentifier -> MitigationActionIdentifier -> Bool)
-> (MitigationActionIdentifier
    -> MitigationActionIdentifier -> Bool)
-> Eq MitigationActionIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MitigationActionIdentifier -> MitigationActionIdentifier -> Bool
$c/= :: MitigationActionIdentifier -> MitigationActionIdentifier -> Bool
== :: MitigationActionIdentifier -> MitigationActionIdentifier -> Bool
$c== :: MitigationActionIdentifier -> MitigationActionIdentifier -> Bool
Prelude.Eq, ReadPrec [MitigationActionIdentifier]
ReadPrec MitigationActionIdentifier
Int -> ReadS MitigationActionIdentifier
ReadS [MitigationActionIdentifier]
(Int -> ReadS MitigationActionIdentifier)
-> ReadS [MitigationActionIdentifier]
-> ReadPrec MitigationActionIdentifier
-> ReadPrec [MitigationActionIdentifier]
-> Read MitigationActionIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MitigationActionIdentifier]
$creadListPrec :: ReadPrec [MitigationActionIdentifier]
readPrec :: ReadPrec MitigationActionIdentifier
$creadPrec :: ReadPrec MitigationActionIdentifier
readList :: ReadS [MitigationActionIdentifier]
$creadList :: ReadS [MitigationActionIdentifier]
readsPrec :: Int -> ReadS MitigationActionIdentifier
$creadsPrec :: Int -> ReadS MitigationActionIdentifier
Prelude.Read, Int -> MitigationActionIdentifier -> ShowS
[MitigationActionIdentifier] -> ShowS
MitigationActionIdentifier -> String
(Int -> MitigationActionIdentifier -> ShowS)
-> (MitigationActionIdentifier -> String)
-> ([MitigationActionIdentifier] -> ShowS)
-> Show MitigationActionIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MitigationActionIdentifier] -> ShowS
$cshowList :: [MitigationActionIdentifier] -> ShowS
show :: MitigationActionIdentifier -> String
$cshow :: MitigationActionIdentifier -> String
showsPrec :: Int -> MitigationActionIdentifier -> ShowS
$cshowsPrec :: Int -> MitigationActionIdentifier -> ShowS
Prelude.Show, (forall x.
 MitigationActionIdentifier -> Rep MitigationActionIdentifier x)
-> (forall x.
    Rep MitigationActionIdentifier x -> MitigationActionIdentifier)
-> Generic MitigationActionIdentifier
forall x.
Rep MitigationActionIdentifier x -> MitigationActionIdentifier
forall x.
MitigationActionIdentifier -> Rep MitigationActionIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MitigationActionIdentifier x -> MitigationActionIdentifier
$cfrom :: forall x.
MitigationActionIdentifier -> Rep MitigationActionIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'MitigationActionIdentifier' 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:
--
-- 'actionName', 'mitigationActionIdentifier_actionName' - The friendly name of the mitigation action.
--
-- 'creationDate', 'mitigationActionIdentifier_creationDate' - The date when this mitigation action was created.
--
-- 'actionArn', 'mitigationActionIdentifier_actionArn' - The IAM role ARN used to apply this mitigation action.
newMitigationActionIdentifier ::
  MitigationActionIdentifier
newMitigationActionIdentifier :: MitigationActionIdentifier
newMitigationActionIdentifier =
  MitigationActionIdentifier' :: Maybe Text
-> Maybe POSIX -> Maybe Text -> MitigationActionIdentifier
MitigationActionIdentifier'
    { $sel:actionName:MitigationActionIdentifier' :: Maybe Text
actionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:MitigationActionIdentifier' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:actionArn:MitigationActionIdentifier' :: Maybe Text
actionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The friendly name of the mitigation action.
mitigationActionIdentifier_actionName :: Lens.Lens' MitigationActionIdentifier (Prelude.Maybe Prelude.Text)
mitigationActionIdentifier_actionName :: (Maybe Text -> f (Maybe Text))
-> MitigationActionIdentifier -> f MitigationActionIdentifier
mitigationActionIdentifier_actionName = (MitigationActionIdentifier -> Maybe Text)
-> (MitigationActionIdentifier
    -> Maybe Text -> MitigationActionIdentifier)
-> Lens
     MitigationActionIdentifier
     MitigationActionIdentifier
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionIdentifier' {Maybe Text
actionName :: Maybe Text
$sel:actionName:MitigationActionIdentifier' :: MitigationActionIdentifier -> Maybe Text
actionName} -> Maybe Text
actionName) (\s :: MitigationActionIdentifier
s@MitigationActionIdentifier' {} Maybe Text
a -> MitigationActionIdentifier
s {$sel:actionName:MitigationActionIdentifier' :: Maybe Text
actionName = Maybe Text
a} :: MitigationActionIdentifier)

-- | The date when this mitigation action was created.
mitigationActionIdentifier_creationDate :: Lens.Lens' MitigationActionIdentifier (Prelude.Maybe Prelude.UTCTime)
mitigationActionIdentifier_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> MitigationActionIdentifier -> f MitigationActionIdentifier
mitigationActionIdentifier_creationDate = (MitigationActionIdentifier -> Maybe POSIX)
-> (MitigationActionIdentifier
    -> Maybe POSIX -> MitigationActionIdentifier)
-> Lens
     MitigationActionIdentifier
     MitigationActionIdentifier
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionIdentifier' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:MitigationActionIdentifier' :: MitigationActionIdentifier -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: MitigationActionIdentifier
s@MitigationActionIdentifier' {} Maybe POSIX
a -> MitigationActionIdentifier
s {$sel:creationDate:MitigationActionIdentifier' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: MitigationActionIdentifier) ((Maybe POSIX -> f (Maybe POSIX))
 -> MitigationActionIdentifier -> f MitigationActionIdentifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> MitigationActionIdentifier
-> f MitigationActionIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The IAM role ARN used to apply this mitigation action.
mitigationActionIdentifier_actionArn :: Lens.Lens' MitigationActionIdentifier (Prelude.Maybe Prelude.Text)
mitigationActionIdentifier_actionArn :: (Maybe Text -> f (Maybe Text))
-> MitigationActionIdentifier -> f MitigationActionIdentifier
mitigationActionIdentifier_actionArn = (MitigationActionIdentifier -> Maybe Text)
-> (MitigationActionIdentifier
    -> Maybe Text -> MitigationActionIdentifier)
-> Lens
     MitigationActionIdentifier
     MitigationActionIdentifier
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionIdentifier' {Maybe Text
actionArn :: Maybe Text
$sel:actionArn:MitigationActionIdentifier' :: MitigationActionIdentifier -> Maybe Text
actionArn} -> Maybe Text
actionArn) (\s :: MitigationActionIdentifier
s@MitigationActionIdentifier' {} Maybe Text
a -> MitigationActionIdentifier
s {$sel:actionArn:MitigationActionIdentifier' :: Maybe Text
actionArn = Maybe Text
a} :: MitigationActionIdentifier)

instance Core.FromJSON MitigationActionIdentifier where
  parseJSON :: Value -> Parser MitigationActionIdentifier
parseJSON =
    String
-> (Object -> Parser MitigationActionIdentifier)
-> Value
-> Parser MitigationActionIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MitigationActionIdentifier"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX -> Maybe Text -> MitigationActionIdentifier
MitigationActionIdentifier'
            (Maybe Text
 -> Maybe POSIX -> Maybe Text -> MitigationActionIdentifier)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> MitigationActionIdentifier)
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
"actionName")
            Parser (Maybe POSIX -> Maybe Text -> MitigationActionIdentifier)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> MitigationActionIdentifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDate")
            Parser (Maybe Text -> MitigationActionIdentifier)
-> Parser (Maybe Text) -> Parser MitigationActionIdentifier
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
"actionArn")
      )

instance Prelude.Hashable MitigationActionIdentifier

instance Prelude.NFData MitigationActionIdentifier