{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Athena.CreatePreparedStatement
(
CreatePreparedStatement (..),
newCreatePreparedStatement,
createPreparedStatement_description,
createPreparedStatement_statementName,
createPreparedStatement_workGroup,
createPreparedStatement_queryStatement,
CreatePreparedStatementResponse (..),
newCreatePreparedStatementResponse,
createPreparedStatementResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreatePreparedStatement = CreatePreparedStatement'
{
CreatePreparedStatement -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreatePreparedStatement -> Text
statementName :: Prelude.Text,
CreatePreparedStatement -> Text
workGroup :: Prelude.Text,
CreatePreparedStatement -> Text
queryStatement :: Prelude.Text
}
deriving (CreatePreparedStatement -> CreatePreparedStatement -> Bool
(CreatePreparedStatement -> CreatePreparedStatement -> Bool)
-> (CreatePreparedStatement -> CreatePreparedStatement -> Bool)
-> Eq CreatePreparedStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePreparedStatement -> CreatePreparedStatement -> Bool
$c/= :: CreatePreparedStatement -> CreatePreparedStatement -> Bool
== :: CreatePreparedStatement -> CreatePreparedStatement -> Bool
$c== :: CreatePreparedStatement -> CreatePreparedStatement -> Bool
Prelude.Eq, ReadPrec [CreatePreparedStatement]
ReadPrec CreatePreparedStatement
Int -> ReadS CreatePreparedStatement
ReadS [CreatePreparedStatement]
(Int -> ReadS CreatePreparedStatement)
-> ReadS [CreatePreparedStatement]
-> ReadPrec CreatePreparedStatement
-> ReadPrec [CreatePreparedStatement]
-> Read CreatePreparedStatement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePreparedStatement]
$creadListPrec :: ReadPrec [CreatePreparedStatement]
readPrec :: ReadPrec CreatePreparedStatement
$creadPrec :: ReadPrec CreatePreparedStatement
readList :: ReadS [CreatePreparedStatement]
$creadList :: ReadS [CreatePreparedStatement]
readsPrec :: Int -> ReadS CreatePreparedStatement
$creadsPrec :: Int -> ReadS CreatePreparedStatement
Prelude.Read, Int -> CreatePreparedStatement -> ShowS
[CreatePreparedStatement] -> ShowS
CreatePreparedStatement -> String
(Int -> CreatePreparedStatement -> ShowS)
-> (CreatePreparedStatement -> String)
-> ([CreatePreparedStatement] -> ShowS)
-> Show CreatePreparedStatement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePreparedStatement] -> ShowS
$cshowList :: [CreatePreparedStatement] -> ShowS
show :: CreatePreparedStatement -> String
$cshow :: CreatePreparedStatement -> String
showsPrec :: Int -> CreatePreparedStatement -> ShowS
$cshowsPrec :: Int -> CreatePreparedStatement -> ShowS
Prelude.Show, (forall x.
CreatePreparedStatement -> Rep CreatePreparedStatement x)
-> (forall x.
Rep CreatePreparedStatement x -> CreatePreparedStatement)
-> Generic CreatePreparedStatement
forall x. Rep CreatePreparedStatement x -> CreatePreparedStatement
forall x. CreatePreparedStatement -> Rep CreatePreparedStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePreparedStatement x -> CreatePreparedStatement
$cfrom :: forall x. CreatePreparedStatement -> Rep CreatePreparedStatement x
Prelude.Generic)
newCreatePreparedStatement ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreatePreparedStatement
newCreatePreparedStatement :: Text -> Text -> Text -> CreatePreparedStatement
newCreatePreparedStatement
Text
pStatementName_
Text
pWorkGroup_
Text
pQueryStatement_ =
CreatePreparedStatement' :: Maybe Text -> Text -> Text -> Text -> CreatePreparedStatement
CreatePreparedStatement'
{ $sel:description:CreatePreparedStatement' :: Maybe Text
description =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:statementName:CreatePreparedStatement' :: Text
statementName = Text
pStatementName_,
$sel:workGroup:CreatePreparedStatement' :: Text
workGroup = Text
pWorkGroup_,
$sel:queryStatement:CreatePreparedStatement' :: Text
queryStatement = Text
pQueryStatement_
}
createPreparedStatement_description :: Lens.Lens' CreatePreparedStatement (Prelude.Maybe Prelude.Text)
createPreparedStatement_description :: (Maybe Text -> f (Maybe Text))
-> CreatePreparedStatement -> f CreatePreparedStatement
createPreparedStatement_description = (CreatePreparedStatement -> Maybe Text)
-> (CreatePreparedStatement
-> Maybe Text -> CreatePreparedStatement)
-> Lens
CreatePreparedStatement
CreatePreparedStatement
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreparedStatement' {Maybe Text
description :: Maybe Text
$sel:description:CreatePreparedStatement' :: CreatePreparedStatement -> Maybe Text
description} -> Maybe Text
description) (\s :: CreatePreparedStatement
s@CreatePreparedStatement' {} Maybe Text
a -> CreatePreparedStatement
s {$sel:description:CreatePreparedStatement' :: Maybe Text
description = Maybe Text
a} :: CreatePreparedStatement)
createPreparedStatement_statementName :: Lens.Lens' CreatePreparedStatement Prelude.Text
createPreparedStatement_statementName :: (Text -> f Text)
-> CreatePreparedStatement -> f CreatePreparedStatement
createPreparedStatement_statementName = (CreatePreparedStatement -> Text)
-> (CreatePreparedStatement -> Text -> CreatePreparedStatement)
-> Lens CreatePreparedStatement CreatePreparedStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreparedStatement' {Text
statementName :: Text
$sel:statementName:CreatePreparedStatement' :: CreatePreparedStatement -> Text
statementName} -> Text
statementName) (\s :: CreatePreparedStatement
s@CreatePreparedStatement' {} Text
a -> CreatePreparedStatement
s {$sel:statementName:CreatePreparedStatement' :: Text
statementName = Text
a} :: CreatePreparedStatement)
createPreparedStatement_workGroup :: Lens.Lens' CreatePreparedStatement Prelude.Text
createPreparedStatement_workGroup :: (Text -> f Text)
-> CreatePreparedStatement -> f CreatePreparedStatement
createPreparedStatement_workGroup = (CreatePreparedStatement -> Text)
-> (CreatePreparedStatement -> Text -> CreatePreparedStatement)
-> Lens CreatePreparedStatement CreatePreparedStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreparedStatement' {Text
workGroup :: Text
$sel:workGroup:CreatePreparedStatement' :: CreatePreparedStatement -> Text
workGroup} -> Text
workGroup) (\s :: CreatePreparedStatement
s@CreatePreparedStatement' {} Text
a -> CreatePreparedStatement
s {$sel:workGroup:CreatePreparedStatement' :: Text
workGroup = Text
a} :: CreatePreparedStatement)
createPreparedStatement_queryStatement :: Lens.Lens' CreatePreparedStatement Prelude.Text
createPreparedStatement_queryStatement :: (Text -> f Text)
-> CreatePreparedStatement -> f CreatePreparedStatement
createPreparedStatement_queryStatement = (CreatePreparedStatement -> Text)
-> (CreatePreparedStatement -> Text -> CreatePreparedStatement)
-> Lens CreatePreparedStatement CreatePreparedStatement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreparedStatement' {Text
queryStatement :: Text
$sel:queryStatement:CreatePreparedStatement' :: CreatePreparedStatement -> Text
queryStatement} -> Text
queryStatement) (\s :: CreatePreparedStatement
s@CreatePreparedStatement' {} Text
a -> CreatePreparedStatement
s {$sel:queryStatement:CreatePreparedStatement' :: Text
queryStatement = Text
a} :: CreatePreparedStatement)
instance Core.AWSRequest CreatePreparedStatement where
type
AWSResponse CreatePreparedStatement =
CreatePreparedStatementResponse
request :: CreatePreparedStatement -> Request CreatePreparedStatement
request = Service
-> CreatePreparedStatement -> Request CreatePreparedStatement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreatePreparedStatement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePreparedStatement)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreatePreparedStatement))
-> Logger
-> Service
-> Proxy CreatePreparedStatement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePreparedStatement)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> CreatePreparedStatementResponse
CreatePreparedStatementResponse'
(Int -> CreatePreparedStatementResponse)
-> Either String Int
-> Either String CreatePreparedStatementResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreatePreparedStatement
instance Prelude.NFData CreatePreparedStatement
instance Core.ToHeaders CreatePreparedStatement where
toHeaders :: CreatePreparedStatement -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreatePreparedStatement -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonAthena.CreatePreparedStatement" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreatePreparedStatement where
toJSON :: CreatePreparedStatement -> Value
toJSON CreatePreparedStatement' {Maybe Text
Text
queryStatement :: Text
workGroup :: Text
statementName :: Text
description :: Maybe Text
$sel:queryStatement:CreatePreparedStatement' :: CreatePreparedStatement -> Text
$sel:workGroup:CreatePreparedStatement' :: CreatePreparedStatement -> Text
$sel:statementName:CreatePreparedStatement' :: CreatePreparedStatement -> Text
$sel:description:CreatePreparedStatement' :: CreatePreparedStatement -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Description" 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
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StatementName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
statementName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workGroup),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"QueryStatement" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryStatement)
]
)
instance Core.ToPath CreatePreparedStatement where
toPath :: CreatePreparedStatement -> ByteString
toPath = ByteString -> CreatePreparedStatement -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreatePreparedStatement where
toQuery :: CreatePreparedStatement -> QueryString
toQuery = QueryString -> CreatePreparedStatement -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreatePreparedStatementResponse = CreatePreparedStatementResponse'
{
CreatePreparedStatementResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool
(CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool)
-> (CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool)
-> Eq CreatePreparedStatementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool
$c/= :: CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool
== :: CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool
$c== :: CreatePreparedStatementResponse
-> CreatePreparedStatementResponse -> Bool
Prelude.Eq, ReadPrec [CreatePreparedStatementResponse]
ReadPrec CreatePreparedStatementResponse
Int -> ReadS CreatePreparedStatementResponse
ReadS [CreatePreparedStatementResponse]
(Int -> ReadS CreatePreparedStatementResponse)
-> ReadS [CreatePreparedStatementResponse]
-> ReadPrec CreatePreparedStatementResponse
-> ReadPrec [CreatePreparedStatementResponse]
-> Read CreatePreparedStatementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePreparedStatementResponse]
$creadListPrec :: ReadPrec [CreatePreparedStatementResponse]
readPrec :: ReadPrec CreatePreparedStatementResponse
$creadPrec :: ReadPrec CreatePreparedStatementResponse
readList :: ReadS [CreatePreparedStatementResponse]
$creadList :: ReadS [CreatePreparedStatementResponse]
readsPrec :: Int -> ReadS CreatePreparedStatementResponse
$creadsPrec :: Int -> ReadS CreatePreparedStatementResponse
Prelude.Read, Int -> CreatePreparedStatementResponse -> ShowS
[CreatePreparedStatementResponse] -> ShowS
CreatePreparedStatementResponse -> String
(Int -> CreatePreparedStatementResponse -> ShowS)
-> (CreatePreparedStatementResponse -> String)
-> ([CreatePreparedStatementResponse] -> ShowS)
-> Show CreatePreparedStatementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePreparedStatementResponse] -> ShowS
$cshowList :: [CreatePreparedStatementResponse] -> ShowS
show :: CreatePreparedStatementResponse -> String
$cshow :: CreatePreparedStatementResponse -> String
showsPrec :: Int -> CreatePreparedStatementResponse -> ShowS
$cshowsPrec :: Int -> CreatePreparedStatementResponse -> ShowS
Prelude.Show, (forall x.
CreatePreparedStatementResponse
-> Rep CreatePreparedStatementResponse x)
-> (forall x.
Rep CreatePreparedStatementResponse x
-> CreatePreparedStatementResponse)
-> Generic CreatePreparedStatementResponse
forall x.
Rep CreatePreparedStatementResponse x
-> CreatePreparedStatementResponse
forall x.
CreatePreparedStatementResponse
-> Rep CreatePreparedStatementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePreparedStatementResponse x
-> CreatePreparedStatementResponse
$cfrom :: forall x.
CreatePreparedStatementResponse
-> Rep CreatePreparedStatementResponse x
Prelude.Generic)
newCreatePreparedStatementResponse ::
Prelude.Int ->
CreatePreparedStatementResponse
newCreatePreparedStatementResponse :: Int -> CreatePreparedStatementResponse
newCreatePreparedStatementResponse Int
pHttpStatus_ =
CreatePreparedStatementResponse' :: Int -> CreatePreparedStatementResponse
CreatePreparedStatementResponse'
{ $sel:httpStatus:CreatePreparedStatementResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createPreparedStatementResponse_httpStatus :: Lens.Lens' CreatePreparedStatementResponse Prelude.Int
createPreparedStatementResponse_httpStatus :: (Int -> f Int)
-> CreatePreparedStatementResponse
-> f CreatePreparedStatementResponse
createPreparedStatementResponse_httpStatus = (CreatePreparedStatementResponse -> Int)
-> (CreatePreparedStatementResponse
-> Int -> CreatePreparedStatementResponse)
-> Lens
CreatePreparedStatementResponse
CreatePreparedStatementResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePreparedStatementResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePreparedStatementResponse' :: CreatePreparedStatementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePreparedStatementResponse
s@CreatePreparedStatementResponse' {} Int
a -> CreatePreparedStatementResponse
s {$sel:httpStatus:CreatePreparedStatementResponse' :: Int
httpStatus = Int
a} :: CreatePreparedStatementResponse)
instance
Prelude.NFData
CreatePreparedStatementResponse