{-# 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.NamedQuery where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data NamedQuery = NamedQuery'
{
NamedQuery -> Maybe Text
namedQueryId :: Prelude.Maybe Prelude.Text,
NamedQuery -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
NamedQuery -> Maybe Text
workGroup :: Prelude.Maybe Prelude.Text,
NamedQuery -> Text
name :: Prelude.Text,
NamedQuery -> Text
database :: Prelude.Text,
NamedQuery -> Text
queryString :: Prelude.Text
}
deriving (NamedQuery -> NamedQuery -> Bool
(NamedQuery -> NamedQuery -> Bool)
-> (NamedQuery -> NamedQuery -> Bool) -> Eq NamedQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NamedQuery -> NamedQuery -> Bool
$c/= :: NamedQuery -> NamedQuery -> Bool
== :: NamedQuery -> NamedQuery -> Bool
$c== :: NamedQuery -> NamedQuery -> Bool
Prelude.Eq, ReadPrec [NamedQuery]
ReadPrec NamedQuery
Int -> ReadS NamedQuery
ReadS [NamedQuery]
(Int -> ReadS NamedQuery)
-> ReadS [NamedQuery]
-> ReadPrec NamedQuery
-> ReadPrec [NamedQuery]
-> Read NamedQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NamedQuery]
$creadListPrec :: ReadPrec [NamedQuery]
readPrec :: ReadPrec NamedQuery
$creadPrec :: ReadPrec NamedQuery
readList :: ReadS [NamedQuery]
$creadList :: ReadS [NamedQuery]
readsPrec :: Int -> ReadS NamedQuery
$creadsPrec :: Int -> ReadS NamedQuery
Prelude.Read, Int -> NamedQuery -> ShowS
[NamedQuery] -> ShowS
NamedQuery -> String
(Int -> NamedQuery -> ShowS)
-> (NamedQuery -> String)
-> ([NamedQuery] -> ShowS)
-> Show NamedQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NamedQuery] -> ShowS
$cshowList :: [NamedQuery] -> ShowS
show :: NamedQuery -> String
$cshow :: NamedQuery -> String
showsPrec :: Int -> NamedQuery -> ShowS
$cshowsPrec :: Int -> NamedQuery -> ShowS
Prelude.Show, (forall x. NamedQuery -> Rep NamedQuery x)
-> (forall x. Rep NamedQuery x -> NamedQuery) -> Generic NamedQuery
forall x. Rep NamedQuery x -> NamedQuery
forall x. NamedQuery -> Rep NamedQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NamedQuery x -> NamedQuery
$cfrom :: forall x. NamedQuery -> Rep NamedQuery x
Prelude.Generic)
newNamedQuery ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
NamedQuery
newNamedQuery :: Text -> Text -> Text -> NamedQuery
newNamedQuery Text
pName_ Text
pDatabase_ Text
pQueryString_ =
NamedQuery' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> Text -> NamedQuery
NamedQuery'
{ $sel:namedQueryId:NamedQuery' :: Maybe Text
namedQueryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:NamedQuery' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:workGroup:NamedQuery' :: Maybe Text
workGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:NamedQuery' :: Text
name = Text
pName_,
$sel:database:NamedQuery' :: Text
database = Text
pDatabase_,
$sel:queryString:NamedQuery' :: Text
queryString = Text
pQueryString_
}
namedQuery_namedQueryId :: Lens.Lens' NamedQuery (Prelude.Maybe Prelude.Text)
namedQuery_namedQueryId :: (Maybe Text -> f (Maybe Text)) -> NamedQuery -> f NamedQuery
namedQuery_namedQueryId = (NamedQuery -> Maybe Text)
-> (NamedQuery -> Maybe Text -> NamedQuery)
-> Lens NamedQuery NamedQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamedQuery' {Maybe Text
namedQueryId :: Maybe Text
$sel:namedQueryId:NamedQuery' :: NamedQuery -> Maybe Text
namedQueryId} -> Maybe Text
namedQueryId) (\s :: NamedQuery
s@NamedQuery' {} Maybe Text
a -> NamedQuery
s {$sel:namedQueryId:NamedQuery' :: Maybe Text
namedQueryId = Maybe Text
a} :: NamedQuery)
namedQuery_description :: Lens.Lens' NamedQuery (Prelude.Maybe Prelude.Text)
namedQuery_description :: (Maybe Text -> f (Maybe Text)) -> NamedQuery -> f NamedQuery
namedQuery_description = (NamedQuery -> Maybe Text)
-> (NamedQuery -> Maybe Text -> NamedQuery)
-> Lens NamedQuery NamedQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamedQuery' {Maybe Text
description :: Maybe Text
$sel:description:NamedQuery' :: NamedQuery -> Maybe Text
description} -> Maybe Text
description) (\s :: NamedQuery
s@NamedQuery' {} Maybe Text
a -> NamedQuery
s {$sel:description:NamedQuery' :: Maybe Text
description = Maybe Text
a} :: NamedQuery)
namedQuery_workGroup :: Lens.Lens' NamedQuery (Prelude.Maybe Prelude.Text)
namedQuery_workGroup :: (Maybe Text -> f (Maybe Text)) -> NamedQuery -> f NamedQuery
namedQuery_workGroup = (NamedQuery -> Maybe Text)
-> (NamedQuery -> Maybe Text -> NamedQuery)
-> Lens NamedQuery NamedQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamedQuery' {Maybe Text
workGroup :: Maybe Text
$sel:workGroup:NamedQuery' :: NamedQuery -> Maybe Text
workGroup} -> Maybe Text
workGroup) (\s :: NamedQuery
s@NamedQuery' {} Maybe Text
a -> NamedQuery
s {$sel:workGroup:NamedQuery' :: Maybe Text
workGroup = Maybe Text
a} :: NamedQuery)
namedQuery_name :: Lens.Lens' NamedQuery Prelude.Text
namedQuery_name :: (Text -> f Text) -> NamedQuery -> f NamedQuery
namedQuery_name = (NamedQuery -> Text)
-> (NamedQuery -> Text -> NamedQuery)
-> Lens NamedQuery NamedQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamedQuery' {Text
name :: Text
$sel:name:NamedQuery' :: NamedQuery -> Text
name} -> Text
name) (\s :: NamedQuery
s@NamedQuery' {} Text
a -> NamedQuery
s {$sel:name:NamedQuery' :: Text
name = Text
a} :: NamedQuery)
namedQuery_database :: Lens.Lens' NamedQuery Prelude.Text
namedQuery_database :: (Text -> f Text) -> NamedQuery -> f NamedQuery
namedQuery_database = (NamedQuery -> Text)
-> (NamedQuery -> Text -> NamedQuery)
-> Lens NamedQuery NamedQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamedQuery' {Text
database :: Text
$sel:database:NamedQuery' :: NamedQuery -> Text
database} -> Text
database) (\s :: NamedQuery
s@NamedQuery' {} Text
a -> NamedQuery
s {$sel:database:NamedQuery' :: Text
database = Text
a} :: NamedQuery)
namedQuery_queryString :: Lens.Lens' NamedQuery Prelude.Text
namedQuery_queryString :: (Text -> f Text) -> NamedQuery -> f NamedQuery
namedQuery_queryString = (NamedQuery -> Text)
-> (NamedQuery -> Text -> NamedQuery)
-> Lens NamedQuery NamedQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NamedQuery' {Text
queryString :: Text
$sel:queryString:NamedQuery' :: NamedQuery -> Text
queryString} -> Text
queryString) (\s :: NamedQuery
s@NamedQuery' {} Text
a -> NamedQuery
s {$sel:queryString:NamedQuery' :: Text
queryString = Text
a} :: NamedQuery)
instance Core.FromJSON NamedQuery where
parseJSON :: Value -> Parser NamedQuery
parseJSON =
String
-> (Object -> Parser NamedQuery) -> Value -> Parser NamedQuery
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"NamedQuery"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> Text -> NamedQuery
NamedQuery'
(Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> Text -> NamedQuery)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Text -> Text -> Text -> NamedQuery)
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
"NamedQueryId")
Parser
(Maybe Text -> Maybe Text -> Text -> Text -> Text -> NamedQuery)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> Text -> Text -> NamedQuery)
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
"Description")
Parser (Maybe Text -> Text -> Text -> Text -> NamedQuery)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> NamedQuery)
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
"WorkGroup")
Parser (Text -> Text -> Text -> NamedQuery)
-> Parser Text -> Parser (Text -> Text -> NamedQuery)
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 -> Text -> NamedQuery)
-> Parser Text -> Parser (Text -> NamedQuery)
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
"Database")
Parser (Text -> NamedQuery) -> Parser Text -> Parser NamedQuery
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
"QueryString")
)
instance Prelude.Hashable NamedQuery
instance Prelude.NFData NamedQuery