{-# 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.IoTAnalytics.Types.DeltaTime 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 DeltaTime = DeltaTime'
{
DeltaTime -> Int
offsetSeconds :: Prelude.Int,
DeltaTime -> Text
timeExpression :: Prelude.Text
}
deriving (DeltaTime -> DeltaTime -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeltaTime -> DeltaTime -> Bool
$c/= :: DeltaTime -> DeltaTime -> Bool
== :: DeltaTime -> DeltaTime -> Bool
$c== :: DeltaTime -> DeltaTime -> Bool
Prelude.Eq, ReadPrec [DeltaTime]
ReadPrec DeltaTime
Int -> ReadS DeltaTime
ReadS [DeltaTime]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeltaTime]
$creadListPrec :: ReadPrec [DeltaTime]
readPrec :: ReadPrec DeltaTime
$creadPrec :: ReadPrec DeltaTime
readList :: ReadS [DeltaTime]
$creadList :: ReadS [DeltaTime]
readsPrec :: Int -> ReadS DeltaTime
$creadsPrec :: Int -> ReadS DeltaTime
Prelude.Read, Int -> DeltaTime -> ShowS
[DeltaTime] -> ShowS
DeltaTime -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeltaTime] -> ShowS
$cshowList :: [DeltaTime] -> ShowS
show :: DeltaTime -> String
$cshow :: DeltaTime -> String
showsPrec :: Int -> DeltaTime -> ShowS
$cshowsPrec :: Int -> DeltaTime -> ShowS
Prelude.Show, forall x. Rep DeltaTime x -> DeltaTime
forall x. DeltaTime -> Rep DeltaTime x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeltaTime x -> DeltaTime
$cfrom :: forall x. DeltaTime -> Rep DeltaTime x
Prelude.Generic)
newDeltaTime ::
Prelude.Int ->
Prelude.Text ->
DeltaTime
newDeltaTime :: Int -> Text -> DeltaTime
newDeltaTime Int
pOffsetSeconds_ Text
pTimeExpression_ =
DeltaTime'
{ $sel:offsetSeconds:DeltaTime' :: Int
offsetSeconds = Int
pOffsetSeconds_,
$sel:timeExpression:DeltaTime' :: Text
timeExpression = Text
pTimeExpression_
}
deltaTime_offsetSeconds :: Lens.Lens' DeltaTime Prelude.Int
deltaTime_offsetSeconds :: Lens' DeltaTime Int
deltaTime_offsetSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTime' {Int
offsetSeconds :: Int
$sel:offsetSeconds:DeltaTime' :: DeltaTime -> Int
offsetSeconds} -> Int
offsetSeconds) (\s :: DeltaTime
s@DeltaTime' {} Int
a -> DeltaTime
s {$sel:offsetSeconds:DeltaTime' :: Int
offsetSeconds = Int
a} :: DeltaTime)
deltaTime_timeExpression :: Lens.Lens' DeltaTime Prelude.Text
deltaTime_timeExpression :: Lens' DeltaTime Text
deltaTime_timeExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeltaTime' {Text
timeExpression :: Text
$sel:timeExpression:DeltaTime' :: DeltaTime -> Text
timeExpression} -> Text
timeExpression) (\s :: DeltaTime
s@DeltaTime' {} Text
a -> DeltaTime
s {$sel:timeExpression:DeltaTime' :: Text
timeExpression = Text
a} :: DeltaTime)
instance Data.FromJSON DeltaTime where
parseJSON :: Value -> Parser DeltaTime
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DeltaTime"
( \Object
x ->
Int -> Text -> DeltaTime
DeltaTime'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"offsetSeconds")
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
"timeExpression")
)
instance Prelude.Hashable DeltaTime where
hashWithSalt :: Int -> DeltaTime -> Int
hashWithSalt Int
_salt DeltaTime' {Int
Text
timeExpression :: Text
offsetSeconds :: Int
$sel:timeExpression:DeltaTime' :: DeltaTime -> Text
$sel:offsetSeconds:DeltaTime' :: DeltaTime -> Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
offsetSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timeExpression
instance Prelude.NFData DeltaTime where
rnf :: DeltaTime -> ()
rnf DeltaTime' {Int
Text
timeExpression :: Text
offsetSeconds :: Int
$sel:timeExpression:DeltaTime' :: DeltaTime -> Text
$sel:offsetSeconds:DeltaTime' :: DeltaTime -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
offsetSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timeExpression
instance Data.ToJSON DeltaTime where
toJSON :: DeltaTime -> Value
toJSON DeltaTime' {Int
Text
timeExpression :: Text
offsetSeconds :: Int
$sel:timeExpression:DeltaTime' :: DeltaTime -> Text
$sel:offsetSeconds:DeltaTime' :: DeltaTime -> Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"offsetSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
offsetSeconds),
forall a. a -> Maybe a
Prelude.Just
(Key
"timeExpression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timeExpression)
]
)