{-# 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.ViolationEventOccurrenceRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ViolationEventOccurrenceRange = ViolationEventOccurrenceRange'
{
ViolationEventOccurrenceRange -> POSIX
startTime :: Core.POSIX,
ViolationEventOccurrenceRange -> POSIX
endTime :: Core.POSIX
}
deriving (ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool
(ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool)
-> (ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool)
-> Eq ViolationEventOccurrenceRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool
$c/= :: ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool
== :: ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool
$c== :: ViolationEventOccurrenceRange
-> ViolationEventOccurrenceRange -> Bool
Prelude.Eq, ReadPrec [ViolationEventOccurrenceRange]
ReadPrec ViolationEventOccurrenceRange
Int -> ReadS ViolationEventOccurrenceRange
ReadS [ViolationEventOccurrenceRange]
(Int -> ReadS ViolationEventOccurrenceRange)
-> ReadS [ViolationEventOccurrenceRange]
-> ReadPrec ViolationEventOccurrenceRange
-> ReadPrec [ViolationEventOccurrenceRange]
-> Read ViolationEventOccurrenceRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ViolationEventOccurrenceRange]
$creadListPrec :: ReadPrec [ViolationEventOccurrenceRange]
readPrec :: ReadPrec ViolationEventOccurrenceRange
$creadPrec :: ReadPrec ViolationEventOccurrenceRange
readList :: ReadS [ViolationEventOccurrenceRange]
$creadList :: ReadS [ViolationEventOccurrenceRange]
readsPrec :: Int -> ReadS ViolationEventOccurrenceRange
$creadsPrec :: Int -> ReadS ViolationEventOccurrenceRange
Prelude.Read, Int -> ViolationEventOccurrenceRange -> ShowS
[ViolationEventOccurrenceRange] -> ShowS
ViolationEventOccurrenceRange -> String
(Int -> ViolationEventOccurrenceRange -> ShowS)
-> (ViolationEventOccurrenceRange -> String)
-> ([ViolationEventOccurrenceRange] -> ShowS)
-> Show ViolationEventOccurrenceRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ViolationEventOccurrenceRange] -> ShowS
$cshowList :: [ViolationEventOccurrenceRange] -> ShowS
show :: ViolationEventOccurrenceRange -> String
$cshow :: ViolationEventOccurrenceRange -> String
showsPrec :: Int -> ViolationEventOccurrenceRange -> ShowS
$cshowsPrec :: Int -> ViolationEventOccurrenceRange -> ShowS
Prelude.Show, (forall x.
ViolationEventOccurrenceRange
-> Rep ViolationEventOccurrenceRange x)
-> (forall x.
Rep ViolationEventOccurrenceRange x
-> ViolationEventOccurrenceRange)
-> Generic ViolationEventOccurrenceRange
forall x.
Rep ViolationEventOccurrenceRange x
-> ViolationEventOccurrenceRange
forall x.
ViolationEventOccurrenceRange
-> Rep ViolationEventOccurrenceRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ViolationEventOccurrenceRange x
-> ViolationEventOccurrenceRange
$cfrom :: forall x.
ViolationEventOccurrenceRange
-> Rep ViolationEventOccurrenceRange x
Prelude.Generic)
newViolationEventOccurrenceRange ::
Prelude.UTCTime ->
Prelude.UTCTime ->
ViolationEventOccurrenceRange
newViolationEventOccurrenceRange :: UTCTime -> UTCTime -> ViolationEventOccurrenceRange
newViolationEventOccurrenceRange
UTCTime
pStartTime_
UTCTime
pEndTime_ =
ViolationEventOccurrenceRange' :: POSIX -> POSIX -> ViolationEventOccurrenceRange
ViolationEventOccurrenceRange'
{ $sel:startTime:ViolationEventOccurrenceRange' :: POSIX
startTime =
Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
$sel:endTime:ViolationEventOccurrenceRange' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
}
violationEventOccurrenceRange_startTime :: Lens.Lens' ViolationEventOccurrenceRange Prelude.UTCTime
violationEventOccurrenceRange_startTime :: (UTCTime -> f UTCTime)
-> ViolationEventOccurrenceRange -> f ViolationEventOccurrenceRange
violationEventOccurrenceRange_startTime = (ViolationEventOccurrenceRange -> POSIX)
-> (ViolationEventOccurrenceRange
-> POSIX -> ViolationEventOccurrenceRange)
-> Lens
ViolationEventOccurrenceRange
ViolationEventOccurrenceRange
POSIX
POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViolationEventOccurrenceRange' {POSIX
startTime :: POSIX
$sel:startTime:ViolationEventOccurrenceRange' :: ViolationEventOccurrenceRange -> POSIX
startTime} -> POSIX
startTime) (\s :: ViolationEventOccurrenceRange
s@ViolationEventOccurrenceRange' {} POSIX
a -> ViolationEventOccurrenceRange
s {$sel:startTime:ViolationEventOccurrenceRange' :: POSIX
startTime = POSIX
a} :: ViolationEventOccurrenceRange) ((POSIX -> f POSIX)
-> ViolationEventOccurrenceRange
-> f ViolationEventOccurrenceRange)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ViolationEventOccurrenceRange
-> f ViolationEventOccurrenceRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
violationEventOccurrenceRange_endTime :: Lens.Lens' ViolationEventOccurrenceRange Prelude.UTCTime
violationEventOccurrenceRange_endTime :: (UTCTime -> f UTCTime)
-> ViolationEventOccurrenceRange -> f ViolationEventOccurrenceRange
violationEventOccurrenceRange_endTime = (ViolationEventOccurrenceRange -> POSIX)
-> (ViolationEventOccurrenceRange
-> POSIX -> ViolationEventOccurrenceRange)
-> Lens
ViolationEventOccurrenceRange
ViolationEventOccurrenceRange
POSIX
POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ViolationEventOccurrenceRange' {POSIX
endTime :: POSIX
$sel:endTime:ViolationEventOccurrenceRange' :: ViolationEventOccurrenceRange -> POSIX
endTime} -> POSIX
endTime) (\s :: ViolationEventOccurrenceRange
s@ViolationEventOccurrenceRange' {} POSIX
a -> ViolationEventOccurrenceRange
s {$sel:endTime:ViolationEventOccurrenceRange' :: POSIX
endTime = POSIX
a} :: ViolationEventOccurrenceRange) ((POSIX -> f POSIX)
-> ViolationEventOccurrenceRange
-> f ViolationEventOccurrenceRange)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ViolationEventOccurrenceRange
-> f ViolationEventOccurrenceRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON ViolationEventOccurrenceRange where
parseJSON :: Value -> Parser ViolationEventOccurrenceRange
parseJSON =
String
-> (Object -> Parser ViolationEventOccurrenceRange)
-> Value
-> Parser ViolationEventOccurrenceRange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ViolationEventOccurrenceRange"
( \Object
x ->
POSIX -> POSIX -> ViolationEventOccurrenceRange
ViolationEventOccurrenceRange'
(POSIX -> POSIX -> ViolationEventOccurrenceRange)
-> Parser POSIX -> Parser (POSIX -> ViolationEventOccurrenceRange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startTime")
Parser (POSIX -> ViolationEventOccurrenceRange)
-> Parser POSIX -> Parser ViolationEventOccurrenceRange
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"endTime")
)
instance
Prelude.Hashable
ViolationEventOccurrenceRange
instance Prelude.NFData ViolationEventOccurrenceRange
instance Core.ToJSON ViolationEventOccurrenceRange where
toJSON :: ViolationEventOccurrenceRange -> Value
toJSON ViolationEventOccurrenceRange' {POSIX
endTime :: POSIX
startTime :: POSIX
$sel:endTime:ViolationEventOccurrenceRange' :: ViolationEventOccurrenceRange -> POSIX
$sel:startTime:ViolationEventOccurrenceRange' :: ViolationEventOccurrenceRange -> POSIX
..} =
[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
"startTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
startTime),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"endTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
endTime)
]
)