{-# 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.IoTEvents.Types.SetTimerAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data SetTimerAction = SetTimerAction'
{
SetTimerAction -> Maybe Text
durationExpression :: Prelude.Maybe Prelude.Text,
SetTimerAction -> Maybe Natural
seconds :: Prelude.Maybe Prelude.Natural,
SetTimerAction -> Text
timerName :: Prelude.Text
}
deriving (SetTimerAction -> SetTimerAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetTimerAction -> SetTimerAction -> Bool
$c/= :: SetTimerAction -> SetTimerAction -> Bool
== :: SetTimerAction -> SetTimerAction -> Bool
$c== :: SetTimerAction -> SetTimerAction -> Bool
Prelude.Eq, ReadPrec [SetTimerAction]
ReadPrec SetTimerAction
Int -> ReadS SetTimerAction
ReadS [SetTimerAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetTimerAction]
$creadListPrec :: ReadPrec [SetTimerAction]
readPrec :: ReadPrec SetTimerAction
$creadPrec :: ReadPrec SetTimerAction
readList :: ReadS [SetTimerAction]
$creadList :: ReadS [SetTimerAction]
readsPrec :: Int -> ReadS SetTimerAction
$creadsPrec :: Int -> ReadS SetTimerAction
Prelude.Read, Int -> SetTimerAction -> ShowS
[SetTimerAction] -> ShowS
SetTimerAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetTimerAction] -> ShowS
$cshowList :: [SetTimerAction] -> ShowS
show :: SetTimerAction -> String
$cshow :: SetTimerAction -> String
showsPrec :: Int -> SetTimerAction -> ShowS
$cshowsPrec :: Int -> SetTimerAction -> ShowS
Prelude.Show, forall x. Rep SetTimerAction x -> SetTimerAction
forall x. SetTimerAction -> Rep SetTimerAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetTimerAction x -> SetTimerAction
$cfrom :: forall x. SetTimerAction -> Rep SetTimerAction x
Prelude.Generic)
newSetTimerAction ::
Prelude.Text ->
SetTimerAction
newSetTimerAction :: Text -> SetTimerAction
newSetTimerAction Text
pTimerName_ =
SetTimerAction'
{ $sel:durationExpression:SetTimerAction' :: Maybe Text
durationExpression =
forall a. Maybe a
Prelude.Nothing,
$sel:seconds:SetTimerAction' :: Maybe Natural
seconds = forall a. Maybe a
Prelude.Nothing,
$sel:timerName:SetTimerAction' :: Text
timerName = Text
pTimerName_
}
setTimerAction_durationExpression :: Lens.Lens' SetTimerAction (Prelude.Maybe Prelude.Text)
setTimerAction_durationExpression :: Lens' SetTimerAction (Maybe Text)
setTimerAction_durationExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTimerAction' {Maybe Text
durationExpression :: Maybe Text
$sel:durationExpression:SetTimerAction' :: SetTimerAction -> Maybe Text
durationExpression} -> Maybe Text
durationExpression) (\s :: SetTimerAction
s@SetTimerAction' {} Maybe Text
a -> SetTimerAction
s {$sel:durationExpression:SetTimerAction' :: Maybe Text
durationExpression = Maybe Text
a} :: SetTimerAction)
setTimerAction_seconds :: Lens.Lens' SetTimerAction (Prelude.Maybe Prelude.Natural)
setTimerAction_seconds :: Lens' SetTimerAction (Maybe Natural)
setTimerAction_seconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTimerAction' {Maybe Natural
seconds :: Maybe Natural
$sel:seconds:SetTimerAction' :: SetTimerAction -> Maybe Natural
seconds} -> Maybe Natural
seconds) (\s :: SetTimerAction
s@SetTimerAction' {} Maybe Natural
a -> SetTimerAction
s {$sel:seconds:SetTimerAction' :: Maybe Natural
seconds = Maybe Natural
a} :: SetTimerAction)
setTimerAction_timerName :: Lens.Lens' SetTimerAction Prelude.Text
setTimerAction_timerName :: Lens' SetTimerAction Text
setTimerAction_timerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTimerAction' {Text
timerName :: Text
$sel:timerName:SetTimerAction' :: SetTimerAction -> Text
timerName} -> Text
timerName) (\s :: SetTimerAction
s@SetTimerAction' {} Text
a -> SetTimerAction
s {$sel:timerName:SetTimerAction' :: Text
timerName = Text
a} :: SetTimerAction)
instance Data.FromJSON SetTimerAction where
parseJSON :: Value -> Parser SetTimerAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"SetTimerAction"
( \Object
x ->
Maybe Text -> Maybe Natural -> Text -> SetTimerAction
SetTimerAction'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"durationExpression")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"seconds")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timerName")
)
instance Prelude.Hashable SetTimerAction where
hashWithSalt :: Int -> SetTimerAction -> Int
hashWithSalt Int
_salt SetTimerAction' {Maybe Natural
Maybe Text
Text
timerName :: Text
seconds :: Maybe Natural
durationExpression :: Maybe Text
$sel:timerName:SetTimerAction' :: SetTimerAction -> Text
$sel:seconds:SetTimerAction' :: SetTimerAction -> Maybe Natural
$sel:durationExpression:SetTimerAction' :: SetTimerAction -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
durationExpression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
seconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timerName
instance Prelude.NFData SetTimerAction where
rnf :: SetTimerAction -> ()
rnf SetTimerAction' {Maybe Natural
Maybe Text
Text
timerName :: Text
seconds :: Maybe Natural
durationExpression :: Maybe Text
$sel:timerName:SetTimerAction' :: SetTimerAction -> Text
$sel:seconds:SetTimerAction' :: SetTimerAction -> Maybe Natural
$sel:durationExpression:SetTimerAction' :: SetTimerAction -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
durationExpression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
seconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timerName
instance Data.ToJSON SetTimerAction where
toJSON :: SetTimerAction -> Value
toJSON SetTimerAction' {Maybe Natural
Maybe Text
Text
timerName :: Text
seconds :: Maybe Natural
durationExpression :: Maybe Text
$sel:timerName:SetTimerAction' :: SetTimerAction -> Text
$sel:seconds:SetTimerAction' :: SetTimerAction -> Maybe Natural
$sel:durationExpression:SetTimerAction' :: SetTimerAction -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"durationExpression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
durationExpression,
(Key
"seconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
seconds,
forall a. a -> Maybe a
Prelude.Just (Key
"timerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timerName)
]
)