{-# 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.XRay.Types.HistogramEntry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data HistogramEntry = HistogramEntry'
{
HistogramEntry -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
HistogramEntry -> Maybe Double
value :: Prelude.Maybe Prelude.Double
}
deriving (HistogramEntry -> HistogramEntry -> Bool
(HistogramEntry -> HistogramEntry -> Bool)
-> (HistogramEntry -> HistogramEntry -> Bool) -> Eq HistogramEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HistogramEntry -> HistogramEntry -> Bool
$c/= :: HistogramEntry -> HistogramEntry -> Bool
== :: HistogramEntry -> HistogramEntry -> Bool
$c== :: HistogramEntry -> HistogramEntry -> Bool
Prelude.Eq, ReadPrec [HistogramEntry]
ReadPrec HistogramEntry
Int -> ReadS HistogramEntry
ReadS [HistogramEntry]
(Int -> ReadS HistogramEntry)
-> ReadS [HistogramEntry]
-> ReadPrec HistogramEntry
-> ReadPrec [HistogramEntry]
-> Read HistogramEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HistogramEntry]
$creadListPrec :: ReadPrec [HistogramEntry]
readPrec :: ReadPrec HistogramEntry
$creadPrec :: ReadPrec HistogramEntry
readList :: ReadS [HistogramEntry]
$creadList :: ReadS [HistogramEntry]
readsPrec :: Int -> ReadS HistogramEntry
$creadsPrec :: Int -> ReadS HistogramEntry
Prelude.Read, Int -> HistogramEntry -> ShowS
[HistogramEntry] -> ShowS
HistogramEntry -> String
(Int -> HistogramEntry -> ShowS)
-> (HistogramEntry -> String)
-> ([HistogramEntry] -> ShowS)
-> Show HistogramEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HistogramEntry] -> ShowS
$cshowList :: [HistogramEntry] -> ShowS
show :: HistogramEntry -> String
$cshow :: HistogramEntry -> String
showsPrec :: Int -> HistogramEntry -> ShowS
$cshowsPrec :: Int -> HistogramEntry -> ShowS
Prelude.Show, (forall x. HistogramEntry -> Rep HistogramEntry x)
-> (forall x. Rep HistogramEntry x -> HistogramEntry)
-> Generic HistogramEntry
forall x. Rep HistogramEntry x -> HistogramEntry
forall x. HistogramEntry -> Rep HistogramEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HistogramEntry x -> HistogramEntry
$cfrom :: forall x. HistogramEntry -> Rep HistogramEntry x
Prelude.Generic)
newHistogramEntry ::
HistogramEntry
newHistogramEntry :: HistogramEntry
newHistogramEntry =
HistogramEntry' :: Maybe Int -> Maybe Double -> HistogramEntry
HistogramEntry'
{ $sel:count:HistogramEntry' :: Maybe Int
count = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:value:HistogramEntry' :: Maybe Double
value = Maybe Double
forall a. Maybe a
Prelude.Nothing
}
histogramEntry_count :: Lens.Lens' HistogramEntry (Prelude.Maybe Prelude.Int)
histogramEntry_count :: (Maybe Int -> f (Maybe Int)) -> HistogramEntry -> f HistogramEntry
histogramEntry_count = (HistogramEntry -> Maybe Int)
-> (HistogramEntry -> Maybe Int -> HistogramEntry)
-> Lens HistogramEntry HistogramEntry (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HistogramEntry' {Maybe Int
count :: Maybe Int
$sel:count:HistogramEntry' :: HistogramEntry -> Maybe Int
count} -> Maybe Int
count) (\s :: HistogramEntry
s@HistogramEntry' {} Maybe Int
a -> HistogramEntry
s {$sel:count:HistogramEntry' :: Maybe Int
count = Maybe Int
a} :: HistogramEntry)
histogramEntry_value :: Lens.Lens' HistogramEntry (Prelude.Maybe Prelude.Double)
histogramEntry_value :: (Maybe Double -> f (Maybe Double))
-> HistogramEntry -> f HistogramEntry
histogramEntry_value = (HistogramEntry -> Maybe Double)
-> (HistogramEntry -> Maybe Double -> HistogramEntry)
-> Lens HistogramEntry HistogramEntry (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HistogramEntry' {Maybe Double
value :: Maybe Double
$sel:value:HistogramEntry' :: HistogramEntry -> Maybe Double
value} -> Maybe Double
value) (\s :: HistogramEntry
s@HistogramEntry' {} Maybe Double
a -> HistogramEntry
s {$sel:value:HistogramEntry' :: Maybe Double
value = Maybe Double
a} :: HistogramEntry)
instance Core.FromJSON HistogramEntry where
parseJSON :: Value -> Parser HistogramEntry
parseJSON =
String
-> (Object -> Parser HistogramEntry)
-> Value
-> Parser HistogramEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HistogramEntry"
( \Object
x ->
Maybe Int -> Maybe Double -> HistogramEntry
HistogramEntry'
(Maybe Int -> Maybe Double -> HistogramEntry)
-> Parser (Maybe Int) -> Parser (Maybe Double -> HistogramEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Count")
Parser (Maybe Double -> HistogramEntry)
-> Parser (Maybe Double) -> Parser HistogramEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
)
instance Prelude.Hashable HistogramEntry
instance Prelude.NFData HistogramEntry