{-# 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 #-}
module Amazonka.IoT.Types.MitigationAction where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.MitigationActionParams
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MitigationAction = MitigationAction'
{
MitigationAction -> Maybe MitigationActionParams
actionParams :: Prelude.Maybe MitigationActionParams,
MitigationAction -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
MitigationAction -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
MitigationAction -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
}
deriving (MitigationAction -> MitigationAction -> Bool
(MitigationAction -> MitigationAction -> Bool)
-> (MitigationAction -> MitigationAction -> Bool)
-> Eq MitigationAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MitigationAction -> MitigationAction -> Bool
$c/= :: MitigationAction -> MitigationAction -> Bool
== :: MitigationAction -> MitigationAction -> Bool
$c== :: MitigationAction -> MitigationAction -> Bool
Prelude.Eq, ReadPrec [MitigationAction]
ReadPrec MitigationAction
Int -> ReadS MitigationAction
ReadS [MitigationAction]
(Int -> ReadS MitigationAction)
-> ReadS [MitigationAction]
-> ReadPrec MitigationAction
-> ReadPrec [MitigationAction]
-> Read MitigationAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MitigationAction]
$creadListPrec :: ReadPrec [MitigationAction]
readPrec :: ReadPrec MitigationAction
$creadPrec :: ReadPrec MitigationAction
readList :: ReadS [MitigationAction]
$creadList :: ReadS [MitigationAction]
readsPrec :: Int -> ReadS MitigationAction
$creadsPrec :: Int -> ReadS MitigationAction
Prelude.Read, Int -> MitigationAction -> ShowS
[MitigationAction] -> ShowS
MitigationAction -> String
(Int -> MitigationAction -> ShowS)
-> (MitigationAction -> String)
-> ([MitigationAction] -> ShowS)
-> Show MitigationAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MitigationAction] -> ShowS
$cshowList :: [MitigationAction] -> ShowS
show :: MitigationAction -> String
$cshow :: MitigationAction -> String
showsPrec :: Int -> MitigationAction -> ShowS
$cshowsPrec :: Int -> MitigationAction -> ShowS
Prelude.Show, (forall x. MitigationAction -> Rep MitigationAction x)
-> (forall x. Rep MitigationAction x -> MitigationAction)
-> Generic MitigationAction
forall x. Rep MitigationAction x -> MitigationAction
forall x. MitigationAction -> Rep MitigationAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MitigationAction x -> MitigationAction
$cfrom :: forall x. MitigationAction -> Rep MitigationAction x
Prelude.Generic)
newMitigationAction ::
MitigationAction
newMitigationAction :: MitigationAction
newMitigationAction =
MitigationAction' :: Maybe MitigationActionParams
-> Maybe Text -> Maybe Text -> Maybe Text -> MitigationAction
MitigationAction'
{ $sel:actionParams:MitigationAction' :: Maybe MitigationActionParams
actionParams = Maybe MitigationActionParams
forall a. Maybe a
Prelude.Nothing,
$sel:name:MitigationAction' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:MitigationAction' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:MitigationAction' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
mitigationAction_actionParams :: Lens.Lens' MitigationAction (Prelude.Maybe MitigationActionParams)
mitigationAction_actionParams :: (Maybe MitigationActionParams -> f (Maybe MitigationActionParams))
-> MitigationAction -> f MitigationAction
mitigationAction_actionParams = (MitigationAction -> Maybe MitigationActionParams)
-> (MitigationAction
-> Maybe MitigationActionParams -> MitigationAction)
-> Lens
MitigationAction
MitigationAction
(Maybe MitigationActionParams)
(Maybe MitigationActionParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationAction' {Maybe MitigationActionParams
actionParams :: Maybe MitigationActionParams
$sel:actionParams:MitigationAction' :: MitigationAction -> Maybe MitigationActionParams
actionParams} -> Maybe MitigationActionParams
actionParams) (\s :: MitigationAction
s@MitigationAction' {} Maybe MitigationActionParams
a -> MitigationAction
s {$sel:actionParams:MitigationAction' :: Maybe MitigationActionParams
actionParams = Maybe MitigationActionParams
a} :: MitigationAction)
mitigationAction_name :: Lens.Lens' MitigationAction (Prelude.Maybe Prelude.Text)
mitigationAction_name :: (Maybe Text -> f (Maybe Text))
-> MitigationAction -> f MitigationAction
mitigationAction_name = (MitigationAction -> Maybe Text)
-> (MitigationAction -> Maybe Text -> MitigationAction)
-> Lens MitigationAction MitigationAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationAction' {Maybe Text
name :: Maybe Text
$sel:name:MitigationAction' :: MitigationAction -> Maybe Text
name} -> Maybe Text
name) (\s :: MitigationAction
s@MitigationAction' {} Maybe Text
a -> MitigationAction
s {$sel:name:MitigationAction' :: Maybe Text
name = Maybe Text
a} :: MitigationAction)
mitigationAction_id :: Lens.Lens' MitigationAction (Prelude.Maybe Prelude.Text)
mitigationAction_id :: (Maybe Text -> f (Maybe Text))
-> MitigationAction -> f MitigationAction
mitigationAction_id = (MitigationAction -> Maybe Text)
-> (MitigationAction -> Maybe Text -> MitigationAction)
-> Lens MitigationAction MitigationAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationAction' {Maybe Text
id :: Maybe Text
$sel:id:MitigationAction' :: MitigationAction -> Maybe Text
id} -> Maybe Text
id) (\s :: MitigationAction
s@MitigationAction' {} Maybe Text
a -> MitigationAction
s {$sel:id:MitigationAction' :: Maybe Text
id = Maybe Text
a} :: MitigationAction)
mitigationAction_roleArn :: Lens.Lens' MitigationAction (Prelude.Maybe Prelude.Text)
mitigationAction_roleArn :: (Maybe Text -> f (Maybe Text))
-> MitigationAction -> f MitigationAction
mitigationAction_roleArn = (MitigationAction -> Maybe Text)
-> (MitigationAction -> Maybe Text -> MitigationAction)
-> Lens MitigationAction MitigationAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationAction' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:MitigationAction' :: MitigationAction -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: MitigationAction
s@MitigationAction' {} Maybe Text
a -> MitigationAction
s {$sel:roleArn:MitigationAction' :: Maybe Text
roleArn = Maybe Text
a} :: MitigationAction)
instance Core.FromJSON MitigationAction where
parseJSON :: Value -> Parser MitigationAction
parseJSON =
String
-> (Object -> Parser MitigationAction)
-> Value
-> Parser MitigationAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MitigationAction"
( \Object
x ->
Maybe MitigationActionParams
-> Maybe Text -> Maybe Text -> Maybe Text -> MitigationAction
MitigationAction'
(Maybe MitigationActionParams
-> Maybe Text -> Maybe Text -> Maybe Text -> MitigationAction)
-> Parser (Maybe MitigationActionParams)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> MitigationAction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MitigationActionParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"actionParams")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> MitigationAction)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> MitigationAction)
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
"name")
Parser (Maybe Text -> Maybe Text -> MitigationAction)
-> Parser (Maybe Text) -> Parser (Maybe Text -> MitigationAction)
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
"id")
Parser (Maybe Text -> MitigationAction)
-> Parser (Maybe Text) -> Parser MitigationAction
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
"roleArn")
)
instance Prelude.Hashable MitigationAction
instance Prelude.NFData MitigationAction