{-# 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.FrameMetric where
import Amazonka.CodeGuruProfiler.Types.MetricType
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 FrameMetric = FrameMetric'
{
FrameMetric -> Text
frameName :: Prelude.Text,
FrameMetric -> [Text]
threadStates :: [Prelude.Text],
FrameMetric -> MetricType
type' :: MetricType
}
deriving (FrameMetric -> FrameMetric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameMetric -> FrameMetric -> Bool
$c/= :: FrameMetric -> FrameMetric -> Bool
== :: FrameMetric -> FrameMetric -> Bool
$c== :: FrameMetric -> FrameMetric -> Bool
Prelude.Eq, ReadPrec [FrameMetric]
ReadPrec FrameMetric
Int -> ReadS FrameMetric
ReadS [FrameMetric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FrameMetric]
$creadListPrec :: ReadPrec [FrameMetric]
readPrec :: ReadPrec FrameMetric
$creadPrec :: ReadPrec FrameMetric
readList :: ReadS [FrameMetric]
$creadList :: ReadS [FrameMetric]
readsPrec :: Int -> ReadS FrameMetric
$creadsPrec :: Int -> ReadS FrameMetric
Prelude.Read, Int -> FrameMetric -> ShowS
[FrameMetric] -> ShowS
FrameMetric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameMetric] -> ShowS
$cshowList :: [FrameMetric] -> ShowS
show :: FrameMetric -> String
$cshow :: FrameMetric -> String
showsPrec :: Int -> FrameMetric -> ShowS
$cshowsPrec :: Int -> FrameMetric -> ShowS
Prelude.Show, forall x. Rep FrameMetric x -> FrameMetric
forall x. FrameMetric -> Rep FrameMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FrameMetric x -> FrameMetric
$cfrom :: forall x. FrameMetric -> Rep FrameMetric x
Prelude.Generic)
newFrameMetric ::
Prelude.Text ->
MetricType ->
FrameMetric
newFrameMetric :: Text -> MetricType -> FrameMetric
newFrameMetric Text
pFrameName_ MetricType
pType_ =
FrameMetric'
{ $sel:frameName:FrameMetric' :: Text
frameName = Text
pFrameName_,
$sel:threadStates:FrameMetric' :: [Text]
threadStates = forall a. Monoid a => a
Prelude.mempty,
$sel:type':FrameMetric' :: MetricType
type' = MetricType
pType_
}
frameMetric_frameName :: Lens.Lens' FrameMetric Prelude.Text
frameMetric_frameName :: Lens' FrameMetric Text
frameMetric_frameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameMetric' {Text
frameName :: Text
$sel:frameName:FrameMetric' :: FrameMetric -> Text
frameName} -> Text
frameName) (\s :: FrameMetric
s@FrameMetric' {} Text
a -> FrameMetric
s {$sel:frameName:FrameMetric' :: Text
frameName = Text
a} :: FrameMetric)
frameMetric_threadStates :: Lens.Lens' FrameMetric [Prelude.Text]
frameMetric_threadStates :: Lens' FrameMetric [Text]
frameMetric_threadStates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameMetric' {[Text]
threadStates :: [Text]
$sel:threadStates:FrameMetric' :: FrameMetric -> [Text]
threadStates} -> [Text]
threadStates) (\s :: FrameMetric
s@FrameMetric' {} [Text]
a -> FrameMetric
s {$sel:threadStates:FrameMetric' :: [Text]
threadStates = [Text]
a} :: FrameMetric) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
frameMetric_type :: Lens.Lens' FrameMetric MetricType
frameMetric_type :: Lens' FrameMetric MetricType
frameMetric_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameMetric' {MetricType
type' :: MetricType
$sel:type':FrameMetric' :: FrameMetric -> MetricType
type'} -> MetricType
type') (\s :: FrameMetric
s@FrameMetric' {} MetricType
a -> FrameMetric
s {$sel:type':FrameMetric' :: MetricType
type' = MetricType
a} :: FrameMetric)
instance Data.FromJSON FrameMetric where
parseJSON :: Value -> Parser FrameMetric
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"FrameMetric"
( \Object
x ->
Text -> [Text] -> MetricType -> FrameMetric
FrameMetric'
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
"frameName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"threadStates" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"type")
)
instance Prelude.Hashable FrameMetric where
hashWithSalt :: Int -> FrameMetric -> Int
hashWithSalt Int
_salt FrameMetric' {[Text]
Text
MetricType
type' :: MetricType
threadStates :: [Text]
frameName :: Text
$sel:type':FrameMetric' :: FrameMetric -> MetricType
$sel:threadStates:FrameMetric' :: FrameMetric -> [Text]
$sel:frameName:FrameMetric' :: FrameMetric -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
frameName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
threadStates
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MetricType
type'
instance Prelude.NFData FrameMetric where
rnf :: FrameMetric -> ()
rnf FrameMetric' {[Text]
Text
MetricType
type' :: MetricType
threadStates :: [Text]
frameName :: Text
$sel:type':FrameMetric' :: FrameMetric -> MetricType
$sel:threadStates:FrameMetric' :: FrameMetric -> [Text]
$sel:frameName:FrameMetric' :: FrameMetric -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
frameName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
threadStates
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MetricType
type'
instance Data.ToJSON FrameMetric where
toJSON :: FrameMetric -> Value
toJSON FrameMetric' {[Text]
Text
MetricType
type' :: MetricType
threadStates :: [Text]
frameName :: Text
$sel:type':FrameMetric' :: FrameMetric -> MetricType
$sel:threadStates:FrameMetric' :: FrameMetric -> [Text]
$sel:frameName:FrameMetric' :: FrameMetric -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"frameName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
frameName),
forall a. a -> Maybe a
Prelude.Just (Key
"threadStates" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
threadStates),
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MetricType
type')
]
)