{-# 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.CodeGuruProfiler.Types.AnomalyInstance where
import Amazonka.CodeGuruProfiler.Types.UserFeedback
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AnomalyInstance = AnomalyInstance'
{
AnomalyInstance -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
AnomalyInstance -> Maybe UserFeedback
userFeedback :: Prelude.Maybe UserFeedback,
AnomalyInstance -> Text
id :: Prelude.Text,
AnomalyInstance -> POSIX
startTime :: Core.POSIX
}
deriving (AnomalyInstance -> AnomalyInstance -> Bool
(AnomalyInstance -> AnomalyInstance -> Bool)
-> (AnomalyInstance -> AnomalyInstance -> Bool)
-> Eq AnomalyInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyInstance -> AnomalyInstance -> Bool
$c/= :: AnomalyInstance -> AnomalyInstance -> Bool
== :: AnomalyInstance -> AnomalyInstance -> Bool
$c== :: AnomalyInstance -> AnomalyInstance -> Bool
Prelude.Eq, ReadPrec [AnomalyInstance]
ReadPrec AnomalyInstance
Int -> ReadS AnomalyInstance
ReadS [AnomalyInstance]
(Int -> ReadS AnomalyInstance)
-> ReadS [AnomalyInstance]
-> ReadPrec AnomalyInstance
-> ReadPrec [AnomalyInstance]
-> Read AnomalyInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyInstance]
$creadListPrec :: ReadPrec [AnomalyInstance]
readPrec :: ReadPrec AnomalyInstance
$creadPrec :: ReadPrec AnomalyInstance
readList :: ReadS [AnomalyInstance]
$creadList :: ReadS [AnomalyInstance]
readsPrec :: Int -> ReadS AnomalyInstance
$creadsPrec :: Int -> ReadS AnomalyInstance
Prelude.Read, Int -> AnomalyInstance -> ShowS
[AnomalyInstance] -> ShowS
AnomalyInstance -> String
(Int -> AnomalyInstance -> ShowS)
-> (AnomalyInstance -> String)
-> ([AnomalyInstance] -> ShowS)
-> Show AnomalyInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyInstance] -> ShowS
$cshowList :: [AnomalyInstance] -> ShowS
show :: AnomalyInstance -> String
$cshow :: AnomalyInstance -> String
showsPrec :: Int -> AnomalyInstance -> ShowS
$cshowsPrec :: Int -> AnomalyInstance -> ShowS
Prelude.Show, (forall x. AnomalyInstance -> Rep AnomalyInstance x)
-> (forall x. Rep AnomalyInstance x -> AnomalyInstance)
-> Generic AnomalyInstance
forall x. Rep AnomalyInstance x -> AnomalyInstance
forall x. AnomalyInstance -> Rep AnomalyInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyInstance x -> AnomalyInstance
$cfrom :: forall x. AnomalyInstance -> Rep AnomalyInstance x
Prelude.Generic)
newAnomalyInstance ::
Prelude.Text ->
Prelude.UTCTime ->
AnomalyInstance
newAnomalyInstance :: Text -> UTCTime -> AnomalyInstance
newAnomalyInstance Text
pId_ UTCTime
pStartTime_ =
AnomalyInstance' :: Maybe POSIX
-> Maybe UserFeedback -> Text -> POSIX -> AnomalyInstance
AnomalyInstance'
{ $sel:endTime:AnomalyInstance' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:userFeedback:AnomalyInstance' :: Maybe UserFeedback
userFeedback = Maybe UserFeedback
forall a. Maybe a
Prelude.Nothing,
$sel:id:AnomalyInstance' :: Text
id = Text
pId_,
$sel:startTime:AnomalyInstance' :: 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_
}
anomalyInstance_endTime :: Lens.Lens' AnomalyInstance (Prelude.Maybe Prelude.UTCTime)
anomalyInstance_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AnomalyInstance -> f AnomalyInstance
anomalyInstance_endTime = (AnomalyInstance -> Maybe POSIX)
-> (AnomalyInstance -> Maybe POSIX -> AnomalyInstance)
-> Lens AnomalyInstance AnomalyInstance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyInstance' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:AnomalyInstance' :: AnomalyInstance -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: AnomalyInstance
s@AnomalyInstance' {} Maybe POSIX
a -> AnomalyInstance
s {$sel:endTime:AnomalyInstance' :: Maybe POSIX
endTime = Maybe POSIX
a} :: AnomalyInstance) ((Maybe POSIX -> f (Maybe POSIX))
-> AnomalyInstance -> f AnomalyInstance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AnomalyInstance
-> f AnomalyInstance
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
anomalyInstance_userFeedback :: Lens.Lens' AnomalyInstance (Prelude.Maybe UserFeedback)
anomalyInstance_userFeedback :: (Maybe UserFeedback -> f (Maybe UserFeedback))
-> AnomalyInstance -> f AnomalyInstance
anomalyInstance_userFeedback = (AnomalyInstance -> Maybe UserFeedback)
-> (AnomalyInstance -> Maybe UserFeedback -> AnomalyInstance)
-> Lens
AnomalyInstance
AnomalyInstance
(Maybe UserFeedback)
(Maybe UserFeedback)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyInstance' {Maybe UserFeedback
userFeedback :: Maybe UserFeedback
$sel:userFeedback:AnomalyInstance' :: AnomalyInstance -> Maybe UserFeedback
userFeedback} -> Maybe UserFeedback
userFeedback) (\s :: AnomalyInstance
s@AnomalyInstance' {} Maybe UserFeedback
a -> AnomalyInstance
s {$sel:userFeedback:AnomalyInstance' :: Maybe UserFeedback
userFeedback = Maybe UserFeedback
a} :: AnomalyInstance)
anomalyInstance_id :: Lens.Lens' AnomalyInstance Prelude.Text
anomalyInstance_id :: (Text -> f Text) -> AnomalyInstance -> f AnomalyInstance
anomalyInstance_id = (AnomalyInstance -> Text)
-> (AnomalyInstance -> Text -> AnomalyInstance)
-> Lens AnomalyInstance AnomalyInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyInstance' {Text
id :: Text
$sel:id:AnomalyInstance' :: AnomalyInstance -> Text
id} -> Text
id) (\s :: AnomalyInstance
s@AnomalyInstance' {} Text
a -> AnomalyInstance
s {$sel:id:AnomalyInstance' :: Text
id = Text
a} :: AnomalyInstance)
anomalyInstance_startTime :: Lens.Lens' AnomalyInstance Prelude.UTCTime
anomalyInstance_startTime :: (UTCTime -> f UTCTime) -> AnomalyInstance -> f AnomalyInstance
anomalyInstance_startTime = (AnomalyInstance -> POSIX)
-> (AnomalyInstance -> POSIX -> AnomalyInstance)
-> Lens AnomalyInstance AnomalyInstance POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyInstance' {POSIX
startTime :: POSIX
$sel:startTime:AnomalyInstance' :: AnomalyInstance -> POSIX
startTime} -> POSIX
startTime) (\s :: AnomalyInstance
s@AnomalyInstance' {} POSIX
a -> AnomalyInstance
s {$sel:startTime:AnomalyInstance' :: POSIX
startTime = POSIX
a} :: AnomalyInstance) ((POSIX -> f POSIX) -> AnomalyInstance -> f AnomalyInstance)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AnomalyInstance
-> f AnomalyInstance
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 AnomalyInstance where
parseJSON :: Value -> Parser AnomalyInstance
parseJSON =
String
-> (Object -> Parser AnomalyInstance)
-> Value
-> Parser AnomalyInstance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AnomalyInstance"
( \Object
x ->
Maybe POSIX
-> Maybe UserFeedback -> Text -> POSIX -> AnomalyInstance
AnomalyInstance'
(Maybe POSIX
-> Maybe UserFeedback -> Text -> POSIX -> AnomalyInstance)
-> Parser (Maybe POSIX)
-> Parser (Maybe UserFeedback -> Text -> POSIX -> AnomalyInstance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"endTime")
Parser (Maybe UserFeedback -> Text -> POSIX -> AnomalyInstance)
-> Parser (Maybe UserFeedback)
-> Parser (Text -> POSIX -> AnomalyInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UserFeedback)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"userFeedback")
Parser (Text -> POSIX -> AnomalyInstance)
-> Parser Text -> Parser (POSIX -> AnomalyInstance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"id")
Parser (POSIX -> AnomalyInstance)
-> Parser POSIX -> Parser AnomalyInstance
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
"startTime")
)
instance Prelude.Hashable AnomalyInstance
instance Prelude.NFData AnomalyInstance