{-# 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.BatchGetNamedQuery
(
BatchGetNamedQuery (..),
newBatchGetNamedQuery,
batchGetNamedQuery_namedQueryIds,
BatchGetNamedQueryResponse (..),
newBatchGetNamedQueryResponse,
batchGetNamedQueryResponse_namedQueries,
batchGetNamedQueryResponse_unprocessedNamedQueryIds,
batchGetNamedQueryResponse_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 BatchGetNamedQuery = BatchGetNamedQuery'
{
BatchGetNamedQuery -> NonEmpty Text
namedQueryIds :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchGetNamedQuery -> BatchGetNamedQuery -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetNamedQuery -> BatchGetNamedQuery -> Bool
$c/= :: BatchGetNamedQuery -> BatchGetNamedQuery -> Bool
== :: BatchGetNamedQuery -> BatchGetNamedQuery -> Bool
$c== :: BatchGetNamedQuery -> BatchGetNamedQuery -> Bool
Prelude.Eq, ReadPrec [BatchGetNamedQuery]
ReadPrec BatchGetNamedQuery
Int -> ReadS BatchGetNamedQuery
ReadS [BatchGetNamedQuery]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetNamedQuery]
$creadListPrec :: ReadPrec [BatchGetNamedQuery]
readPrec :: ReadPrec BatchGetNamedQuery
$creadPrec :: ReadPrec BatchGetNamedQuery
readList :: ReadS [BatchGetNamedQuery]
$creadList :: ReadS [BatchGetNamedQuery]
readsPrec :: Int -> ReadS BatchGetNamedQuery
$creadsPrec :: Int -> ReadS BatchGetNamedQuery
Prelude.Read, Int -> BatchGetNamedQuery -> ShowS
[BatchGetNamedQuery] -> ShowS
BatchGetNamedQuery -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetNamedQuery] -> ShowS
$cshowList :: [BatchGetNamedQuery] -> ShowS
show :: BatchGetNamedQuery -> String
$cshow :: BatchGetNamedQuery -> String
showsPrec :: Int -> BatchGetNamedQuery -> ShowS
$cshowsPrec :: Int -> BatchGetNamedQuery -> ShowS
Prelude.Show, forall x. Rep BatchGetNamedQuery x -> BatchGetNamedQuery
forall x. BatchGetNamedQuery -> Rep BatchGetNamedQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetNamedQuery x -> BatchGetNamedQuery
$cfrom :: forall x. BatchGetNamedQuery -> Rep BatchGetNamedQuery x
Prelude.Generic)
newBatchGetNamedQuery ::
Prelude.NonEmpty Prelude.Text ->
BatchGetNamedQuery
newBatchGetNamedQuery :: NonEmpty Text -> BatchGetNamedQuery
newBatchGetNamedQuery NonEmpty Text
pNamedQueryIds_ =
BatchGetNamedQuery'
{ $sel:namedQueryIds:BatchGetNamedQuery' :: NonEmpty Text
namedQueryIds =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pNamedQueryIds_
}
batchGetNamedQuery_namedQueryIds :: Lens.Lens' BatchGetNamedQuery (Prelude.NonEmpty Prelude.Text)
batchGetNamedQuery_namedQueryIds :: Lens' BatchGetNamedQuery (NonEmpty Text)
batchGetNamedQuery_namedQueryIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetNamedQuery' {NonEmpty Text
namedQueryIds :: NonEmpty Text
$sel:namedQueryIds:BatchGetNamedQuery' :: BatchGetNamedQuery -> NonEmpty Text
namedQueryIds} -> NonEmpty Text
namedQueryIds) (\s :: BatchGetNamedQuery
s@BatchGetNamedQuery' {} NonEmpty Text
a -> BatchGetNamedQuery
s {$sel:namedQueryIds:BatchGetNamedQuery' :: NonEmpty Text
namedQueryIds = NonEmpty Text
a} :: BatchGetNamedQuery) 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
instance Core.AWSRequest BatchGetNamedQuery where
type
AWSResponse BatchGetNamedQuery =
BatchGetNamedQueryResponse
request :: (Service -> Service)
-> BatchGetNamedQuery -> Request BatchGetNamedQuery
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 BatchGetNamedQuery
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchGetNamedQuery)))
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 [NamedQuery]
-> Maybe [UnprocessedNamedQueryId]
-> Int
-> BatchGetNamedQueryResponse
BatchGetNamedQueryResponse'
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
"NamedQueries" 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
"UnprocessedNamedQueryIds"
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 BatchGetNamedQuery where
hashWithSalt :: Int -> BatchGetNamedQuery -> Int
hashWithSalt Int
_salt BatchGetNamedQuery' {NonEmpty Text
namedQueryIds :: NonEmpty Text
$sel:namedQueryIds:BatchGetNamedQuery' :: BatchGetNamedQuery -> NonEmpty Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
namedQueryIds
instance Prelude.NFData BatchGetNamedQuery where
rnf :: BatchGetNamedQuery -> ()
rnf BatchGetNamedQuery' {NonEmpty Text
namedQueryIds :: NonEmpty Text
$sel:namedQueryIds:BatchGetNamedQuery' :: BatchGetNamedQuery -> NonEmpty Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
namedQueryIds
instance Data.ToHeaders BatchGetNamedQuery where
toHeaders :: BatchGetNamedQuery -> 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.BatchGetNamedQuery" ::
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 BatchGetNamedQuery where
toJSON :: BatchGetNamedQuery -> Value
toJSON BatchGetNamedQuery' {NonEmpty Text
namedQueryIds :: NonEmpty Text
$sel:namedQueryIds:BatchGetNamedQuery' :: BatchGetNamedQuery -> NonEmpty Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"NamedQueryIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
namedQueryIds)
]
)
instance Data.ToPath BatchGetNamedQuery where
toPath :: BatchGetNamedQuery -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchGetNamedQuery where
toQuery :: BatchGetNamedQuery -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetNamedQueryResponse = BatchGetNamedQueryResponse'
{
BatchGetNamedQueryResponse -> Maybe [NamedQuery]
namedQueries :: Prelude.Maybe [NamedQuery],
BatchGetNamedQueryResponse -> Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds :: Prelude.Maybe [UnprocessedNamedQueryId],
BatchGetNamedQueryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchGetNamedQueryResponse -> BatchGetNamedQueryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetNamedQueryResponse -> BatchGetNamedQueryResponse -> Bool
$c/= :: BatchGetNamedQueryResponse -> BatchGetNamedQueryResponse -> Bool
== :: BatchGetNamedQueryResponse -> BatchGetNamedQueryResponse -> Bool
$c== :: BatchGetNamedQueryResponse -> BatchGetNamedQueryResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetNamedQueryResponse]
ReadPrec BatchGetNamedQueryResponse
Int -> ReadS BatchGetNamedQueryResponse
ReadS [BatchGetNamedQueryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetNamedQueryResponse]
$creadListPrec :: ReadPrec [BatchGetNamedQueryResponse]
readPrec :: ReadPrec BatchGetNamedQueryResponse
$creadPrec :: ReadPrec BatchGetNamedQueryResponse
readList :: ReadS [BatchGetNamedQueryResponse]
$creadList :: ReadS [BatchGetNamedQueryResponse]
readsPrec :: Int -> ReadS BatchGetNamedQueryResponse
$creadsPrec :: Int -> ReadS BatchGetNamedQueryResponse
Prelude.Read, Int -> BatchGetNamedQueryResponse -> ShowS
[BatchGetNamedQueryResponse] -> ShowS
BatchGetNamedQueryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetNamedQueryResponse] -> ShowS
$cshowList :: [BatchGetNamedQueryResponse] -> ShowS
show :: BatchGetNamedQueryResponse -> String
$cshow :: BatchGetNamedQueryResponse -> String
showsPrec :: Int -> BatchGetNamedQueryResponse -> ShowS
$cshowsPrec :: Int -> BatchGetNamedQueryResponse -> ShowS
Prelude.Show, forall x.
Rep BatchGetNamedQueryResponse x -> BatchGetNamedQueryResponse
forall x.
BatchGetNamedQueryResponse -> Rep BatchGetNamedQueryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchGetNamedQueryResponse x -> BatchGetNamedQueryResponse
$cfrom :: forall x.
BatchGetNamedQueryResponse -> Rep BatchGetNamedQueryResponse x
Prelude.Generic)
newBatchGetNamedQueryResponse ::
Prelude.Int ->
BatchGetNamedQueryResponse
newBatchGetNamedQueryResponse :: Int -> BatchGetNamedQueryResponse
newBatchGetNamedQueryResponse Int
pHttpStatus_ =
BatchGetNamedQueryResponse'
{ $sel:namedQueries:BatchGetNamedQueryResponse' :: Maybe [NamedQuery]
namedQueries =
forall a. Maybe a
Prelude.Nothing,
$sel:unprocessedNamedQueryIds:BatchGetNamedQueryResponse' :: Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchGetNamedQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchGetNamedQueryResponse_namedQueries :: Lens.Lens' BatchGetNamedQueryResponse (Prelude.Maybe [NamedQuery])
batchGetNamedQueryResponse_namedQueries :: Lens' BatchGetNamedQueryResponse (Maybe [NamedQuery])
batchGetNamedQueryResponse_namedQueries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetNamedQueryResponse' {Maybe [NamedQuery]
namedQueries :: Maybe [NamedQuery]
$sel:namedQueries:BatchGetNamedQueryResponse' :: BatchGetNamedQueryResponse -> Maybe [NamedQuery]
namedQueries} -> Maybe [NamedQuery]
namedQueries) (\s :: BatchGetNamedQueryResponse
s@BatchGetNamedQueryResponse' {} Maybe [NamedQuery]
a -> BatchGetNamedQueryResponse
s {$sel:namedQueries:BatchGetNamedQueryResponse' :: Maybe [NamedQuery]
namedQueries = Maybe [NamedQuery]
a} :: BatchGetNamedQueryResponse) 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
batchGetNamedQueryResponse_unprocessedNamedQueryIds :: Lens.Lens' BatchGetNamedQueryResponse (Prelude.Maybe [UnprocessedNamedQueryId])
batchGetNamedQueryResponse_unprocessedNamedQueryIds :: Lens' BatchGetNamedQueryResponse (Maybe [UnprocessedNamedQueryId])
batchGetNamedQueryResponse_unprocessedNamedQueryIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetNamedQueryResponse' {Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds :: Maybe [UnprocessedNamedQueryId]
$sel:unprocessedNamedQueryIds:BatchGetNamedQueryResponse' :: BatchGetNamedQueryResponse -> Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds} -> Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds) (\s :: BatchGetNamedQueryResponse
s@BatchGetNamedQueryResponse' {} Maybe [UnprocessedNamedQueryId]
a -> BatchGetNamedQueryResponse
s {$sel:unprocessedNamedQueryIds:BatchGetNamedQueryResponse' :: Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds = Maybe [UnprocessedNamedQueryId]
a} :: BatchGetNamedQueryResponse) 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
batchGetNamedQueryResponse_httpStatus :: Lens.Lens' BatchGetNamedQueryResponse Prelude.Int
batchGetNamedQueryResponse_httpStatus :: Lens' BatchGetNamedQueryResponse Int
batchGetNamedQueryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetNamedQueryResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetNamedQueryResponse' :: BatchGetNamedQueryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetNamedQueryResponse
s@BatchGetNamedQueryResponse' {} Int
a -> BatchGetNamedQueryResponse
s {$sel:httpStatus:BatchGetNamedQueryResponse' :: Int
httpStatus = Int
a} :: BatchGetNamedQueryResponse)
instance Prelude.NFData BatchGetNamedQueryResponse where
rnf :: BatchGetNamedQueryResponse -> ()
rnf BatchGetNamedQueryResponse' {Int
Maybe [NamedQuery]
Maybe [UnprocessedNamedQueryId]
httpStatus :: Int
unprocessedNamedQueryIds :: Maybe [UnprocessedNamedQueryId]
namedQueries :: Maybe [NamedQuery]
$sel:httpStatus:BatchGetNamedQueryResponse' :: BatchGetNamedQueryResponse -> Int
$sel:unprocessedNamedQueryIds:BatchGetNamedQueryResponse' :: BatchGetNamedQueryResponse -> Maybe [UnprocessedNamedQueryId]
$sel:namedQueries:BatchGetNamedQueryResponse' :: BatchGetNamedQueryResponse -> Maybe [NamedQuery]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [NamedQuery]
namedQueries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [UnprocessedNamedQueryId]
unprocessedNamedQueryIds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus