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