{-# 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.PhysicalTable where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.CustomSql
import Amazonka.QuickSight.Types.RelationalTable
import Amazonka.QuickSight.Types.S3Source
data PhysicalTable = PhysicalTable'
{
PhysicalTable -> Maybe S3Source
s3Source :: Prelude.Maybe S3Source,
PhysicalTable -> Maybe RelationalTable
relationalTable :: Prelude.Maybe RelationalTable,
PhysicalTable -> Maybe CustomSql
customSql :: Prelude.Maybe CustomSql
}
deriving (PhysicalTable -> PhysicalTable -> Bool
(PhysicalTable -> PhysicalTable -> Bool)
-> (PhysicalTable -> PhysicalTable -> Bool) -> Eq PhysicalTable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalTable -> PhysicalTable -> Bool
$c/= :: PhysicalTable -> PhysicalTable -> Bool
== :: PhysicalTable -> PhysicalTable -> Bool
$c== :: PhysicalTable -> PhysicalTable -> Bool
Prelude.Eq, ReadPrec [PhysicalTable]
ReadPrec PhysicalTable
Int -> ReadS PhysicalTable
ReadS [PhysicalTable]
(Int -> ReadS PhysicalTable)
-> ReadS [PhysicalTable]
-> ReadPrec PhysicalTable
-> ReadPrec [PhysicalTable]
-> Read PhysicalTable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhysicalTable]
$creadListPrec :: ReadPrec [PhysicalTable]
readPrec :: ReadPrec PhysicalTable
$creadPrec :: ReadPrec PhysicalTable
readList :: ReadS [PhysicalTable]
$creadList :: ReadS [PhysicalTable]
readsPrec :: Int -> ReadS PhysicalTable
$creadsPrec :: Int -> ReadS PhysicalTable
Prelude.Read, Int -> PhysicalTable -> ShowS
[PhysicalTable] -> ShowS
PhysicalTable -> String
(Int -> PhysicalTable -> ShowS)
-> (PhysicalTable -> String)
-> ([PhysicalTable] -> ShowS)
-> Show PhysicalTable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhysicalTable] -> ShowS
$cshowList :: [PhysicalTable] -> ShowS
show :: PhysicalTable -> String
$cshow :: PhysicalTable -> String
showsPrec :: Int -> PhysicalTable -> ShowS
$cshowsPrec :: Int -> PhysicalTable -> ShowS
Prelude.Show, (forall x. PhysicalTable -> Rep PhysicalTable x)
-> (forall x. Rep PhysicalTable x -> PhysicalTable)
-> Generic PhysicalTable
forall x. Rep PhysicalTable x -> PhysicalTable
forall x. PhysicalTable -> Rep PhysicalTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhysicalTable x -> PhysicalTable
$cfrom :: forall x. PhysicalTable -> Rep PhysicalTable x
Prelude.Generic)
newPhysicalTable ::
PhysicalTable
newPhysicalTable :: PhysicalTable
newPhysicalTable =
PhysicalTable' :: Maybe S3Source
-> Maybe RelationalTable -> Maybe CustomSql -> PhysicalTable
PhysicalTable'
{ $sel:s3Source:PhysicalTable' :: Maybe S3Source
s3Source = Maybe S3Source
forall a. Maybe a
Prelude.Nothing,
$sel:relationalTable:PhysicalTable' :: Maybe RelationalTable
relationalTable = Maybe RelationalTable
forall a. Maybe a
Prelude.Nothing,
$sel:customSql:PhysicalTable' :: Maybe CustomSql
customSql = Maybe CustomSql
forall a. Maybe a
Prelude.Nothing
}
physicalTable_s3Source :: Lens.Lens' PhysicalTable (Prelude.Maybe S3Source)
physicalTable_s3Source :: (Maybe S3Source -> f (Maybe S3Source))
-> PhysicalTable -> f PhysicalTable
physicalTable_s3Source = (PhysicalTable -> Maybe S3Source)
-> (PhysicalTable -> Maybe S3Source -> PhysicalTable)
-> Lens
PhysicalTable PhysicalTable (Maybe S3Source) (Maybe S3Source)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalTable' {Maybe S3Source
s3Source :: Maybe S3Source
$sel:s3Source:PhysicalTable' :: PhysicalTable -> Maybe S3Source
s3Source} -> Maybe S3Source
s3Source) (\s :: PhysicalTable
s@PhysicalTable' {} Maybe S3Source
a -> PhysicalTable
s {$sel:s3Source:PhysicalTable' :: Maybe S3Source
s3Source = Maybe S3Source
a} :: PhysicalTable)
physicalTable_relationalTable :: Lens.Lens' PhysicalTable (Prelude.Maybe RelationalTable)
physicalTable_relationalTable :: (Maybe RelationalTable -> f (Maybe RelationalTable))
-> PhysicalTable -> f PhysicalTable
physicalTable_relationalTable = (PhysicalTable -> Maybe RelationalTable)
-> (PhysicalTable -> Maybe RelationalTable -> PhysicalTable)
-> Lens
PhysicalTable
PhysicalTable
(Maybe RelationalTable)
(Maybe RelationalTable)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalTable' {Maybe RelationalTable
relationalTable :: Maybe RelationalTable
$sel:relationalTable:PhysicalTable' :: PhysicalTable -> Maybe RelationalTable
relationalTable} -> Maybe RelationalTable
relationalTable) (\s :: PhysicalTable
s@PhysicalTable' {} Maybe RelationalTable
a -> PhysicalTable
s {$sel:relationalTable:PhysicalTable' :: Maybe RelationalTable
relationalTable = Maybe RelationalTable
a} :: PhysicalTable)
physicalTable_customSql :: Lens.Lens' PhysicalTable (Prelude.Maybe CustomSql)
physicalTable_customSql :: (Maybe CustomSql -> f (Maybe CustomSql))
-> PhysicalTable -> f PhysicalTable
physicalTable_customSql = (PhysicalTable -> Maybe CustomSql)
-> (PhysicalTable -> Maybe CustomSql -> PhysicalTable)
-> Lens
PhysicalTable PhysicalTable (Maybe CustomSql) (Maybe CustomSql)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalTable' {Maybe CustomSql
customSql :: Maybe CustomSql
$sel:customSql:PhysicalTable' :: PhysicalTable -> Maybe CustomSql
customSql} -> Maybe CustomSql
customSql) (\s :: PhysicalTable
s@PhysicalTable' {} Maybe CustomSql
a -> PhysicalTable
s {$sel:customSql:PhysicalTable' :: Maybe CustomSql
customSql = Maybe CustomSql
a} :: PhysicalTable)
instance Core.FromJSON PhysicalTable where
parseJSON :: Value -> Parser PhysicalTable
parseJSON =
String
-> (Object -> Parser PhysicalTable)
-> Value
-> Parser PhysicalTable
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PhysicalTable"
( \Object
x ->
Maybe S3Source
-> Maybe RelationalTable -> Maybe CustomSql -> PhysicalTable
PhysicalTable'
(Maybe S3Source
-> Maybe RelationalTable -> Maybe CustomSql -> PhysicalTable)
-> Parser (Maybe S3Source)
-> Parser
(Maybe RelationalTable -> Maybe CustomSql -> PhysicalTable)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3Source)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Source")
Parser (Maybe RelationalTable -> Maybe CustomSql -> PhysicalTable)
-> Parser (Maybe RelationalTable)
-> Parser (Maybe CustomSql -> PhysicalTable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RelationalTable)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RelationalTable")
Parser (Maybe CustomSql -> PhysicalTable)
-> Parser (Maybe CustomSql) -> Parser PhysicalTable
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CustomSql)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CustomSql")
)
instance Prelude.Hashable PhysicalTable
instance Prelude.NFData PhysicalTable
instance Core.ToJSON PhysicalTable where
toJSON :: PhysicalTable -> Value
toJSON PhysicalTable' {Maybe CustomSql
Maybe RelationalTable
Maybe S3Source
customSql :: Maybe CustomSql
relationalTable :: Maybe RelationalTable
s3Source :: Maybe S3Source
$sel:customSql:PhysicalTable' :: PhysicalTable -> Maybe CustomSql
$sel:relationalTable:PhysicalTable' :: PhysicalTable -> Maybe RelationalTable
$sel:s3Source:PhysicalTable' :: PhysicalTable -> Maybe S3Source
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"S3Source" Text -> S3Source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3Source -> Pair) -> Maybe S3Source -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Source
s3Source,
(Text
"RelationalTable" Text -> RelationalTable -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RelationalTable -> Pair) -> Maybe RelationalTable -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RelationalTable
relationalTable,
(Text
"CustomSql" Text -> CustomSql -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CustomSql -> Pair) -> Maybe CustomSql -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CustomSql
customSql
]
)