{-# 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.LookoutMetrics.Types.TimeSeries where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutMetrics.Types.DimensionNameValue
import qualified Amazonka.Prelude as Prelude
data TimeSeries = TimeSeries'
{
TimeSeries -> Text
timeSeriesId :: Prelude.Text,
TimeSeries -> [DimensionNameValue]
dimensionList :: [DimensionNameValue],
TimeSeries -> [Double]
metricValueList :: [Prelude.Double]
}
deriving (TimeSeries -> TimeSeries -> Bool
(TimeSeries -> TimeSeries -> Bool)
-> (TimeSeries -> TimeSeries -> Bool) -> Eq TimeSeries
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeSeries -> TimeSeries -> Bool
$c/= :: TimeSeries -> TimeSeries -> Bool
== :: TimeSeries -> TimeSeries -> Bool
$c== :: TimeSeries -> TimeSeries -> Bool
Prelude.Eq, ReadPrec [TimeSeries]
ReadPrec TimeSeries
Int -> ReadS TimeSeries
ReadS [TimeSeries]
(Int -> ReadS TimeSeries)
-> ReadS [TimeSeries]
-> ReadPrec TimeSeries
-> ReadPrec [TimeSeries]
-> Read TimeSeries
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimeSeries]
$creadListPrec :: ReadPrec [TimeSeries]
readPrec :: ReadPrec TimeSeries
$creadPrec :: ReadPrec TimeSeries
readList :: ReadS [TimeSeries]
$creadList :: ReadS [TimeSeries]
readsPrec :: Int -> ReadS TimeSeries
$creadsPrec :: Int -> ReadS TimeSeries
Prelude.Read, Int -> TimeSeries -> ShowS
[TimeSeries] -> ShowS
TimeSeries -> String
(Int -> TimeSeries -> ShowS)
-> (TimeSeries -> String)
-> ([TimeSeries] -> ShowS)
-> Show TimeSeries
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimeSeries] -> ShowS
$cshowList :: [TimeSeries] -> ShowS
show :: TimeSeries -> String
$cshow :: TimeSeries -> String
showsPrec :: Int -> TimeSeries -> ShowS
$cshowsPrec :: Int -> TimeSeries -> ShowS
Prelude.Show, (forall x. TimeSeries -> Rep TimeSeries x)
-> (forall x. Rep TimeSeries x -> TimeSeries) -> Generic TimeSeries
forall x. Rep TimeSeries x -> TimeSeries
forall x. TimeSeries -> Rep TimeSeries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimeSeries x -> TimeSeries
$cfrom :: forall x. TimeSeries -> Rep TimeSeries x
Prelude.Generic)
newTimeSeries ::
Prelude.Text ->
TimeSeries
newTimeSeries :: Text -> TimeSeries
newTimeSeries Text
pTimeSeriesId_ =
TimeSeries' :: Text -> [DimensionNameValue] -> [Double] -> TimeSeries
TimeSeries'
{ $sel:timeSeriesId:TimeSeries' :: Text
timeSeriesId = Text
pTimeSeriesId_,
$sel:dimensionList:TimeSeries' :: [DimensionNameValue]
dimensionList = [DimensionNameValue]
forall a. Monoid a => a
Prelude.mempty,
$sel:metricValueList:TimeSeries' :: [Double]
metricValueList = [Double]
forall a. Monoid a => a
Prelude.mempty
}
timeSeries_timeSeriesId :: Lens.Lens' TimeSeries Prelude.Text
timeSeries_timeSeriesId :: (Text -> f Text) -> TimeSeries -> f TimeSeries
timeSeries_timeSeriesId = (TimeSeries -> Text)
-> (TimeSeries -> Text -> TimeSeries)
-> Lens TimeSeries TimeSeries Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeSeries' {Text
timeSeriesId :: Text
$sel:timeSeriesId:TimeSeries' :: TimeSeries -> Text
timeSeriesId} -> Text
timeSeriesId) (\s :: TimeSeries
s@TimeSeries' {} Text
a -> TimeSeries
s {$sel:timeSeriesId:TimeSeries' :: Text
timeSeriesId = Text
a} :: TimeSeries)
timeSeries_dimensionList :: Lens.Lens' TimeSeries [DimensionNameValue]
timeSeries_dimensionList :: ([DimensionNameValue] -> f [DimensionNameValue])
-> TimeSeries -> f TimeSeries
timeSeries_dimensionList = (TimeSeries -> [DimensionNameValue])
-> (TimeSeries -> [DimensionNameValue] -> TimeSeries)
-> Lens
TimeSeries TimeSeries [DimensionNameValue] [DimensionNameValue]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeSeries' {[DimensionNameValue]
dimensionList :: [DimensionNameValue]
$sel:dimensionList:TimeSeries' :: TimeSeries -> [DimensionNameValue]
dimensionList} -> [DimensionNameValue]
dimensionList) (\s :: TimeSeries
s@TimeSeries' {} [DimensionNameValue]
a -> TimeSeries
s {$sel:dimensionList:TimeSeries' :: [DimensionNameValue]
dimensionList = [DimensionNameValue]
a} :: TimeSeries) (([DimensionNameValue] -> f [DimensionNameValue])
-> TimeSeries -> f TimeSeries)
-> (([DimensionNameValue] -> f [DimensionNameValue])
-> [DimensionNameValue] -> f [DimensionNameValue])
-> ([DimensionNameValue] -> f [DimensionNameValue])
-> TimeSeries
-> f TimeSeries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DimensionNameValue] -> f [DimensionNameValue])
-> [DimensionNameValue] -> f [DimensionNameValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
timeSeries_metricValueList :: Lens.Lens' TimeSeries [Prelude.Double]
timeSeries_metricValueList :: ([Double] -> f [Double]) -> TimeSeries -> f TimeSeries
timeSeries_metricValueList = (TimeSeries -> [Double])
-> (TimeSeries -> [Double] -> TimeSeries)
-> Lens TimeSeries TimeSeries [Double] [Double]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeSeries' {[Double]
metricValueList :: [Double]
$sel:metricValueList:TimeSeries' :: TimeSeries -> [Double]
metricValueList} -> [Double]
metricValueList) (\s :: TimeSeries
s@TimeSeries' {} [Double]
a -> TimeSeries
s {$sel:metricValueList:TimeSeries' :: [Double]
metricValueList = [Double]
a} :: TimeSeries) (([Double] -> f [Double]) -> TimeSeries -> f TimeSeries)
-> (([Double] -> f [Double]) -> [Double] -> f [Double])
-> ([Double] -> f [Double])
-> TimeSeries
-> f TimeSeries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Double] -> f [Double]) -> [Double] -> f [Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON TimeSeries where
parseJSON :: Value -> Parser TimeSeries
parseJSON =
String
-> (Object -> Parser TimeSeries) -> Value -> Parser TimeSeries
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TimeSeries"
( \Object
x ->
Text -> [DimensionNameValue] -> [Double] -> TimeSeries
TimeSeries'
(Text -> [DimensionNameValue] -> [Double] -> TimeSeries)
-> Parser Text
-> Parser ([DimensionNameValue] -> [Double] -> TimeSeries)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TimeSeriesId")
Parser ([DimensionNameValue] -> [Double] -> TimeSeries)
-> Parser [DimensionNameValue] -> Parser ([Double] -> TimeSeries)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [DimensionNameValue])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DimensionList" Parser (Maybe [DimensionNameValue])
-> [DimensionNameValue] -> Parser [DimensionNameValue]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [DimensionNameValue]
forall a. Monoid a => a
Prelude.mempty)
Parser ([Double] -> TimeSeries)
-> Parser [Double] -> Parser TimeSeries
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
"MetricValueList"
Parser (Maybe [Double]) -> [Double] -> Parser [Double]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Double]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable TimeSeries
instance Prelude.NFData TimeSeries