{-# 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.CustomSql where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.InputColumn
data CustomSql = CustomSql'
{
CustomSql -> Maybe (NonEmpty InputColumn)
columns :: Prelude.Maybe (Prelude.NonEmpty InputColumn),
CustomSql -> Text
dataSourceArn :: Prelude.Text,
CustomSql -> Text
name :: Prelude.Text,
CustomSql -> Text
sqlQuery :: Prelude.Text
}
deriving (CustomSql -> CustomSql -> Bool
(CustomSql -> CustomSql -> Bool)
-> (CustomSql -> CustomSql -> Bool) -> Eq CustomSql
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomSql -> CustomSql -> Bool
$c/= :: CustomSql -> CustomSql -> Bool
== :: CustomSql -> CustomSql -> Bool
$c== :: CustomSql -> CustomSql -> Bool
Prelude.Eq, ReadPrec [CustomSql]
ReadPrec CustomSql
Int -> ReadS CustomSql
ReadS [CustomSql]
(Int -> ReadS CustomSql)
-> ReadS [CustomSql]
-> ReadPrec CustomSql
-> ReadPrec [CustomSql]
-> Read CustomSql
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomSql]
$creadListPrec :: ReadPrec [CustomSql]
readPrec :: ReadPrec CustomSql
$creadPrec :: ReadPrec CustomSql
readList :: ReadS [CustomSql]
$creadList :: ReadS [CustomSql]
readsPrec :: Int -> ReadS CustomSql
$creadsPrec :: Int -> ReadS CustomSql
Prelude.Read, Int -> CustomSql -> ShowS
[CustomSql] -> ShowS
CustomSql -> String
(Int -> CustomSql -> ShowS)
-> (CustomSql -> String)
-> ([CustomSql] -> ShowS)
-> Show CustomSql
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomSql] -> ShowS
$cshowList :: [CustomSql] -> ShowS
show :: CustomSql -> String
$cshow :: CustomSql -> String
showsPrec :: Int -> CustomSql -> ShowS
$cshowsPrec :: Int -> CustomSql -> ShowS
Prelude.Show, (forall x. CustomSql -> Rep CustomSql x)
-> (forall x. Rep CustomSql x -> CustomSql) -> Generic CustomSql
forall x. Rep CustomSql x -> CustomSql
forall x. CustomSql -> Rep CustomSql x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomSql x -> CustomSql
$cfrom :: forall x. CustomSql -> Rep CustomSql x
Prelude.Generic)
newCustomSql ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CustomSql
newCustomSql :: Text -> Text -> Text -> CustomSql
newCustomSql Text
pDataSourceArn_ Text
pName_ Text
pSqlQuery_ =
CustomSql' :: Maybe (NonEmpty InputColumn) -> Text -> Text -> Text -> CustomSql
CustomSql'
{ $sel:columns:CustomSql' :: Maybe (NonEmpty InputColumn)
columns = Maybe (NonEmpty InputColumn)
forall a. Maybe a
Prelude.Nothing,
$sel:dataSourceArn:CustomSql' :: Text
dataSourceArn = Text
pDataSourceArn_,
$sel:name:CustomSql' :: Text
name = Text
pName_,
$sel:sqlQuery:CustomSql' :: Text
sqlQuery = Text
pSqlQuery_
}
customSql_columns :: Lens.Lens' CustomSql (Prelude.Maybe (Prelude.NonEmpty InputColumn))
customSql_columns :: (Maybe (NonEmpty InputColumn) -> f (Maybe (NonEmpty InputColumn)))
-> CustomSql -> f CustomSql
customSql_columns = (CustomSql -> Maybe (NonEmpty InputColumn))
-> (CustomSql -> Maybe (NonEmpty InputColumn) -> CustomSql)
-> Lens
CustomSql
CustomSql
(Maybe (NonEmpty InputColumn))
(Maybe (NonEmpty InputColumn))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomSql' {Maybe (NonEmpty InputColumn)
columns :: Maybe (NonEmpty InputColumn)
$sel:columns:CustomSql' :: CustomSql -> Maybe (NonEmpty InputColumn)
columns} -> Maybe (NonEmpty InputColumn)
columns) (\s :: CustomSql
s@CustomSql' {} Maybe (NonEmpty InputColumn)
a -> CustomSql
s {$sel:columns:CustomSql' :: Maybe (NonEmpty InputColumn)
columns = Maybe (NonEmpty InputColumn)
a} :: CustomSql) ((Maybe (NonEmpty InputColumn) -> f (Maybe (NonEmpty InputColumn)))
-> CustomSql -> f CustomSql)
-> ((Maybe (NonEmpty InputColumn)
-> f (Maybe (NonEmpty InputColumn)))
-> Maybe (NonEmpty InputColumn)
-> f (Maybe (NonEmpty InputColumn)))
-> (Maybe (NonEmpty InputColumn)
-> f (Maybe (NonEmpty InputColumn)))
-> CustomSql
-> f CustomSql
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty InputColumn)
(NonEmpty InputColumn)
(NonEmpty InputColumn)
(NonEmpty InputColumn)
-> Iso
(Maybe (NonEmpty InputColumn))
(Maybe (NonEmpty InputColumn))
(Maybe (NonEmpty InputColumn))
(Maybe (NonEmpty InputColumn))
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 InputColumn)
(NonEmpty InputColumn)
(NonEmpty InputColumn)
(NonEmpty InputColumn)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
customSql_dataSourceArn :: Lens.Lens' CustomSql Prelude.Text
customSql_dataSourceArn :: (Text -> f Text) -> CustomSql -> f CustomSql
customSql_dataSourceArn = (CustomSql -> Text)
-> (CustomSql -> Text -> CustomSql)
-> Lens CustomSql CustomSql Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomSql' {Text
dataSourceArn :: Text
$sel:dataSourceArn:CustomSql' :: CustomSql -> Text
dataSourceArn} -> Text
dataSourceArn) (\s :: CustomSql
s@CustomSql' {} Text
a -> CustomSql
s {$sel:dataSourceArn:CustomSql' :: Text
dataSourceArn = Text
a} :: CustomSql)
customSql_name :: Lens.Lens' CustomSql Prelude.Text
customSql_name :: (Text -> f Text) -> CustomSql -> f CustomSql
customSql_name = (CustomSql -> Text)
-> (CustomSql -> Text -> CustomSql)
-> Lens CustomSql CustomSql Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomSql' {Text
name :: Text
$sel:name:CustomSql' :: CustomSql -> Text
name} -> Text
name) (\s :: CustomSql
s@CustomSql' {} Text
a -> CustomSql
s {$sel:name:CustomSql' :: Text
name = Text
a} :: CustomSql)
customSql_sqlQuery :: Lens.Lens' CustomSql Prelude.Text
customSql_sqlQuery :: (Text -> f Text) -> CustomSql -> f CustomSql
customSql_sqlQuery = (CustomSql -> Text)
-> (CustomSql -> Text -> CustomSql)
-> Lens CustomSql CustomSql Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomSql' {Text
sqlQuery :: Text
$sel:sqlQuery:CustomSql' :: CustomSql -> Text
sqlQuery} -> Text
sqlQuery) (\s :: CustomSql
s@CustomSql' {} Text
a -> CustomSql
s {$sel:sqlQuery:CustomSql' :: Text
sqlQuery = Text
a} :: CustomSql)
instance Core.FromJSON CustomSql where
parseJSON :: Value -> Parser CustomSql
parseJSON =
String -> (Object -> Parser CustomSql) -> Value -> Parser CustomSql
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CustomSql"
( \Object
x ->
Maybe (NonEmpty InputColumn) -> Text -> Text -> Text -> CustomSql
CustomSql'
(Maybe (NonEmpty InputColumn) -> Text -> Text -> Text -> CustomSql)
-> Parser (Maybe (NonEmpty InputColumn))
-> Parser (Text -> Text -> Text -> CustomSql)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty InputColumn))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Columns")
Parser (Text -> Text -> Text -> CustomSql)
-> Parser Text -> Parser (Text -> Text -> CustomSql)
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
"DataSourceArn")
Parser (Text -> Text -> CustomSql)
-> Parser Text -> Parser (Text -> CustomSql)
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
"Name")
Parser (Text -> CustomSql) -> Parser Text -> Parser CustomSql
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
"SqlQuery")
)
instance Prelude.Hashable CustomSql
instance Prelude.NFData CustomSql
instance Core.ToJSON CustomSql where
toJSON :: CustomSql -> Value
toJSON CustomSql' {Maybe (NonEmpty InputColumn)
Text
sqlQuery :: Text
name :: Text
dataSourceArn :: Text
columns :: Maybe (NonEmpty InputColumn)
$sel:sqlQuery:CustomSql' :: CustomSql -> Text
$sel:name:CustomSql' :: CustomSql -> Text
$sel:dataSourceArn:CustomSql' :: CustomSql -> Text
$sel:columns:CustomSql' :: CustomSql -> Maybe (NonEmpty InputColumn)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Columns" Text -> NonEmpty InputColumn -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty InputColumn -> Pair)
-> Maybe (NonEmpty InputColumn) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty InputColumn)
columns,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataSourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SqlQuery" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sqlQuery)
]
)