{-# 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.LogicalTable 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.LogicalTableSource
import Amazonka.QuickSight.Types.TransformOperation
data LogicalTable = LogicalTable'
{
LogicalTable -> Maybe (NonEmpty TransformOperation)
dataTransforms :: Prelude.Maybe (Prelude.NonEmpty TransformOperation),
LogicalTable -> Text
alias :: Prelude.Text,
LogicalTable -> LogicalTableSource
source :: LogicalTableSource
}
deriving (LogicalTable -> LogicalTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogicalTable -> LogicalTable -> Bool
$c/= :: LogicalTable -> LogicalTable -> Bool
== :: LogicalTable -> LogicalTable -> Bool
$c== :: LogicalTable -> LogicalTable -> Bool
Prelude.Eq, Int -> LogicalTable -> ShowS
[LogicalTable] -> ShowS
LogicalTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogicalTable] -> ShowS
$cshowList :: [LogicalTable] -> ShowS
show :: LogicalTable -> String
$cshow :: LogicalTable -> String
showsPrec :: Int -> LogicalTable -> ShowS
$cshowsPrec :: Int -> LogicalTable -> ShowS
Prelude.Show, forall x. Rep LogicalTable x -> LogicalTable
forall x. LogicalTable -> Rep LogicalTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogicalTable x -> LogicalTable
$cfrom :: forall x. LogicalTable -> Rep LogicalTable x
Prelude.Generic)
newLogicalTable ::
Prelude.Text ->
LogicalTableSource ->
LogicalTable
newLogicalTable :: Text -> LogicalTableSource -> LogicalTable
newLogicalTable Text
pAlias_ LogicalTableSource
pSource_ =
LogicalTable'
{ $sel:dataTransforms:LogicalTable' :: Maybe (NonEmpty TransformOperation)
dataTransforms = forall a. Maybe a
Prelude.Nothing,
$sel:alias:LogicalTable' :: Text
alias = Text
pAlias_,
$sel:source:LogicalTable' :: LogicalTableSource
source = LogicalTableSource
pSource_
}
logicalTable_dataTransforms :: Lens.Lens' LogicalTable (Prelude.Maybe (Prelude.NonEmpty TransformOperation))
logicalTable_dataTransforms :: Lens' LogicalTable (Maybe (NonEmpty TransformOperation))
logicalTable_dataTransforms = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalTable' {Maybe (NonEmpty TransformOperation)
dataTransforms :: Maybe (NonEmpty TransformOperation)
$sel:dataTransforms:LogicalTable' :: LogicalTable -> Maybe (NonEmpty TransformOperation)
dataTransforms} -> Maybe (NonEmpty TransformOperation)
dataTransforms) (\s :: LogicalTable
s@LogicalTable' {} Maybe (NonEmpty TransformOperation)
a -> LogicalTable
s {$sel:dataTransforms:LogicalTable' :: Maybe (NonEmpty TransformOperation)
dataTransforms = Maybe (NonEmpty TransformOperation)
a} :: LogicalTable) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
logicalTable_alias :: Lens.Lens' LogicalTable Prelude.Text
logicalTable_alias :: Lens' LogicalTable Text
logicalTable_alias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalTable' {Text
alias :: Text
$sel:alias:LogicalTable' :: LogicalTable -> Text
alias} -> Text
alias) (\s :: LogicalTable
s@LogicalTable' {} Text
a -> LogicalTable
s {$sel:alias:LogicalTable' :: Text
alias = Text
a} :: LogicalTable)
logicalTable_source :: Lens.Lens' LogicalTable LogicalTableSource
logicalTable_source :: Lens' LogicalTable LogicalTableSource
logicalTable_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalTable' {LogicalTableSource
source :: LogicalTableSource
$sel:source:LogicalTable' :: LogicalTable -> LogicalTableSource
source} -> LogicalTableSource
source) (\s :: LogicalTable
s@LogicalTable' {} LogicalTableSource
a -> LogicalTable
s {$sel:source:LogicalTable' :: LogicalTableSource
source = LogicalTableSource
a} :: LogicalTable)
instance Data.FromJSON LogicalTable where
parseJSON :: Value -> Parser LogicalTable
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LogicalTable"
( \Object
x ->
Maybe (NonEmpty TransformOperation)
-> Text -> LogicalTableSource -> LogicalTable
LogicalTable'
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
"DataTransforms")
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
"Alias")
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
"Source")
)
instance Prelude.Hashable LogicalTable where
hashWithSalt :: Int -> LogicalTable -> Int
hashWithSalt Int
_salt LogicalTable' {Maybe (NonEmpty TransformOperation)
Text
LogicalTableSource
source :: LogicalTableSource
alias :: Text
dataTransforms :: Maybe (NonEmpty TransformOperation)
$sel:source:LogicalTable' :: LogicalTable -> LogicalTableSource
$sel:alias:LogicalTable' :: LogicalTable -> Text
$sel:dataTransforms:LogicalTable' :: LogicalTable -> Maybe (NonEmpty TransformOperation)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty TransformOperation)
dataTransforms
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alias
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LogicalTableSource
source
instance Prelude.NFData LogicalTable where
rnf :: LogicalTable -> ()
rnf LogicalTable' {Maybe (NonEmpty TransformOperation)
Text
LogicalTableSource
source :: LogicalTableSource
alias :: Text
dataTransforms :: Maybe (NonEmpty TransformOperation)
$sel:source:LogicalTable' :: LogicalTable -> LogicalTableSource
$sel:alias:LogicalTable' :: LogicalTable -> Text
$sel:dataTransforms:LogicalTable' :: LogicalTable -> Maybe (NonEmpty TransformOperation)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty TransformOperation)
dataTransforms
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
alias
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LogicalTableSource
source
instance Data.ToJSON LogicalTable where
toJSON :: LogicalTable -> Value
toJSON LogicalTable' {Maybe (NonEmpty TransformOperation)
Text
LogicalTableSource
source :: LogicalTableSource
alias :: Text
dataTransforms :: Maybe (NonEmpty TransformOperation)
$sel:source:LogicalTable' :: LogicalTable -> LogicalTableSource
$sel:alias:LogicalTable' :: LogicalTable -> Text
$sel:dataTransforms:LogicalTable' :: LogicalTable -> Maybe (NonEmpty TransformOperation)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DataTransforms" 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 (NonEmpty TransformOperation)
dataTransforms,
forall a. a -> Maybe a
Prelude.Just (Key
"Alias" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alias),
forall a. a -> Maybe a
Prelude.Just (Key
"Source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LogicalTableSource
source)
]
)