{-# 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.ListDataCatalogs
(
ListDataCatalogs (..),
newListDataCatalogs,
listDataCatalogs_maxResults,
listDataCatalogs_nextToken,
ListDataCatalogsResponse (..),
newListDataCatalogsResponse,
listDataCatalogsResponse_dataCatalogsSummary,
listDataCatalogsResponse_nextToken,
listDataCatalogsResponse_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 ListDataCatalogs = ListDataCatalogs'
{
ListDataCatalogs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDataCatalogs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListDataCatalogs -> ListDataCatalogs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDataCatalogs -> ListDataCatalogs -> Bool
$c/= :: ListDataCatalogs -> ListDataCatalogs -> Bool
== :: ListDataCatalogs -> ListDataCatalogs -> Bool
$c== :: ListDataCatalogs -> ListDataCatalogs -> Bool
Prelude.Eq, ReadPrec [ListDataCatalogs]
ReadPrec ListDataCatalogs
Int -> ReadS ListDataCatalogs
ReadS [ListDataCatalogs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDataCatalogs]
$creadListPrec :: ReadPrec [ListDataCatalogs]
readPrec :: ReadPrec ListDataCatalogs
$creadPrec :: ReadPrec ListDataCatalogs
readList :: ReadS [ListDataCatalogs]
$creadList :: ReadS [ListDataCatalogs]
readsPrec :: Int -> ReadS ListDataCatalogs
$creadsPrec :: Int -> ReadS ListDataCatalogs
Prelude.Read, Int -> ListDataCatalogs -> ShowS
[ListDataCatalogs] -> ShowS
ListDataCatalogs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDataCatalogs] -> ShowS
$cshowList :: [ListDataCatalogs] -> ShowS
show :: ListDataCatalogs -> String
$cshow :: ListDataCatalogs -> String
showsPrec :: Int -> ListDataCatalogs -> ShowS
$cshowsPrec :: Int -> ListDataCatalogs -> ShowS
Prelude.Show, forall x. Rep ListDataCatalogs x -> ListDataCatalogs
forall x. ListDataCatalogs -> Rep ListDataCatalogs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDataCatalogs x -> ListDataCatalogs
$cfrom :: forall x. ListDataCatalogs -> Rep ListDataCatalogs x
Prelude.Generic)
newListDataCatalogs ::
ListDataCatalogs
newListDataCatalogs :: ListDataCatalogs
newListDataCatalogs =
ListDataCatalogs'
{ $sel:maxResults:ListDataCatalogs' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDataCatalogs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listDataCatalogs_maxResults :: Lens.Lens' ListDataCatalogs (Prelude.Maybe Prelude.Natural)
listDataCatalogs_maxResults :: Lens' ListDataCatalogs (Maybe Natural)
listDataCatalogs_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataCatalogs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDataCatalogs' :: ListDataCatalogs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDataCatalogs
s@ListDataCatalogs' {} Maybe Natural
a -> ListDataCatalogs
s {$sel:maxResults:ListDataCatalogs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDataCatalogs)
listDataCatalogs_nextToken :: Lens.Lens' ListDataCatalogs (Prelude.Maybe Prelude.Text)
listDataCatalogs_nextToken :: Lens' ListDataCatalogs (Maybe Text)
listDataCatalogs_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataCatalogs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDataCatalogs' :: ListDataCatalogs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDataCatalogs
s@ListDataCatalogs' {} Maybe Text
a -> ListDataCatalogs
s {$sel:nextToken:ListDataCatalogs' :: Maybe Text
nextToken = Maybe Text
a} :: ListDataCatalogs)
instance Core.AWSPager ListDataCatalogs where
page :: ListDataCatalogs
-> AWSResponse ListDataCatalogs -> Maybe ListDataCatalogs
page ListDataCatalogs
rq AWSResponse ListDataCatalogs
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDataCatalogs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDataCatalogsResponse (Maybe Text)
listDataCatalogsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDataCatalogs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDataCatalogsResponse (Maybe [DataCatalogSummary])
listDataCatalogsResponse_dataCatalogsSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListDataCatalogs
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDataCatalogs (Maybe Text)
listDataCatalogs_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDataCatalogs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDataCatalogsResponse (Maybe Text)
listDataCatalogsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListDataCatalogs where
type
AWSResponse ListDataCatalogs =
ListDataCatalogsResponse
request :: (Service -> Service)
-> ListDataCatalogs -> Request ListDataCatalogs
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 ListDataCatalogs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDataCatalogs)))
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 [DataCatalogSummary]
-> Maybe Text -> Int -> ListDataCatalogsResponse
ListDataCatalogsResponse'
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
"DataCatalogsSummary"
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
"NextToken")
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 ListDataCatalogs where
hashWithSalt :: Int -> ListDataCatalogs -> Int
hashWithSalt Int
_salt ListDataCatalogs' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDataCatalogs' :: ListDataCatalogs -> Maybe Text
$sel:maxResults:ListDataCatalogs' :: ListDataCatalogs -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListDataCatalogs where
rnf :: ListDataCatalogs -> ()
rnf ListDataCatalogs' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDataCatalogs' :: ListDataCatalogs -> Maybe Text
$sel:maxResults:ListDataCatalogs' :: ListDataCatalogs -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListDataCatalogs where
toHeaders :: ListDataCatalogs -> 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.ListDataCatalogs" ::
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 ListDataCatalogs where
toJSON :: ListDataCatalogs -> Value
toJSON ListDataCatalogs' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDataCatalogs' :: ListDataCatalogs -> Maybe Text
$sel:maxResults:ListDataCatalogs' :: ListDataCatalogs -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListDataCatalogs where
toPath :: ListDataCatalogs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListDataCatalogs where
toQuery :: ListDataCatalogs -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListDataCatalogsResponse = ListDataCatalogsResponse'
{
ListDataCatalogsResponse -> Maybe [DataCatalogSummary]
dataCatalogsSummary :: Prelude.Maybe [DataCatalogSummary],
ListDataCatalogsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDataCatalogsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDataCatalogsResponse -> ListDataCatalogsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDataCatalogsResponse -> ListDataCatalogsResponse -> Bool
$c/= :: ListDataCatalogsResponse -> ListDataCatalogsResponse -> Bool
== :: ListDataCatalogsResponse -> ListDataCatalogsResponse -> Bool
$c== :: ListDataCatalogsResponse -> ListDataCatalogsResponse -> Bool
Prelude.Eq, ReadPrec [ListDataCatalogsResponse]
ReadPrec ListDataCatalogsResponse
Int -> ReadS ListDataCatalogsResponse
ReadS [ListDataCatalogsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDataCatalogsResponse]
$creadListPrec :: ReadPrec [ListDataCatalogsResponse]
readPrec :: ReadPrec ListDataCatalogsResponse
$creadPrec :: ReadPrec ListDataCatalogsResponse
readList :: ReadS [ListDataCatalogsResponse]
$creadList :: ReadS [ListDataCatalogsResponse]
readsPrec :: Int -> ReadS ListDataCatalogsResponse
$creadsPrec :: Int -> ReadS ListDataCatalogsResponse
Prelude.Read, Int -> ListDataCatalogsResponse -> ShowS
[ListDataCatalogsResponse] -> ShowS
ListDataCatalogsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDataCatalogsResponse] -> ShowS
$cshowList :: [ListDataCatalogsResponse] -> ShowS
show :: ListDataCatalogsResponse -> String
$cshow :: ListDataCatalogsResponse -> String
showsPrec :: Int -> ListDataCatalogsResponse -> ShowS
$cshowsPrec :: Int -> ListDataCatalogsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDataCatalogsResponse x -> ListDataCatalogsResponse
forall x.
ListDataCatalogsResponse -> Rep ListDataCatalogsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDataCatalogsResponse x -> ListDataCatalogsResponse
$cfrom :: forall x.
ListDataCatalogsResponse -> Rep ListDataCatalogsResponse x
Prelude.Generic)
newListDataCatalogsResponse ::
Prelude.Int ->
ListDataCatalogsResponse
newListDataCatalogsResponse :: Int -> ListDataCatalogsResponse
newListDataCatalogsResponse Int
pHttpStatus_ =
ListDataCatalogsResponse'
{ $sel:dataCatalogsSummary:ListDataCatalogsResponse' :: Maybe [DataCatalogSummary]
dataCatalogsSummary =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDataCatalogsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDataCatalogsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDataCatalogsResponse_dataCatalogsSummary :: Lens.Lens' ListDataCatalogsResponse (Prelude.Maybe [DataCatalogSummary])
listDataCatalogsResponse_dataCatalogsSummary :: Lens' ListDataCatalogsResponse (Maybe [DataCatalogSummary])
listDataCatalogsResponse_dataCatalogsSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataCatalogsResponse' {Maybe [DataCatalogSummary]
dataCatalogsSummary :: Maybe [DataCatalogSummary]
$sel:dataCatalogsSummary:ListDataCatalogsResponse' :: ListDataCatalogsResponse -> Maybe [DataCatalogSummary]
dataCatalogsSummary} -> Maybe [DataCatalogSummary]
dataCatalogsSummary) (\s :: ListDataCatalogsResponse
s@ListDataCatalogsResponse' {} Maybe [DataCatalogSummary]
a -> ListDataCatalogsResponse
s {$sel:dataCatalogsSummary:ListDataCatalogsResponse' :: Maybe [DataCatalogSummary]
dataCatalogsSummary = Maybe [DataCatalogSummary]
a} :: ListDataCatalogsResponse) 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
listDataCatalogsResponse_nextToken :: Lens.Lens' ListDataCatalogsResponse (Prelude.Maybe Prelude.Text)
listDataCatalogsResponse_nextToken :: Lens' ListDataCatalogsResponse (Maybe Text)
listDataCatalogsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataCatalogsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDataCatalogsResponse' :: ListDataCatalogsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDataCatalogsResponse
s@ListDataCatalogsResponse' {} Maybe Text
a -> ListDataCatalogsResponse
s {$sel:nextToken:ListDataCatalogsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDataCatalogsResponse)
listDataCatalogsResponse_httpStatus :: Lens.Lens' ListDataCatalogsResponse Prelude.Int
listDataCatalogsResponse_httpStatus :: Lens' ListDataCatalogsResponse Int
listDataCatalogsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDataCatalogsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDataCatalogsResponse' :: ListDataCatalogsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDataCatalogsResponse
s@ListDataCatalogsResponse' {} Int
a -> ListDataCatalogsResponse
s {$sel:httpStatus:ListDataCatalogsResponse' :: Int
httpStatus = Int
a} :: ListDataCatalogsResponse)
instance Prelude.NFData ListDataCatalogsResponse where
rnf :: ListDataCatalogsResponse -> ()
rnf ListDataCatalogsResponse' {Int
Maybe [DataCatalogSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
dataCatalogsSummary :: Maybe [DataCatalogSummary]
$sel:httpStatus:ListDataCatalogsResponse' :: ListDataCatalogsResponse -> Int
$sel:nextToken:ListDataCatalogsResponse' :: ListDataCatalogsResponse -> Maybe Text
$sel:dataCatalogsSummary:ListDataCatalogsResponse' :: ListDataCatalogsResponse -> Maybe [DataCatalogSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DataCatalogSummary]
dataCatalogsSummary
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus