{-# 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.AggregationFunction 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.CategoricalAggregationFunction
import Amazonka.QuickSight.Types.DateAggregationFunction
import Amazonka.QuickSight.Types.NumericalAggregationFunction
data AggregationFunction = AggregationFunction'
{
AggregationFunction -> Maybe CategoricalAggregationFunction
categoricalAggregationFunction :: Prelude.Maybe CategoricalAggregationFunction,
AggregationFunction -> Maybe DateAggregationFunction
dateAggregationFunction :: Prelude.Maybe DateAggregationFunction,
AggregationFunction -> Maybe NumericalAggregationFunction
numericalAggregationFunction :: Prelude.Maybe NumericalAggregationFunction
}
deriving (AggregationFunction -> AggregationFunction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregationFunction -> AggregationFunction -> Bool
$c/= :: AggregationFunction -> AggregationFunction -> Bool
== :: AggregationFunction -> AggregationFunction -> Bool
$c== :: AggregationFunction -> AggregationFunction -> Bool
Prelude.Eq, ReadPrec [AggregationFunction]
ReadPrec AggregationFunction
Int -> ReadS AggregationFunction
ReadS [AggregationFunction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregationFunction]
$creadListPrec :: ReadPrec [AggregationFunction]
readPrec :: ReadPrec AggregationFunction
$creadPrec :: ReadPrec AggregationFunction
readList :: ReadS [AggregationFunction]
$creadList :: ReadS [AggregationFunction]
readsPrec :: Int -> ReadS AggregationFunction
$creadsPrec :: Int -> ReadS AggregationFunction
Prelude.Read, Int -> AggregationFunction -> ShowS
[AggregationFunction] -> ShowS
AggregationFunction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregationFunction] -> ShowS
$cshowList :: [AggregationFunction] -> ShowS
show :: AggregationFunction -> String
$cshow :: AggregationFunction -> String
showsPrec :: Int -> AggregationFunction -> ShowS
$cshowsPrec :: Int -> AggregationFunction -> ShowS
Prelude.Show, forall x. Rep AggregationFunction x -> AggregationFunction
forall x. AggregationFunction -> Rep AggregationFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggregationFunction x -> AggregationFunction
$cfrom :: forall x. AggregationFunction -> Rep AggregationFunction x
Prelude.Generic)
newAggregationFunction ::
AggregationFunction
newAggregationFunction :: AggregationFunction
newAggregationFunction =
AggregationFunction'
{ $sel:categoricalAggregationFunction:AggregationFunction' :: Maybe CategoricalAggregationFunction
categoricalAggregationFunction =
forall a. Maybe a
Prelude.Nothing,
$sel:dateAggregationFunction:AggregationFunction' :: Maybe DateAggregationFunction
dateAggregationFunction = forall a. Maybe a
Prelude.Nothing,
$sel:numericalAggregationFunction:AggregationFunction' :: Maybe NumericalAggregationFunction
numericalAggregationFunction = forall a. Maybe a
Prelude.Nothing
}
aggregationFunction_categoricalAggregationFunction :: Lens.Lens' AggregationFunction (Prelude.Maybe CategoricalAggregationFunction)
aggregationFunction_categoricalAggregationFunction :: Lens' AggregationFunction (Maybe CategoricalAggregationFunction)
aggregationFunction_categoricalAggregationFunction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregationFunction' {Maybe CategoricalAggregationFunction
categoricalAggregationFunction :: Maybe CategoricalAggregationFunction
$sel:categoricalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe CategoricalAggregationFunction
categoricalAggregationFunction} -> Maybe CategoricalAggregationFunction
categoricalAggregationFunction) (\s :: AggregationFunction
s@AggregationFunction' {} Maybe CategoricalAggregationFunction
a -> AggregationFunction
s {$sel:categoricalAggregationFunction:AggregationFunction' :: Maybe CategoricalAggregationFunction
categoricalAggregationFunction = Maybe CategoricalAggregationFunction
a} :: AggregationFunction)
aggregationFunction_dateAggregationFunction :: Lens.Lens' AggregationFunction (Prelude.Maybe DateAggregationFunction)
aggregationFunction_dateAggregationFunction :: Lens' AggregationFunction (Maybe DateAggregationFunction)
aggregationFunction_dateAggregationFunction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregationFunction' {Maybe DateAggregationFunction
dateAggregationFunction :: Maybe DateAggregationFunction
$sel:dateAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe DateAggregationFunction
dateAggregationFunction} -> Maybe DateAggregationFunction
dateAggregationFunction) (\s :: AggregationFunction
s@AggregationFunction' {} Maybe DateAggregationFunction
a -> AggregationFunction
s {$sel:dateAggregationFunction:AggregationFunction' :: Maybe DateAggregationFunction
dateAggregationFunction = Maybe DateAggregationFunction
a} :: AggregationFunction)
aggregationFunction_numericalAggregationFunction :: Lens.Lens' AggregationFunction (Prelude.Maybe NumericalAggregationFunction)
aggregationFunction_numericalAggregationFunction :: Lens' AggregationFunction (Maybe NumericalAggregationFunction)
aggregationFunction_numericalAggregationFunction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregationFunction' {Maybe NumericalAggregationFunction
numericalAggregationFunction :: Maybe NumericalAggregationFunction
$sel:numericalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe NumericalAggregationFunction
numericalAggregationFunction} -> Maybe NumericalAggregationFunction
numericalAggregationFunction) (\s :: AggregationFunction
s@AggregationFunction' {} Maybe NumericalAggregationFunction
a -> AggregationFunction
s {$sel:numericalAggregationFunction:AggregationFunction' :: Maybe NumericalAggregationFunction
numericalAggregationFunction = Maybe NumericalAggregationFunction
a} :: AggregationFunction)
instance Data.FromJSON AggregationFunction where
parseJSON :: Value -> Parser AggregationFunction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AggregationFunction"
( \Object
x ->
Maybe CategoricalAggregationFunction
-> Maybe DateAggregationFunction
-> Maybe NumericalAggregationFunction
-> AggregationFunction
AggregationFunction'
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
"CategoricalAggregationFunction")
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
"DateAggregationFunction")
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
"NumericalAggregationFunction")
)
instance Prelude.Hashable AggregationFunction where
hashWithSalt :: Int -> AggregationFunction -> Int
hashWithSalt Int
_salt AggregationFunction' {Maybe CategoricalAggregationFunction
Maybe DateAggregationFunction
Maybe NumericalAggregationFunction
numericalAggregationFunction :: Maybe NumericalAggregationFunction
dateAggregationFunction :: Maybe DateAggregationFunction
categoricalAggregationFunction :: Maybe CategoricalAggregationFunction
$sel:numericalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe NumericalAggregationFunction
$sel:dateAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe DateAggregationFunction
$sel:categoricalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe CategoricalAggregationFunction
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CategoricalAggregationFunction
categoricalAggregationFunction
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DateAggregationFunction
dateAggregationFunction
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NumericalAggregationFunction
numericalAggregationFunction
instance Prelude.NFData AggregationFunction where
rnf :: AggregationFunction -> ()
rnf AggregationFunction' {Maybe CategoricalAggregationFunction
Maybe DateAggregationFunction
Maybe NumericalAggregationFunction
numericalAggregationFunction :: Maybe NumericalAggregationFunction
dateAggregationFunction :: Maybe DateAggregationFunction
categoricalAggregationFunction :: Maybe CategoricalAggregationFunction
$sel:numericalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe NumericalAggregationFunction
$sel:dateAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe DateAggregationFunction
$sel:categoricalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe CategoricalAggregationFunction
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CategoricalAggregationFunction
categoricalAggregationFunction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DateAggregationFunction
dateAggregationFunction
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NumericalAggregationFunction
numericalAggregationFunction
instance Data.ToJSON AggregationFunction where
toJSON :: AggregationFunction -> Value
toJSON AggregationFunction' {Maybe CategoricalAggregationFunction
Maybe DateAggregationFunction
Maybe NumericalAggregationFunction
numericalAggregationFunction :: Maybe NumericalAggregationFunction
dateAggregationFunction :: Maybe DateAggregationFunction
categoricalAggregationFunction :: Maybe CategoricalAggregationFunction
$sel:numericalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe NumericalAggregationFunction
$sel:dateAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe DateAggregationFunction
$sel:categoricalAggregationFunction:AggregationFunction' :: AggregationFunction -> Maybe CategoricalAggregationFunction
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CategoricalAggregationFunction" 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 CategoricalAggregationFunction
categoricalAggregationFunction,
(Key
"DateAggregationFunction" 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 DateAggregationFunction
dateAggregationFunction,
(Key
"NumericalAggregationFunction" 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 NumericalAggregationFunction
numericalAggregationFunction
]
)