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