{-# 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.TotalAggregationComputation 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.MeasureField
data TotalAggregationComputation = TotalAggregationComputation'
{
TotalAggregationComputation -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
TotalAggregationComputation -> Text
computationId :: Prelude.Text,
TotalAggregationComputation -> MeasureField
value :: MeasureField
}
deriving (TotalAggregationComputation -> TotalAggregationComputation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TotalAggregationComputation -> TotalAggregationComputation -> Bool
$c/= :: TotalAggregationComputation -> TotalAggregationComputation -> Bool
== :: TotalAggregationComputation -> TotalAggregationComputation -> Bool
$c== :: TotalAggregationComputation -> TotalAggregationComputation -> Bool
Prelude.Eq, Int -> TotalAggregationComputation -> ShowS
[TotalAggregationComputation] -> ShowS
TotalAggregationComputation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TotalAggregationComputation] -> ShowS
$cshowList :: [TotalAggregationComputation] -> ShowS
show :: TotalAggregationComputation -> String
$cshow :: TotalAggregationComputation -> String
showsPrec :: Int -> TotalAggregationComputation -> ShowS
$cshowsPrec :: Int -> TotalAggregationComputation -> ShowS
Prelude.Show, forall x.
Rep TotalAggregationComputation x -> TotalAggregationComputation
forall x.
TotalAggregationComputation -> Rep TotalAggregationComputation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TotalAggregationComputation x -> TotalAggregationComputation
$cfrom :: forall x.
TotalAggregationComputation -> Rep TotalAggregationComputation x
Prelude.Generic)
newTotalAggregationComputation ::
Prelude.Text ->
MeasureField ->
TotalAggregationComputation
newTotalAggregationComputation :: Text -> MeasureField -> TotalAggregationComputation
newTotalAggregationComputation
Text
pComputationId_
MeasureField
pValue_ =
TotalAggregationComputation'
{ $sel:name:TotalAggregationComputation' :: Maybe Text
name =
forall a. Maybe a
Prelude.Nothing,
$sel:computationId:TotalAggregationComputation' :: Text
computationId = Text
pComputationId_,
$sel:value:TotalAggregationComputation' :: MeasureField
value = MeasureField
pValue_
}
totalAggregationComputation_name :: Lens.Lens' TotalAggregationComputation (Prelude.Maybe Prelude.Text)
totalAggregationComputation_name :: Lens' TotalAggregationComputation (Maybe Text)
totalAggregationComputation_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalAggregationComputation' {Maybe Text
name :: Maybe Text
$sel:name:TotalAggregationComputation' :: TotalAggregationComputation -> Maybe Text
name} -> Maybe Text
name) (\s :: TotalAggregationComputation
s@TotalAggregationComputation' {} Maybe Text
a -> TotalAggregationComputation
s {$sel:name:TotalAggregationComputation' :: Maybe Text
name = Maybe Text
a} :: TotalAggregationComputation)
totalAggregationComputation_computationId :: Lens.Lens' TotalAggregationComputation Prelude.Text
totalAggregationComputation_computationId :: Lens' TotalAggregationComputation Text
totalAggregationComputation_computationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalAggregationComputation' {Text
computationId :: Text
$sel:computationId:TotalAggregationComputation' :: TotalAggregationComputation -> Text
computationId} -> Text
computationId) (\s :: TotalAggregationComputation
s@TotalAggregationComputation' {} Text
a -> TotalAggregationComputation
s {$sel:computationId:TotalAggregationComputation' :: Text
computationId = Text
a} :: TotalAggregationComputation)
totalAggregationComputation_value :: Lens.Lens' TotalAggregationComputation MeasureField
totalAggregationComputation_value :: Lens' TotalAggregationComputation MeasureField
totalAggregationComputation_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TotalAggregationComputation' {MeasureField
value :: MeasureField
$sel:value:TotalAggregationComputation' :: TotalAggregationComputation -> MeasureField
value} -> MeasureField
value) (\s :: TotalAggregationComputation
s@TotalAggregationComputation' {} MeasureField
a -> TotalAggregationComputation
s {$sel:value:TotalAggregationComputation' :: MeasureField
value = MeasureField
a} :: TotalAggregationComputation)
instance Data.FromJSON TotalAggregationComputation where
parseJSON :: Value -> Parser TotalAggregationComputation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TotalAggregationComputation"
( \Object
x ->
Maybe Text -> Text -> MeasureField -> TotalAggregationComputation
TotalAggregationComputation'
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 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
"Value")
)
instance Prelude.Hashable TotalAggregationComputation where
hashWithSalt :: Int -> TotalAggregationComputation -> Int
hashWithSalt Int
_salt TotalAggregationComputation' {Maybe Text
Text
MeasureField
value :: MeasureField
computationId :: Text
name :: Maybe Text
$sel:value:TotalAggregationComputation' :: TotalAggregationComputation -> MeasureField
$sel:computationId:TotalAggregationComputation' :: TotalAggregationComputation -> Text
$sel:name:TotalAggregationComputation' :: TotalAggregationComputation -> 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` Text
computationId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MeasureField
value
instance Prelude.NFData TotalAggregationComputation where
rnf :: TotalAggregationComputation -> ()
rnf TotalAggregationComputation' {Maybe Text
Text
MeasureField
value :: MeasureField
computationId :: Text
name :: Maybe Text
$sel:value:TotalAggregationComputation' :: TotalAggregationComputation -> MeasureField
$sel:computationId:TotalAggregationComputation' :: TotalAggregationComputation -> Text
$sel:name:TotalAggregationComputation' :: TotalAggregationComputation -> 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 Text
computationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MeasureField
value
instance Data.ToJSON TotalAggregationComputation where
toJSON :: TotalAggregationComputation -> Value
toJSON TotalAggregationComputation' {Maybe Text
Text
MeasureField
value :: MeasureField
computationId :: Text
name :: Maybe Text
$sel:value:TotalAggregationComputation' :: TotalAggregationComputation -> MeasureField
$sel:computationId:TotalAggregationComputation' :: TotalAggregationComputation -> Text
$sel:name:TotalAggregationComputation' :: TotalAggregationComputation -> 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,
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
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MeasureField
value)
]
)