{-# 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.Lens as Lens
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
(LogicalTable -> LogicalTable -> Bool)
-> (LogicalTable -> LogicalTable -> Bool) -> Eq LogicalTable
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, ReadPrec [LogicalTable]
ReadPrec LogicalTable
Int -> ReadS LogicalTable
ReadS [LogicalTable]
(Int -> ReadS LogicalTable)
-> ReadS [LogicalTable]
-> ReadPrec LogicalTable
-> ReadPrec [LogicalTable]
-> Read LogicalTable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogicalTable]
$creadListPrec :: ReadPrec [LogicalTable]
readPrec :: ReadPrec LogicalTable
$creadPrec :: ReadPrec LogicalTable
readList :: ReadS [LogicalTable]
$creadList :: ReadS [LogicalTable]
readsPrec :: Int -> ReadS LogicalTable
$creadsPrec :: Int -> ReadS LogicalTable
Prelude.Read, Int -> LogicalTable -> ShowS
[LogicalTable] -> ShowS
LogicalTable -> String
(Int -> LogicalTable -> ShowS)
-> (LogicalTable -> String)
-> ([LogicalTable] -> ShowS)
-> Show LogicalTable
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. LogicalTable -> Rep LogicalTable x)
-> (forall x. Rep LogicalTable x -> LogicalTable)
-> Generic LogicalTable
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' :: Maybe (NonEmpty TransformOperation)
-> Text -> LogicalTableSource -> LogicalTable
LogicalTable'
{ $sel:dataTransforms:LogicalTable' :: Maybe (NonEmpty TransformOperation)
dataTransforms = Maybe (NonEmpty TransformOperation)
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 :: (Maybe (NonEmpty TransformOperation)
-> f (Maybe (NonEmpty TransformOperation)))
-> LogicalTable -> f LogicalTable
logicalTable_dataTransforms = (LogicalTable -> Maybe (NonEmpty TransformOperation))
-> (LogicalTable
-> Maybe (NonEmpty TransformOperation) -> LogicalTable)
-> Lens
LogicalTable
LogicalTable
(Maybe (NonEmpty TransformOperation))
(Maybe (NonEmpty TransformOperation))
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) ((Maybe (NonEmpty TransformOperation)
-> f (Maybe (NonEmpty TransformOperation)))
-> LogicalTable -> f LogicalTable)
-> ((Maybe (NonEmpty TransformOperation)
-> f (Maybe (NonEmpty TransformOperation)))
-> Maybe (NonEmpty TransformOperation)
-> f (Maybe (NonEmpty TransformOperation)))
-> (Maybe (NonEmpty TransformOperation)
-> f (Maybe (NonEmpty TransformOperation)))
-> LogicalTable
-> f LogicalTable
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty TransformOperation)
(NonEmpty TransformOperation)
(NonEmpty TransformOperation)
(NonEmpty TransformOperation)
-> Iso
(Maybe (NonEmpty TransformOperation))
(Maybe (NonEmpty TransformOperation))
(Maybe (NonEmpty TransformOperation))
(Maybe (NonEmpty TransformOperation))
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 AnIso
(NonEmpty TransformOperation)
(NonEmpty TransformOperation)
(NonEmpty TransformOperation)
(NonEmpty TransformOperation)
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 :: (Text -> f Text) -> LogicalTable -> f LogicalTable
logicalTable_alias = (LogicalTable -> Text)
-> (LogicalTable -> Text -> LogicalTable)
-> Lens LogicalTable LogicalTable Text Text
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 :: (LogicalTableSource -> f LogicalTableSource)
-> LogicalTable -> f LogicalTable
logicalTable_source = (LogicalTable -> LogicalTableSource)
-> (LogicalTable -> LogicalTableSource -> LogicalTable)
-> Lens
LogicalTable LogicalTable LogicalTableSource LogicalTableSource
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 Core.FromJSON LogicalTable where
parseJSON :: Value -> Parser LogicalTable
parseJSON =
String
-> (Object -> Parser LogicalTable) -> Value -> Parser LogicalTable
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LogicalTable"
( \Object
x ->
Maybe (NonEmpty TransformOperation)
-> Text -> LogicalTableSource -> LogicalTable
LogicalTable'
(Maybe (NonEmpty TransformOperation)
-> Text -> LogicalTableSource -> LogicalTable)
-> Parser (Maybe (NonEmpty TransformOperation))
-> Parser (Text -> LogicalTableSource -> LogicalTable)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty TransformOperation))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataTransforms")
Parser (Text -> LogicalTableSource -> LogicalTable)
-> Parser Text -> Parser (LogicalTableSource -> LogicalTable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Alias")
Parser (LogicalTableSource -> LogicalTable)
-> Parser LogicalTableSource -> Parser LogicalTable
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LogicalTableSource
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Source")
)
instance Prelude.Hashable LogicalTable
instance Prelude.NFData LogicalTable
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DataTransforms" Text -> NonEmpty TransformOperation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty TransformOperation -> Pair)
-> Maybe (NonEmpty TransformOperation) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty TransformOperation)
dataTransforms,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Alias" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
alias),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Source" Text -> LogicalTableSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LogicalTableSource
source)
]
)