{-# 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.ComputeOptimizer.Types.ProjectedMetric where
import Amazonka.ComputeOptimizer.Types.MetricName
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ProjectedMetric = ProjectedMetric'
{
ProjectedMetric -> Maybe [Double]
values :: Prelude.Maybe [Prelude.Double],
ProjectedMetric -> Maybe MetricName
name :: Prelude.Maybe MetricName,
ProjectedMetric -> Maybe [POSIX]
timestamps :: Prelude.Maybe [Core.POSIX]
}
deriving (ProjectedMetric -> ProjectedMetric -> Bool
(ProjectedMetric -> ProjectedMetric -> Bool)
-> (ProjectedMetric -> ProjectedMetric -> Bool)
-> Eq ProjectedMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectedMetric -> ProjectedMetric -> Bool
$c/= :: ProjectedMetric -> ProjectedMetric -> Bool
== :: ProjectedMetric -> ProjectedMetric -> Bool
$c== :: ProjectedMetric -> ProjectedMetric -> Bool
Prelude.Eq, ReadPrec [ProjectedMetric]
ReadPrec ProjectedMetric
Int -> ReadS ProjectedMetric
ReadS [ProjectedMetric]
(Int -> ReadS ProjectedMetric)
-> ReadS [ProjectedMetric]
-> ReadPrec ProjectedMetric
-> ReadPrec [ProjectedMetric]
-> Read ProjectedMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectedMetric]
$creadListPrec :: ReadPrec [ProjectedMetric]
readPrec :: ReadPrec ProjectedMetric
$creadPrec :: ReadPrec ProjectedMetric
readList :: ReadS [ProjectedMetric]
$creadList :: ReadS [ProjectedMetric]
readsPrec :: Int -> ReadS ProjectedMetric
$creadsPrec :: Int -> ReadS ProjectedMetric
Prelude.Read, Int -> ProjectedMetric -> ShowS
[ProjectedMetric] -> ShowS
ProjectedMetric -> String
(Int -> ProjectedMetric -> ShowS)
-> (ProjectedMetric -> String)
-> ([ProjectedMetric] -> ShowS)
-> Show ProjectedMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectedMetric] -> ShowS
$cshowList :: [ProjectedMetric] -> ShowS
show :: ProjectedMetric -> String
$cshow :: ProjectedMetric -> String
showsPrec :: Int -> ProjectedMetric -> ShowS
$cshowsPrec :: Int -> ProjectedMetric -> ShowS
Prelude.Show, (forall x. ProjectedMetric -> Rep ProjectedMetric x)
-> (forall x. Rep ProjectedMetric x -> ProjectedMetric)
-> Generic ProjectedMetric
forall x. Rep ProjectedMetric x -> ProjectedMetric
forall x. ProjectedMetric -> Rep ProjectedMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectedMetric x -> ProjectedMetric
$cfrom :: forall x. ProjectedMetric -> Rep ProjectedMetric x
Prelude.Generic)
newProjectedMetric ::
ProjectedMetric
newProjectedMetric :: ProjectedMetric
newProjectedMetric =
ProjectedMetric' :: Maybe [Double]
-> Maybe MetricName -> Maybe [POSIX] -> ProjectedMetric
ProjectedMetric'
{ $sel:values:ProjectedMetric' :: Maybe [Double]
values = Maybe [Double]
forall a. Maybe a
Prelude.Nothing,
$sel:name:ProjectedMetric' :: Maybe MetricName
name = Maybe MetricName
forall a. Maybe a
Prelude.Nothing,
$sel:timestamps:ProjectedMetric' :: Maybe [POSIX]
timestamps = Maybe [POSIX]
forall a. Maybe a
Prelude.Nothing
}
projectedMetric_values :: Lens.Lens' ProjectedMetric (Prelude.Maybe [Prelude.Double])
projectedMetric_values :: (Maybe [Double] -> f (Maybe [Double]))
-> ProjectedMetric -> f ProjectedMetric
projectedMetric_values = (ProjectedMetric -> Maybe [Double])
-> (ProjectedMetric -> Maybe [Double] -> ProjectedMetric)
-> Lens
ProjectedMetric ProjectedMetric (Maybe [Double]) (Maybe [Double])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectedMetric' {Maybe [Double]
values :: Maybe [Double]
$sel:values:ProjectedMetric' :: ProjectedMetric -> Maybe [Double]
values} -> Maybe [Double]
values) (\s :: ProjectedMetric
s@ProjectedMetric' {} Maybe [Double]
a -> ProjectedMetric
s {$sel:values:ProjectedMetric' :: Maybe [Double]
values = Maybe [Double]
a} :: ProjectedMetric) ((Maybe [Double] -> f (Maybe [Double]))
-> ProjectedMetric -> f ProjectedMetric)
-> ((Maybe [Double] -> f (Maybe [Double]))
-> Maybe [Double] -> f (Maybe [Double]))
-> (Maybe [Double] -> f (Maybe [Double]))
-> ProjectedMetric
-> f ProjectedMetric
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Double] [Double] [Double] [Double]
-> Iso
(Maybe [Double]) (Maybe [Double]) (Maybe [Double]) (Maybe [Double])
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 [Double] [Double] [Double] [Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
projectedMetric_name :: Lens.Lens' ProjectedMetric (Prelude.Maybe MetricName)
projectedMetric_name :: (Maybe MetricName -> f (Maybe MetricName))
-> ProjectedMetric -> f ProjectedMetric
projectedMetric_name = (ProjectedMetric -> Maybe MetricName)
-> (ProjectedMetric -> Maybe MetricName -> ProjectedMetric)
-> Lens
ProjectedMetric
ProjectedMetric
(Maybe MetricName)
(Maybe MetricName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectedMetric' {Maybe MetricName
name :: Maybe MetricName
$sel:name:ProjectedMetric' :: ProjectedMetric -> Maybe MetricName
name} -> Maybe MetricName
name) (\s :: ProjectedMetric
s@ProjectedMetric' {} Maybe MetricName
a -> ProjectedMetric
s {$sel:name:ProjectedMetric' :: Maybe MetricName
name = Maybe MetricName
a} :: ProjectedMetric)
projectedMetric_timestamps :: Lens.Lens' ProjectedMetric (Prelude.Maybe [Prelude.UTCTime])
projectedMetric_timestamps :: (Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> ProjectedMetric -> f ProjectedMetric
projectedMetric_timestamps = (ProjectedMetric -> Maybe [POSIX])
-> (ProjectedMetric -> Maybe [POSIX] -> ProjectedMetric)
-> Lens
ProjectedMetric ProjectedMetric (Maybe [POSIX]) (Maybe [POSIX])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectedMetric' {Maybe [POSIX]
timestamps :: Maybe [POSIX]
$sel:timestamps:ProjectedMetric' :: ProjectedMetric -> Maybe [POSIX]
timestamps} -> Maybe [POSIX]
timestamps) (\s :: ProjectedMetric
s@ProjectedMetric' {} Maybe [POSIX]
a -> ProjectedMetric
s {$sel:timestamps:ProjectedMetric' :: Maybe [POSIX]
timestamps = Maybe [POSIX]
a} :: ProjectedMetric) ((Maybe [POSIX] -> f (Maybe [POSIX]))
-> ProjectedMetric -> f ProjectedMetric)
-> ((Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> Maybe [POSIX] -> f (Maybe [POSIX]))
-> (Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> ProjectedMetric
-> f ProjectedMetric
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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ProjectedMetric where
parseJSON :: Value -> Parser ProjectedMetric
parseJSON =
String
-> (Object -> Parser ProjectedMetric)
-> Value
-> Parser ProjectedMetric
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProjectedMetric"
( \Object
x ->
Maybe [Double]
-> Maybe MetricName -> Maybe [POSIX] -> ProjectedMetric
ProjectedMetric'
(Maybe [Double]
-> Maybe MetricName -> Maybe [POSIX] -> ProjectedMetric)
-> Parser (Maybe [Double])
-> Parser (Maybe MetricName -> Maybe [POSIX] -> ProjectedMetric)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Double]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"values" Parser (Maybe (Maybe [Double]))
-> Maybe [Double] -> Parser (Maybe [Double])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Double]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe MetricName -> Maybe [POSIX] -> ProjectedMetric)
-> Parser (Maybe MetricName)
-> Parser (Maybe [POSIX] -> ProjectedMetric)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
Parser (Maybe [POSIX] -> ProjectedMetric)
-> Parser (Maybe [POSIX]) -> Parser ProjectedMetric
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [POSIX]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timestamps" Parser (Maybe (Maybe [POSIX]))
-> Maybe [POSIX] -> Parser (Maybe [POSIX])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [POSIX]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ProjectedMetric
instance Prelude.NFData ProjectedMetric