{-# 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.Metric 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 Metric = Metric'
{
Metric -> Text
frameName :: Prelude.Text,
Metric -> [Text]
threadStates :: [Prelude.Text],
Metric -> MetricType
type' :: MetricType
}
deriving (Metric -> Metric -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Metric -> Metric -> Bool
$c/= :: Metric -> Metric -> Bool
== :: Metric -> Metric -> Bool
$c== :: Metric -> Metric -> Bool
Prelude.Eq, ReadPrec [Metric]
ReadPrec Metric
Int -> ReadS Metric
ReadS [Metric]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Metric]
$creadListPrec :: ReadPrec [Metric]
readPrec :: ReadPrec Metric
$creadPrec :: ReadPrec Metric
readList :: ReadS [Metric]
$creadList :: ReadS [Metric]
readsPrec :: Int -> ReadS Metric
$creadsPrec :: Int -> ReadS Metric
Prelude.Read, Int -> Metric -> ShowS
[Metric] -> ShowS
Metric -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Metric] -> ShowS
$cshowList :: [Metric] -> ShowS
show :: Metric -> String
$cshow :: Metric -> String
showsPrec :: Int -> Metric -> ShowS
$cshowsPrec :: Int -> Metric -> ShowS
Prelude.Show, forall x. Rep Metric x -> Metric
forall x. Metric -> Rep Metric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Metric x -> Metric
$cfrom :: forall x. Metric -> Rep Metric x
Prelude.Generic)
newMetric ::
Prelude.Text ->
MetricType ->
Metric
newMetric :: Text -> MetricType -> Metric
newMetric Text
pFrameName_ MetricType
pType_ =
Metric'
{ $sel:frameName:Metric' :: Text
frameName = Text
pFrameName_,
$sel:threadStates:Metric' :: [Text]
threadStates = forall a. Monoid a => a
Prelude.mempty,
$sel:type':Metric' :: MetricType
type' = MetricType
pType_
}
metric_frameName :: Lens.Lens' Metric Prelude.Text
metric_frameName :: Lens' Metric Text
metric_frameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metric' {Text
frameName :: Text
$sel:frameName:Metric' :: Metric -> Text
frameName} -> Text
frameName) (\s :: Metric
s@Metric' {} Text
a -> Metric
s {$sel:frameName:Metric' :: Text
frameName = Text
a} :: Metric)
metric_threadStates :: Lens.Lens' Metric [Prelude.Text]
metric_threadStates :: Lens' Metric [Text]
metric_threadStates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metric' {[Text]
threadStates :: [Text]
$sel:threadStates:Metric' :: Metric -> [Text]
threadStates} -> [Text]
threadStates) (\s :: Metric
s@Metric' {} [Text]
a -> Metric
s {$sel:threadStates:Metric' :: [Text]
threadStates = [Text]
a} :: Metric) 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
metric_type :: Lens.Lens' Metric MetricType
metric_type :: Lens' Metric MetricType
metric_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metric' {MetricType
type' :: MetricType
$sel:type':Metric' :: Metric -> MetricType
type'} -> MetricType
type') (\s :: Metric
s@Metric' {} MetricType
a -> Metric
s {$sel:type':Metric' :: MetricType
type' = MetricType
a} :: Metric)
instance Data.FromJSON Metric where
parseJSON :: Value -> Parser Metric
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Metric"
( \Object
x ->
Text -> [Text] -> MetricType -> Metric
Metric'
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 Metric where
hashWithSalt :: Int -> Metric -> Int
hashWithSalt Int
_salt Metric' {[Text]
Text
MetricType
type' :: MetricType
threadStates :: [Text]
frameName :: Text
$sel:type':Metric' :: Metric -> MetricType
$sel:threadStates:Metric' :: Metric -> [Text]
$sel:frameName:Metric' :: Metric -> 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 Metric where
rnf :: Metric -> ()
rnf Metric' {[Text]
Text
MetricType
type' :: MetricType
threadStates :: [Text]
frameName :: Text
$sel:type':Metric' :: Metric -> MetricType
$sel:threadStates:Metric' :: Metric -> [Text]
$sel:frameName:Metric' :: Metric -> 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'