{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TimerDefinition = TimerDefinition'
{
TimerDefinition -> Text
name :: Prelude.Text,
TimerDefinition -> Int
seconds :: Prelude.Int
}
deriving (TimerDefinition -> TimerDefinition -> Bool
(TimerDefinition -> TimerDefinition -> Bool)
-> (TimerDefinition -> TimerDefinition -> Bool)
-> Eq TimerDefinition
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]
(Int -> ReadS TimerDefinition)
-> ReadS [TimerDefinition]
-> ReadPrec TimerDefinition
-> ReadPrec [TimerDefinition]
-> Read 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
(Int -> TimerDefinition -> ShowS)
-> (TimerDefinition -> String)
-> ([TimerDefinition] -> ShowS)
-> Show TimerDefinition
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. TimerDefinition -> Rep TimerDefinition x)
-> (forall x. Rep TimerDefinition x -> TimerDefinition)
-> Generic TimerDefinition
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' :: Text -> Int -> TimerDefinition
TimerDefinition'
{ $sel:name:TimerDefinition' :: Text
name = Text
pName_,
$sel:seconds:TimerDefinition' :: Int
seconds = Int
pSeconds_
}
timerDefinition_name :: Lens.Lens' TimerDefinition Prelude.Text
timerDefinition_name :: (Text -> f Text) -> TimerDefinition -> f TimerDefinition
timerDefinition_name = (TimerDefinition -> Text)
-> (TimerDefinition -> Text -> TimerDefinition)
-> Lens TimerDefinition TimerDefinition Text Text
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 :: (Int -> f Int) -> TimerDefinition -> f TimerDefinition
timerDefinition_seconds = (TimerDefinition -> Int)
-> (TimerDefinition -> Int -> TimerDefinition)
-> Lens TimerDefinition TimerDefinition Int Int
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
instance Prelude.NFData TimerDefinition
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"seconds" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
seconds)
]
)