{-# 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.AlertTarget where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AlertTarget = AlertTarget'
{
AlertTarget -> Text
alertTargetArn :: Prelude.Text,
AlertTarget -> Text
roleArn :: Prelude.Text
}
deriving (AlertTarget -> AlertTarget -> Bool
(AlertTarget -> AlertTarget -> Bool)
-> (AlertTarget -> AlertTarget -> Bool) -> Eq AlertTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlertTarget -> AlertTarget -> Bool
$c/= :: AlertTarget -> AlertTarget -> Bool
== :: AlertTarget -> AlertTarget -> Bool
$c== :: AlertTarget -> AlertTarget -> Bool
Prelude.Eq, ReadPrec [AlertTarget]
ReadPrec AlertTarget
Int -> ReadS AlertTarget
ReadS [AlertTarget]
(Int -> ReadS AlertTarget)
-> ReadS [AlertTarget]
-> ReadPrec AlertTarget
-> ReadPrec [AlertTarget]
-> Read AlertTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlertTarget]
$creadListPrec :: ReadPrec [AlertTarget]
readPrec :: ReadPrec AlertTarget
$creadPrec :: ReadPrec AlertTarget
readList :: ReadS [AlertTarget]
$creadList :: ReadS [AlertTarget]
readsPrec :: Int -> ReadS AlertTarget
$creadsPrec :: Int -> ReadS AlertTarget
Prelude.Read, Int -> AlertTarget -> ShowS
[AlertTarget] -> ShowS
AlertTarget -> String
(Int -> AlertTarget -> ShowS)
-> (AlertTarget -> String)
-> ([AlertTarget] -> ShowS)
-> Show AlertTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlertTarget] -> ShowS
$cshowList :: [AlertTarget] -> ShowS
show :: AlertTarget -> String
$cshow :: AlertTarget -> String
showsPrec :: Int -> AlertTarget -> ShowS
$cshowsPrec :: Int -> AlertTarget -> ShowS
Prelude.Show, (forall x. AlertTarget -> Rep AlertTarget x)
-> (forall x. Rep AlertTarget x -> AlertTarget)
-> Generic AlertTarget
forall x. Rep AlertTarget x -> AlertTarget
forall x. AlertTarget -> Rep AlertTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlertTarget x -> AlertTarget
$cfrom :: forall x. AlertTarget -> Rep AlertTarget x
Prelude.Generic)
newAlertTarget ::
Prelude.Text ->
Prelude.Text ->
AlertTarget
newAlertTarget :: Text -> Text -> AlertTarget
newAlertTarget Text
pAlertTargetArn_ Text
pRoleArn_ =
AlertTarget' :: Text -> Text -> AlertTarget
AlertTarget'
{ $sel:alertTargetArn:AlertTarget' :: Text
alertTargetArn = Text
pAlertTargetArn_,
$sel:roleArn:AlertTarget' :: Text
roleArn = Text
pRoleArn_
}
alertTarget_alertTargetArn :: Lens.Lens' AlertTarget Prelude.Text
alertTarget_alertTargetArn :: (Text -> f Text) -> AlertTarget -> f AlertTarget
alertTarget_alertTargetArn = (AlertTarget -> Text)
-> (AlertTarget -> Text -> AlertTarget)
-> Lens AlertTarget AlertTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertTarget' {Text
alertTargetArn :: Text
$sel:alertTargetArn:AlertTarget' :: AlertTarget -> Text
alertTargetArn} -> Text
alertTargetArn) (\s :: AlertTarget
s@AlertTarget' {} Text
a -> AlertTarget
s {$sel:alertTargetArn:AlertTarget' :: Text
alertTargetArn = Text
a} :: AlertTarget)
alertTarget_roleArn :: Lens.Lens' AlertTarget Prelude.Text
alertTarget_roleArn :: (Text -> f Text) -> AlertTarget -> f AlertTarget
alertTarget_roleArn = (AlertTarget -> Text)
-> (AlertTarget -> Text -> AlertTarget)
-> Lens AlertTarget AlertTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertTarget' {Text
roleArn :: Text
$sel:roleArn:AlertTarget' :: AlertTarget -> Text
roleArn} -> Text
roleArn) (\s :: AlertTarget
s@AlertTarget' {} Text
a -> AlertTarget
s {$sel:roleArn:AlertTarget' :: Text
roleArn = Text
a} :: AlertTarget)
instance Core.FromJSON AlertTarget where
parseJSON :: Value -> Parser AlertTarget
parseJSON =
String
-> (Object -> Parser AlertTarget) -> Value -> Parser AlertTarget
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AlertTarget"
( \Object
x ->
Text -> Text -> AlertTarget
AlertTarget'
(Text -> Text -> AlertTarget)
-> Parser Text -> Parser (Text -> AlertTarget)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"alertTargetArn")
Parser (Text -> AlertTarget) -> Parser Text -> Parser AlertTarget
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
)
instance Prelude.Hashable AlertTarget
instance Prelude.NFData AlertTarget
instance Core.ToJSON AlertTarget where
toJSON :: AlertTarget -> Value
toJSON AlertTarget' {Text
roleArn :: Text
alertTargetArn :: Text
$sel:roleArn:AlertTarget' :: AlertTarget -> Text
$sel:alertTargetArn:AlertTarget' :: AlertTarget -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"alertTargetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alertTargetArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)