{-# 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.QuickSight.Types.GrowthRateComputation where
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
import Amazonka.QuickSight.Types.DimensionField
import Amazonka.QuickSight.Types.MeasureField
data GrowthRateComputation = GrowthRateComputation'
{
GrowthRateComputation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
GrowthRateComputation -> Maybe Natural
periodSize :: Prelude.Maybe Prelude.Natural,
GrowthRateComputation -> Maybe MeasureField
value :: Prelude.Maybe MeasureField,
GrowthRateComputation -> Text
computationId :: Prelude.Text,
GrowthRateComputation -> DimensionField
time :: DimensionField
}
deriving (GrowthRateComputation -> GrowthRateComputation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrowthRateComputation -> GrowthRateComputation -> Bool
$c/= :: GrowthRateComputation -> GrowthRateComputation -> Bool
== :: GrowthRateComputation -> GrowthRateComputation -> Bool
$c== :: GrowthRateComputation -> GrowthRateComputation -> Bool
Prelude.Eq, Int -> GrowthRateComputation -> ShowS
[GrowthRateComputation] -> ShowS
GrowthRateComputation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrowthRateComputation] -> ShowS
$cshowList :: [GrowthRateComputation] -> ShowS
show :: GrowthRateComputation -> String
$cshow :: GrowthRateComputation -> String
showsPrec :: Int -> GrowthRateComputation -> ShowS
$cshowsPrec :: Int -> GrowthRateComputation -> ShowS
Prelude.Show, forall x. Rep GrowthRateComputation x -> GrowthRateComputation
forall x. GrowthRateComputation -> Rep GrowthRateComputation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrowthRateComputation x -> GrowthRateComputation
$cfrom :: forall x. GrowthRateComputation -> Rep GrowthRateComputation x
Prelude.Generic)
newGrowthRateComputation ::
Prelude.Text ->
DimensionField ->
GrowthRateComputation
newGrowthRateComputation :: Text -> DimensionField -> GrowthRateComputation
newGrowthRateComputation Text
pComputationId_ DimensionField
pTime_ =
GrowthRateComputation'
{ $sel:name:GrowthRateComputation' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:periodSize:GrowthRateComputation' :: Maybe Natural
periodSize = forall a. Maybe a
Prelude.Nothing,
$sel:value:GrowthRateComputation' :: Maybe MeasureField
value = forall a. Maybe a
Prelude.Nothing,
$sel:computationId:GrowthRateComputation' :: Text
computationId = Text
pComputationId_,
$sel:time:GrowthRateComputation' :: DimensionField
time = DimensionField
pTime_
}
growthRateComputation_name :: Lens.Lens' GrowthRateComputation (Prelude.Maybe Prelude.Text)
growthRateComputation_name :: Lens' GrowthRateComputation (Maybe Text)
growthRateComputation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrowthRateComputation' {Maybe Text
name :: Maybe Text
$sel:name:GrowthRateComputation' :: GrowthRateComputation -> Maybe Text
name} -> Maybe Text
name) (\s :: GrowthRateComputation
s@GrowthRateComputation' {} Maybe Text
a -> GrowthRateComputation
s {$sel:name:GrowthRateComputation' :: Maybe Text
name = Maybe Text
a} :: GrowthRateComputation)
growthRateComputation_periodSize :: Lens.Lens' GrowthRateComputation (Prelude.Maybe Prelude.Natural)
growthRateComputation_periodSize :: Lens' GrowthRateComputation (Maybe Natural)
growthRateComputation_periodSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrowthRateComputation' {Maybe Natural
periodSize :: Maybe Natural
$sel:periodSize:GrowthRateComputation' :: GrowthRateComputation -> Maybe Natural
periodSize} -> Maybe Natural
periodSize) (\s :: GrowthRateComputation
s@GrowthRateComputation' {} Maybe Natural
a -> GrowthRateComputation
s {$sel:periodSize:GrowthRateComputation' :: Maybe Natural
periodSize = Maybe Natural
a} :: GrowthRateComputation)
growthRateComputation_value :: Lens.Lens' GrowthRateComputation (Prelude.Maybe MeasureField)
growthRateComputation_value :: Lens' GrowthRateComputation (Maybe MeasureField)
growthRateComputation_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrowthRateComputation' {Maybe MeasureField
value :: Maybe MeasureField
$sel:value:GrowthRateComputation' :: GrowthRateComputation -> Maybe MeasureField
value} -> Maybe MeasureField
value) (\s :: GrowthRateComputation
s@GrowthRateComputation' {} Maybe MeasureField
a -> GrowthRateComputation
s {$sel:value:GrowthRateComputation' :: Maybe MeasureField
value = Maybe MeasureField
a} :: GrowthRateComputation)
growthRateComputation_computationId :: Lens.Lens' GrowthRateComputation Prelude.Text
growthRateComputation_computationId :: Lens' GrowthRateComputation Text
growthRateComputation_computationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrowthRateComputation' {Text
computationId :: Text
$sel:computationId:GrowthRateComputation' :: GrowthRateComputation -> Text
computationId} -> Text
computationId) (\s :: GrowthRateComputation
s@GrowthRateComputation' {} Text
a -> GrowthRateComputation
s {$sel:computationId:GrowthRateComputation' :: Text
computationId = Text
a} :: GrowthRateComputation)
growthRateComputation_time :: Lens.Lens' GrowthRateComputation DimensionField
growthRateComputation_time :: Lens' GrowthRateComputation DimensionField
growthRateComputation_time = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrowthRateComputation' {DimensionField
time :: DimensionField
$sel:time:GrowthRateComputation' :: GrowthRateComputation -> DimensionField
time} -> DimensionField
time) (\s :: GrowthRateComputation
s@GrowthRateComputation' {} DimensionField
a -> GrowthRateComputation
s {$sel:time:GrowthRateComputation' :: DimensionField
time = DimensionField
a} :: GrowthRateComputation)
instance Data.FromJSON GrowthRateComputation where
parseJSON :: Value -> Parser GrowthRateComputation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GrowthRateComputation"
( \Object
x ->
Maybe Text
-> Maybe Natural
-> Maybe MeasureField
-> Text
-> DimensionField
-> GrowthRateComputation
GrowthRateComputation'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
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
"PeriodSize")
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
"Value")
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
"ComputationId")
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
"Time")
)
instance Prelude.Hashable GrowthRateComputation where
hashWithSalt :: Int -> GrowthRateComputation -> Int
hashWithSalt Int
_salt GrowthRateComputation' {Maybe Natural
Maybe Text
Maybe MeasureField
Text
DimensionField
time :: DimensionField
computationId :: Text
value :: Maybe MeasureField
periodSize :: Maybe Natural
name :: Maybe Text
$sel:time:GrowthRateComputation' :: GrowthRateComputation -> DimensionField
$sel:computationId:GrowthRateComputation' :: GrowthRateComputation -> Text
$sel:value:GrowthRateComputation' :: GrowthRateComputation -> Maybe MeasureField
$sel:periodSize:GrowthRateComputation' :: GrowthRateComputation -> Maybe Natural
$sel:name:GrowthRateComputation' :: GrowthRateComputation -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
periodSize
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MeasureField
value
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
computationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DimensionField
time
instance Prelude.NFData GrowthRateComputation where
rnf :: GrowthRateComputation -> ()
rnf GrowthRateComputation' {Maybe Natural
Maybe Text
Maybe MeasureField
Text
DimensionField
time :: DimensionField
computationId :: Text
value :: Maybe MeasureField
periodSize :: Maybe Natural
name :: Maybe Text
$sel:time:GrowthRateComputation' :: GrowthRateComputation -> DimensionField
$sel:computationId:GrowthRateComputation' :: GrowthRateComputation -> Text
$sel:value:GrowthRateComputation' :: GrowthRateComputation -> Maybe MeasureField
$sel:periodSize:GrowthRateComputation' :: GrowthRateComputation -> Maybe Natural
$sel:name:GrowthRateComputation' :: GrowthRateComputation -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
periodSize
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MeasureField
value
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
computationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DimensionField
time
instance Data.ToJSON GrowthRateComputation where
toJSON :: GrowthRateComputation -> Value
toJSON GrowthRateComputation' {Maybe Natural
Maybe Text
Maybe MeasureField
Text
DimensionField
time :: DimensionField
computationId :: Text
value :: Maybe MeasureField
periodSize :: Maybe Natural
name :: Maybe Text
$sel:time:GrowthRateComputation' :: GrowthRateComputation -> DimensionField
$sel:computationId:GrowthRateComputation' :: GrowthRateComputation -> Text
$sel:value:GrowthRateComputation' :: GrowthRateComputation -> Maybe MeasureField
$sel:periodSize:GrowthRateComputation' :: GrowthRateComputation -> Maybe Natural
$sel:name:GrowthRateComputation' :: GrowthRateComputation -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Key
"PeriodSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
periodSize,
(Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MeasureField
value,
forall a. a -> Maybe a
Prelude.Just (Key
"ComputationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
computationId),
forall a. a -> Maybe a
Prelude.Just (Key
"Time" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DimensionField
time)
]
)