{-# 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.BatchGetPreparedStatement
(
BatchGetPreparedStatement (..),
newBatchGetPreparedStatement,
batchGetPreparedStatement_preparedStatementNames,
batchGetPreparedStatement_workGroup,
BatchGetPreparedStatementResponse (..),
newBatchGetPreparedStatementResponse,
batchGetPreparedStatementResponse_preparedStatements,
batchGetPreparedStatementResponse_unprocessedPreparedStatementNames,
batchGetPreparedStatementResponse_httpStatus,
)
where
import Amazonka.Athena.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchGetPreparedStatement = BatchGetPreparedStatement'
{
BatchGetPreparedStatement -> [Text]
preparedStatementNames :: [Prelude.Text],
BatchGetPreparedStatement -> Text
workGroup :: Prelude.Text
}
deriving (BatchGetPreparedStatement -> BatchGetPreparedStatement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetPreparedStatement -> BatchGetPreparedStatement -> Bool
$c/= :: BatchGetPreparedStatement -> BatchGetPreparedStatement -> Bool
== :: BatchGetPreparedStatement -> BatchGetPreparedStatement -> Bool
$c== :: BatchGetPreparedStatement -> BatchGetPreparedStatement -> Bool
Prelude.Eq, ReadPrec [BatchGetPreparedStatement]
ReadPrec BatchGetPreparedStatement
Int -> ReadS BatchGetPreparedStatement
ReadS [BatchGetPreparedStatement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetPreparedStatement]
$creadListPrec :: ReadPrec [BatchGetPreparedStatement]
readPrec :: ReadPrec BatchGetPreparedStatement
$creadPrec :: ReadPrec BatchGetPreparedStatement
readList :: ReadS [BatchGetPreparedStatement]
$creadList :: ReadS [BatchGetPreparedStatement]
readsPrec :: Int -> ReadS BatchGetPreparedStatement
$creadsPrec :: Int -> ReadS BatchGetPreparedStatement
Prelude.Read, Int -> BatchGetPreparedStatement -> ShowS
[BatchGetPreparedStatement] -> ShowS
BatchGetPreparedStatement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetPreparedStatement] -> ShowS
$cshowList :: [BatchGetPreparedStatement] -> ShowS
show :: BatchGetPreparedStatement -> String
$cshow :: BatchGetPreparedStatement -> String
showsPrec :: Int -> BatchGetPreparedStatement -> ShowS
$cshowsPrec :: Int -> BatchGetPreparedStatement -> ShowS
Prelude.Show, forall x.
Rep BatchGetPreparedStatement x -> BatchGetPreparedStatement
forall x.
BatchGetPreparedStatement -> Rep BatchGetPreparedStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetPreparedStatement x -> BatchGetPreparedStatement
$cfrom :: forall x.
BatchGetPreparedStatement -> Rep BatchGetPreparedStatement x
Prelude.Generic)
newBatchGetPreparedStatement ::
Prelude.Text ->
BatchGetPreparedStatement
newBatchGetPreparedStatement :: Text -> BatchGetPreparedStatement
newBatchGetPreparedStatement Text
pWorkGroup_ =
BatchGetPreparedStatement'
{ $sel:preparedStatementNames:BatchGetPreparedStatement' :: [Text]
preparedStatementNames =
forall a. Monoid a => a
Prelude.mempty,
$sel:workGroup:BatchGetPreparedStatement' :: Text
workGroup = Text
pWorkGroup_
}
batchGetPreparedStatement_preparedStatementNames :: Lens.Lens' BatchGetPreparedStatement [Prelude.Text]
batchGetPreparedStatement_preparedStatementNames :: Lens' BatchGetPreparedStatement [Text]
batchGetPreparedStatement_preparedStatementNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetPreparedStatement' {[Text]
preparedStatementNames :: [Text]
$sel:preparedStatementNames:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> [Text]
preparedStatementNames} -> [Text]
preparedStatementNames) (\s :: BatchGetPreparedStatement
s@BatchGetPreparedStatement' {} [Text]
a -> BatchGetPreparedStatement
s {$sel:preparedStatementNames:BatchGetPreparedStatement' :: [Text]
preparedStatementNames = [Text]
a} :: BatchGetPreparedStatement) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetPreparedStatement_workGroup :: Lens.Lens' BatchGetPreparedStatement Prelude.Text
batchGetPreparedStatement_workGroup :: Lens' BatchGetPreparedStatement Text
batchGetPreparedStatement_workGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetPreparedStatement' {Text
workGroup :: Text
$sel:workGroup:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> Text
workGroup} -> Text
workGroup) (\s :: BatchGetPreparedStatement
s@BatchGetPreparedStatement' {} Text
a -> BatchGetPreparedStatement
s {$sel:workGroup:BatchGetPreparedStatement' :: Text
workGroup = Text
a} :: BatchGetPreparedStatement)
instance Core.AWSRequest BatchGetPreparedStatement where
type
AWSResponse BatchGetPreparedStatement =
BatchGetPreparedStatementResponse
request :: (Service -> Service)
-> BatchGetPreparedStatement -> Request BatchGetPreparedStatement
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchGetPreparedStatement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetPreparedStatement)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [PreparedStatement]
-> Maybe [UnprocessedPreparedStatementName]
-> Int
-> BatchGetPreparedStatementResponse
BatchGetPreparedStatementResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PreparedStatements"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UnprocessedPreparedStatementNames"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchGetPreparedStatement where
hashWithSalt :: Int -> BatchGetPreparedStatement -> Int
hashWithSalt Int
_salt BatchGetPreparedStatement' {[Text]
Text
workGroup :: Text
preparedStatementNames :: [Text]
$sel:workGroup:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> Text
$sel:preparedStatementNames:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
preparedStatementNames
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workGroup
instance Prelude.NFData BatchGetPreparedStatement where
rnf :: BatchGetPreparedStatement -> ()
rnf BatchGetPreparedStatement' {[Text]
Text
workGroup :: Text
preparedStatementNames :: [Text]
$sel:workGroup:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> Text
$sel:preparedStatementNames:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf [Text]
preparedStatementNames
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workGroup
instance Data.ToHeaders BatchGetPreparedStatement where
toHeaders :: BatchGetPreparedStatement -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonAthena.BatchGetPreparedStatement" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchGetPreparedStatement where
toJSON :: BatchGetPreparedStatement -> Value
toJSON BatchGetPreparedStatement' {[Text]
Text
workGroup :: Text
preparedStatementNames :: [Text]
$sel:workGroup:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> Text
$sel:preparedStatementNames:BatchGetPreparedStatement' :: BatchGetPreparedStatement -> [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"PreparedStatementNames"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
preparedStatementNames
),
forall a. a -> Maybe a
Prelude.Just (Key
"WorkGroup" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workGroup)
]
)
instance Data.ToPath BatchGetPreparedStatement where
toPath :: BatchGetPreparedStatement -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchGetPreparedStatement where
toQuery :: BatchGetPreparedStatement -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetPreparedStatementResponse = BatchGetPreparedStatementResponse'
{
BatchGetPreparedStatementResponse -> Maybe [PreparedStatement]
preparedStatements :: Prelude.Maybe [PreparedStatement],
BatchGetPreparedStatementResponse
-> Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames :: Prelude.Maybe [UnprocessedPreparedStatementName],
BatchGetPreparedStatementResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetPreparedStatementResponse
-> BatchGetPreparedStatementResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetPreparedStatementResponse
-> BatchGetPreparedStatementResponse -> Bool
$c/= :: BatchGetPreparedStatementResponse
-> BatchGetPreparedStatementResponse -> Bool
== :: BatchGetPreparedStatementResponse
-> BatchGetPreparedStatementResponse -> Bool
$c== :: BatchGetPreparedStatementResponse
-> BatchGetPreparedStatementResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetPreparedStatementResponse]
ReadPrec BatchGetPreparedStatementResponse
Int -> ReadS BatchGetPreparedStatementResponse
ReadS [BatchGetPreparedStatementResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetPreparedStatementResponse]
$creadListPrec :: ReadPrec [BatchGetPreparedStatementResponse]
readPrec :: ReadPrec BatchGetPreparedStatementResponse
$creadPrec :: ReadPrec BatchGetPreparedStatementResponse
readList :: ReadS [BatchGetPreparedStatementResponse]
$creadList :: ReadS [BatchGetPreparedStatementResponse]
readsPrec :: Int -> ReadS BatchGetPreparedStatementResponse
$creadsPrec :: Int -> ReadS BatchGetPreparedStatementResponse
Prelude.Read, Int -> BatchGetPreparedStatementResponse -> ShowS
[BatchGetPreparedStatementResponse] -> ShowS
BatchGetPreparedStatementResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetPreparedStatementResponse] -> ShowS
$cshowList :: [BatchGetPreparedStatementResponse] -> ShowS
show :: BatchGetPreparedStatementResponse -> String
$cshow :: BatchGetPreparedStatementResponse -> String
showsPrec :: Int -> BatchGetPreparedStatementResponse -> ShowS
$cshowsPrec :: Int -> BatchGetPreparedStatementResponse -> ShowS
Prelude.Show, forall x.
Rep BatchGetPreparedStatementResponse x
-> BatchGetPreparedStatementResponse
forall x.
BatchGetPreparedStatementResponse
-> Rep BatchGetPreparedStatementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetPreparedStatementResponse x
-> BatchGetPreparedStatementResponse
$cfrom :: forall x.
BatchGetPreparedStatementResponse
-> Rep BatchGetPreparedStatementResponse x
Prelude.Generic)
newBatchGetPreparedStatementResponse ::
Prelude.Int ->
BatchGetPreparedStatementResponse
newBatchGetPreparedStatementResponse :: Int -> BatchGetPreparedStatementResponse
newBatchGetPreparedStatementResponse Int
pHttpStatus_ =
BatchGetPreparedStatementResponse'
{ $sel:preparedStatements:BatchGetPreparedStatementResponse' :: Maybe [PreparedStatement]
preparedStatements =
forall a. Maybe a
Prelude.Nothing,
$sel:unprocessedPreparedStatementNames:BatchGetPreparedStatementResponse' :: Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetPreparedStatementResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetPreparedStatementResponse_preparedStatements :: Lens.Lens' BatchGetPreparedStatementResponse (Prelude.Maybe [PreparedStatement])
batchGetPreparedStatementResponse_preparedStatements :: Lens' BatchGetPreparedStatementResponse (Maybe [PreparedStatement])
batchGetPreparedStatementResponse_preparedStatements = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetPreparedStatementResponse' {Maybe [PreparedStatement]
preparedStatements :: Maybe [PreparedStatement]
$sel:preparedStatements:BatchGetPreparedStatementResponse' :: BatchGetPreparedStatementResponse -> Maybe [PreparedStatement]
preparedStatements} -> Maybe [PreparedStatement]
preparedStatements) (\s :: BatchGetPreparedStatementResponse
s@BatchGetPreparedStatementResponse' {} Maybe [PreparedStatement]
a -> BatchGetPreparedStatementResponse
s {$sel:preparedStatements:BatchGetPreparedStatementResponse' :: Maybe [PreparedStatement]
preparedStatements = Maybe [PreparedStatement]
a} :: BatchGetPreparedStatementResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetPreparedStatementResponse_unprocessedPreparedStatementNames :: Lens.Lens' BatchGetPreparedStatementResponse (Prelude.Maybe [UnprocessedPreparedStatementName])
batchGetPreparedStatementResponse_unprocessedPreparedStatementNames :: Lens'
BatchGetPreparedStatementResponse
(Maybe [UnprocessedPreparedStatementName])
batchGetPreparedStatementResponse_unprocessedPreparedStatementNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetPreparedStatementResponse' {Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames :: Maybe [UnprocessedPreparedStatementName]
$sel:unprocessedPreparedStatementNames:BatchGetPreparedStatementResponse' :: BatchGetPreparedStatementResponse
-> Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames} -> Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames) (\s :: BatchGetPreparedStatementResponse
s@BatchGetPreparedStatementResponse' {} Maybe [UnprocessedPreparedStatementName]
a -> BatchGetPreparedStatementResponse
s {$sel:unprocessedPreparedStatementNames:BatchGetPreparedStatementResponse' :: Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames = Maybe [UnprocessedPreparedStatementName]
a} :: BatchGetPreparedStatementResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchGetPreparedStatementResponse_httpStatus :: Lens.Lens' BatchGetPreparedStatementResponse Prelude.Int
batchGetPreparedStatementResponse_httpStatus :: Lens' BatchGetPreparedStatementResponse Int
batchGetPreparedStatementResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetPreparedStatementResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetPreparedStatementResponse' :: BatchGetPreparedStatementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetPreparedStatementResponse
s@BatchGetPreparedStatementResponse' {} Int
a -> BatchGetPreparedStatementResponse
s {$sel:httpStatus:BatchGetPreparedStatementResponse' :: Int
httpStatus = Int
a} :: BatchGetPreparedStatementResponse)
instance
Prelude.NFData
BatchGetPreparedStatementResponse
where
rnf :: BatchGetPreparedStatementResponse -> ()
rnf BatchGetPreparedStatementResponse' {Int
Maybe [PreparedStatement]
Maybe [UnprocessedPreparedStatementName]
httpStatus :: Int
unprocessedPreparedStatementNames :: Maybe [UnprocessedPreparedStatementName]
preparedStatements :: Maybe [PreparedStatement]
$sel:httpStatus:BatchGetPreparedStatementResponse' :: BatchGetPreparedStatementResponse -> Int
$sel:unprocessedPreparedStatementNames:BatchGetPreparedStatementResponse' :: BatchGetPreparedStatementResponse
-> Maybe [UnprocessedPreparedStatementName]
$sel:preparedStatements:BatchGetPreparedStatementResponse' :: BatchGetPreparedStatementResponse -> Maybe [PreparedStatement]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [PreparedStatement]
preparedStatements
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [UnprocessedPreparedStatementName]
unprocessedPreparedStatementNames
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus