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