{-# 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.IoTEventsData.Types.TimerDefinition 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 TimerDefinition = TimerDefinition'
{
TimerDefinition -> Text
name :: Prelude.Text,
TimerDefinition -> Int
seconds :: Prelude.Int
}
deriving (TimerDefinition -> TimerDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimerDefinition -> TimerDefinition -> Bool
$c/= :: TimerDefinition -> TimerDefinition -> Bool
== :: TimerDefinition -> TimerDefinition -> Bool
$c== :: TimerDefinition -> TimerDefinition -> Bool
Prelude.Eq, ReadPrec [TimerDefinition]
ReadPrec TimerDefinition
Int -> ReadS TimerDefinition
ReadS [TimerDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimerDefinition]
$creadListPrec :: ReadPrec [TimerDefinition]
readPrec :: ReadPrec TimerDefinition
$creadPrec :: ReadPrec TimerDefinition
readList :: ReadS [TimerDefinition]
$creadList :: ReadS [TimerDefinition]
readsPrec :: Int -> ReadS TimerDefinition
$creadsPrec :: Int -> ReadS TimerDefinition
Prelude.Read, Int -> TimerDefinition -> ShowS
[TimerDefinition] -> ShowS
TimerDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimerDefinition] -> ShowS
$cshowList :: [TimerDefinition] -> ShowS
show :: TimerDefinition -> String
$cshow :: TimerDefinition -> String
showsPrec :: Int -> TimerDefinition -> ShowS
$cshowsPrec :: Int -> TimerDefinition -> ShowS
Prelude.Show, forall x. Rep TimerDefinition x -> TimerDefinition
forall x. TimerDefinition -> Rep TimerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimerDefinition x -> TimerDefinition
$cfrom :: forall x. TimerDefinition -> Rep TimerDefinition x
Prelude.Generic)
newTimerDefinition ::
Prelude.Text ->
Prelude.Int ->
TimerDefinition
newTimerDefinition :: Text -> Int -> TimerDefinition
newTimerDefinition Text
pName_ Int
pSeconds_ =
TimerDefinition'
{ $sel:name:TimerDefinition' :: Text
name = Text
pName_,
$sel:seconds:TimerDefinition' :: Int
seconds = Int
pSeconds_
}
timerDefinition_name :: Lens.Lens' TimerDefinition Prelude.Text
timerDefinition_name :: Lens' TimerDefinition Text
timerDefinition_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimerDefinition' {Text
name :: Text
$sel:name:TimerDefinition' :: TimerDefinition -> Text
name} -> Text
name) (\s :: TimerDefinition
s@TimerDefinition' {} Text
a -> TimerDefinition
s {$sel:name:TimerDefinition' :: Text
name = Text
a} :: TimerDefinition)
timerDefinition_seconds :: Lens.Lens' TimerDefinition Prelude.Int
timerDefinition_seconds :: Lens' TimerDefinition Int
timerDefinition_seconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimerDefinition' {Int
seconds :: Int
$sel:seconds:TimerDefinition' :: TimerDefinition -> Int
seconds} -> Int
seconds) (\s :: TimerDefinition
s@TimerDefinition' {} Int
a -> TimerDefinition
s {$sel:seconds:TimerDefinition' :: Int
seconds = Int
a} :: TimerDefinition)
instance Prelude.Hashable TimerDefinition where
hashWithSalt :: Int -> TimerDefinition -> Int
hashWithSalt Int
_salt TimerDefinition' {Int
Text
seconds :: Int
name :: Text
$sel:seconds:TimerDefinition' :: TimerDefinition -> Int
$sel:name:TimerDefinition' :: TimerDefinition -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
seconds
instance Prelude.NFData TimerDefinition where
rnf :: TimerDefinition -> ()
rnf TimerDefinition' {Int
Text
seconds :: Int
name :: Text
$sel:seconds:TimerDefinition' :: TimerDefinition -> Int
$sel:name:TimerDefinition' :: TimerDefinition -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
seconds
instance Data.ToJSON TimerDefinition where
toJSON :: TimerDefinition -> Value
toJSON TimerDefinition' {Int
Text
seconds :: Int
name :: Text
$sel:seconds:TimerDefinition' :: TimerDefinition -> Int
$sel:name:TimerDefinition' :: TimerDefinition -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"seconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
seconds)
]
)