{-# 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.CodeDeploy.Types.TimeRange where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TimeRange = TimeRange'
{
TimeRange -> Maybe POSIX
start :: Prelude.Maybe Core.POSIX,
TimeRange -> Maybe POSIX
end :: Prelude.Maybe Core.POSIX
}
deriving (TimeRange -> TimeRange -> Bool
(TimeRange -> TimeRange -> Bool)
-> (TimeRange -> TimeRange -> Bool) -> Eq TimeRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeRange -> TimeRange -> Bool
$c/= :: TimeRange -> TimeRange -> Bool
== :: TimeRange -> TimeRange -> Bool
$c== :: TimeRange -> TimeRange -> Bool
Prelude.Eq, ReadPrec [TimeRange]
ReadPrec TimeRange
Int -> ReadS TimeRange
ReadS [TimeRange]
(Int -> ReadS TimeRange)
-> ReadS [TimeRange]
-> ReadPrec TimeRange
-> ReadPrec [TimeRange]
-> Read TimeRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimeRange]
$creadListPrec :: ReadPrec [TimeRange]
readPrec :: ReadPrec TimeRange
$creadPrec :: ReadPrec TimeRange
readList :: ReadS [TimeRange]
$creadList :: ReadS [TimeRange]
readsPrec :: Int -> ReadS TimeRange
$creadsPrec :: Int -> ReadS TimeRange
Prelude.Read, Int -> TimeRange -> ShowS
[TimeRange] -> ShowS
TimeRange -> String
(Int -> TimeRange -> ShowS)
-> (TimeRange -> String)
-> ([TimeRange] -> ShowS)
-> Show TimeRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimeRange] -> ShowS
$cshowList :: [TimeRange] -> ShowS
show :: TimeRange -> String
$cshow :: TimeRange -> String
showsPrec :: Int -> TimeRange -> ShowS
$cshowsPrec :: Int -> TimeRange -> ShowS
Prelude.Show, (forall x. TimeRange -> Rep TimeRange x)
-> (forall x. Rep TimeRange x -> TimeRange) -> Generic TimeRange
forall x. Rep TimeRange x -> TimeRange
forall x. TimeRange -> Rep TimeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimeRange x -> TimeRange
$cfrom :: forall x. TimeRange -> Rep TimeRange x
Prelude.Generic)
newTimeRange ::
TimeRange
newTimeRange :: TimeRange
newTimeRange =
TimeRange' :: Maybe POSIX -> Maybe POSIX -> TimeRange
TimeRange'
{ $sel:start:TimeRange' :: Maybe POSIX
start = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:end:TimeRange' :: Maybe POSIX
end = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
timeRange_start :: Lens.Lens' TimeRange (Prelude.Maybe Prelude.UTCTime)
timeRange_start :: (Maybe UTCTime -> f (Maybe UTCTime)) -> TimeRange -> f TimeRange
timeRange_start = (TimeRange -> Maybe POSIX)
-> (TimeRange -> Maybe POSIX -> TimeRange)
-> Lens TimeRange TimeRange (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRange' {Maybe POSIX
start :: Maybe POSIX
$sel:start:TimeRange' :: TimeRange -> Maybe POSIX
start} -> Maybe POSIX
start) (\s :: TimeRange
s@TimeRange' {} Maybe POSIX
a -> TimeRange
s {$sel:start:TimeRange' :: Maybe POSIX
start = Maybe POSIX
a} :: TimeRange) ((Maybe POSIX -> f (Maybe POSIX)) -> TimeRange -> f TimeRange)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TimeRange
-> f TimeRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
timeRange_end :: Lens.Lens' TimeRange (Prelude.Maybe Prelude.UTCTime)
timeRange_end :: (Maybe UTCTime -> f (Maybe UTCTime)) -> TimeRange -> f TimeRange
timeRange_end = (TimeRange -> Maybe POSIX)
-> (TimeRange -> Maybe POSIX -> TimeRange)
-> Lens TimeRange TimeRange (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeRange' {Maybe POSIX
end :: Maybe POSIX
$sel:end:TimeRange' :: TimeRange -> Maybe POSIX
end} -> Maybe POSIX
end) (\s :: TimeRange
s@TimeRange' {} Maybe POSIX
a -> TimeRange
s {$sel:end:TimeRange' :: Maybe POSIX
end = Maybe POSIX
a} :: TimeRange) ((Maybe POSIX -> f (Maybe POSIX)) -> TimeRange -> f TimeRange)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TimeRange
-> f TimeRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Prelude.Hashable TimeRange
instance Prelude.NFData TimeRange
instance Core.ToJSON TimeRange where
toJSON :: TimeRange -> Value
toJSON TimeRange' {Maybe POSIX
end :: Maybe POSIX
start :: Maybe POSIX
$sel:end:TimeRange' :: TimeRange -> Maybe POSIX
$sel:start:TimeRange' :: TimeRange -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"start" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
start,
(Text
"end" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
end
]
)