{-# 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.KeySpaces.ListKeyspaces
(
ListKeyspaces (..),
newListKeyspaces,
listKeyspaces_maxResults,
listKeyspaces_nextToken,
ListKeyspacesResponse (..),
newListKeyspacesResponse,
listKeyspacesResponse_nextToken,
listKeyspacesResponse_httpStatus,
listKeyspacesResponse_keyspaces,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KeySpaces.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListKeyspaces = ListKeyspaces'
{
ListKeyspaces -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListKeyspaces -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListKeyspaces -> ListKeyspaces -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeyspaces -> ListKeyspaces -> Bool
$c/= :: ListKeyspaces -> ListKeyspaces -> Bool
== :: ListKeyspaces -> ListKeyspaces -> Bool
$c== :: ListKeyspaces -> ListKeyspaces -> Bool
Prelude.Eq, ReadPrec [ListKeyspaces]
ReadPrec ListKeyspaces
Int -> ReadS ListKeyspaces
ReadS [ListKeyspaces]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeyspaces]
$creadListPrec :: ReadPrec [ListKeyspaces]
readPrec :: ReadPrec ListKeyspaces
$creadPrec :: ReadPrec ListKeyspaces
readList :: ReadS [ListKeyspaces]
$creadList :: ReadS [ListKeyspaces]
readsPrec :: Int -> ReadS ListKeyspaces
$creadsPrec :: Int -> ReadS ListKeyspaces
Prelude.Read, Int -> ListKeyspaces -> ShowS
[ListKeyspaces] -> ShowS
ListKeyspaces -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeyspaces] -> ShowS
$cshowList :: [ListKeyspaces] -> ShowS
show :: ListKeyspaces -> String
$cshow :: ListKeyspaces -> String
showsPrec :: Int -> ListKeyspaces -> ShowS
$cshowsPrec :: Int -> ListKeyspaces -> ShowS
Prelude.Show, forall x. Rep ListKeyspaces x -> ListKeyspaces
forall x. ListKeyspaces -> Rep ListKeyspaces x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListKeyspaces x -> ListKeyspaces
$cfrom :: forall x. ListKeyspaces -> Rep ListKeyspaces x
Prelude.Generic)
newListKeyspaces ::
ListKeyspaces
newListKeyspaces :: ListKeyspaces
newListKeyspaces =
ListKeyspaces'
{ $sel:maxResults:ListKeyspaces' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListKeyspaces' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listKeyspaces_maxResults :: Lens.Lens' ListKeyspaces (Prelude.Maybe Prelude.Natural)
listKeyspaces_maxResults :: Lens' ListKeyspaces (Maybe Natural)
listKeyspaces_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyspaces' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListKeyspaces' :: ListKeyspaces -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListKeyspaces
s@ListKeyspaces' {} Maybe Natural
a -> ListKeyspaces
s {$sel:maxResults:ListKeyspaces' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListKeyspaces)
listKeyspaces_nextToken :: Lens.Lens' ListKeyspaces (Prelude.Maybe Prelude.Text)
listKeyspaces_nextToken :: Lens' ListKeyspaces (Maybe Text)
listKeyspaces_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyspaces' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListKeyspaces' :: ListKeyspaces -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListKeyspaces
s@ListKeyspaces' {} Maybe Text
a -> ListKeyspaces
s {$sel:nextToken:ListKeyspaces' :: Maybe Text
nextToken = Maybe Text
a} :: ListKeyspaces)
instance Core.AWSPager ListKeyspaces where
page :: ListKeyspaces -> AWSResponse ListKeyspaces -> Maybe ListKeyspaces
page ListKeyspaces
rq AWSResponse ListKeyspaces
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListKeyspaces
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeyspacesResponse (Maybe Text)
listKeyspacesResponse_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 ListKeyspaces
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListKeyspacesResponse [KeyspaceSummary]
listKeyspacesResponse_keyspaces) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListKeyspaces
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListKeyspaces (Maybe Text)
listKeyspaces_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListKeyspaces
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeyspacesResponse (Maybe Text)
listKeyspacesResponse_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 ListKeyspaces where
type
AWSResponse ListKeyspaces =
ListKeyspacesResponse
request :: (Service -> Service) -> ListKeyspaces -> Request ListKeyspaces
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 ListKeyspaces
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListKeyspaces)))
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 Text -> Int -> [KeyspaceSummary] -> ListKeyspacesResponse
ListKeyspacesResponse'
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
"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))
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
"keyspaces" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListKeyspaces where
hashWithSalt :: Int -> ListKeyspaces -> Int
hashWithSalt Int
_salt ListKeyspaces' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListKeyspaces' :: ListKeyspaces -> Maybe Text
$sel:maxResults:ListKeyspaces' :: ListKeyspaces -> 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 ListKeyspaces where
rnf :: ListKeyspaces -> ()
rnf ListKeyspaces' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListKeyspaces' :: ListKeyspaces -> Maybe Text
$sel:maxResults:ListKeyspaces' :: ListKeyspaces -> 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 ListKeyspaces where
toHeaders :: ListKeyspaces -> 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
"KeyspacesService.ListKeyspaces" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListKeyspaces where
toJSON :: ListKeyspaces -> Value
toJSON ListKeyspaces' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListKeyspaces' :: ListKeyspaces -> Maybe Text
$sel:maxResults:ListKeyspaces' :: ListKeyspaces -> 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 ListKeyspaces where
toPath :: ListKeyspaces -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListKeyspaces where
toQuery :: ListKeyspaces -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListKeyspacesResponse = ListKeyspacesResponse'
{
ListKeyspacesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListKeyspacesResponse -> Int
httpStatus :: Prelude.Int,
ListKeyspacesResponse -> [KeyspaceSummary]
keyspaces :: [KeyspaceSummary]
}
deriving (ListKeyspacesResponse -> ListKeyspacesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeyspacesResponse -> ListKeyspacesResponse -> Bool
$c/= :: ListKeyspacesResponse -> ListKeyspacesResponse -> Bool
== :: ListKeyspacesResponse -> ListKeyspacesResponse -> Bool
$c== :: ListKeyspacesResponse -> ListKeyspacesResponse -> Bool
Prelude.Eq, ReadPrec [ListKeyspacesResponse]
ReadPrec ListKeyspacesResponse
Int -> ReadS ListKeyspacesResponse
ReadS [ListKeyspacesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeyspacesResponse]
$creadListPrec :: ReadPrec [ListKeyspacesResponse]
readPrec :: ReadPrec ListKeyspacesResponse
$creadPrec :: ReadPrec ListKeyspacesResponse
readList :: ReadS [ListKeyspacesResponse]
$creadList :: ReadS [ListKeyspacesResponse]
readsPrec :: Int -> ReadS ListKeyspacesResponse
$creadsPrec :: Int -> ReadS ListKeyspacesResponse
Prelude.Read, Int -> ListKeyspacesResponse -> ShowS
[ListKeyspacesResponse] -> ShowS
ListKeyspacesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeyspacesResponse] -> ShowS
$cshowList :: [ListKeyspacesResponse] -> ShowS
show :: ListKeyspacesResponse -> String
$cshow :: ListKeyspacesResponse -> String
showsPrec :: Int -> ListKeyspacesResponse -> ShowS
$cshowsPrec :: Int -> ListKeyspacesResponse -> ShowS
Prelude.Show, forall x. Rep ListKeyspacesResponse x -> ListKeyspacesResponse
forall x. ListKeyspacesResponse -> Rep ListKeyspacesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListKeyspacesResponse x -> ListKeyspacesResponse
$cfrom :: forall x. ListKeyspacesResponse -> Rep ListKeyspacesResponse x
Prelude.Generic)
newListKeyspacesResponse ::
Prelude.Int ->
ListKeyspacesResponse
newListKeyspacesResponse :: Int -> ListKeyspacesResponse
newListKeyspacesResponse Int
pHttpStatus_ =
ListKeyspacesResponse'
{ $sel:nextToken:ListKeyspacesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListKeyspacesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:keyspaces:ListKeyspacesResponse' :: [KeyspaceSummary]
keyspaces = forall a. Monoid a => a
Prelude.mempty
}
listKeyspacesResponse_nextToken :: Lens.Lens' ListKeyspacesResponse (Prelude.Maybe Prelude.Text)
listKeyspacesResponse_nextToken :: Lens' ListKeyspacesResponse (Maybe Text)
listKeyspacesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyspacesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListKeyspacesResponse' :: ListKeyspacesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListKeyspacesResponse
s@ListKeyspacesResponse' {} Maybe Text
a -> ListKeyspacesResponse
s {$sel:nextToken:ListKeyspacesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListKeyspacesResponse)
listKeyspacesResponse_httpStatus :: Lens.Lens' ListKeyspacesResponse Prelude.Int
listKeyspacesResponse_httpStatus :: Lens' ListKeyspacesResponse Int
listKeyspacesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyspacesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListKeyspacesResponse' :: ListKeyspacesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListKeyspacesResponse
s@ListKeyspacesResponse' {} Int
a -> ListKeyspacesResponse
s {$sel:httpStatus:ListKeyspacesResponse' :: Int
httpStatus = Int
a} :: ListKeyspacesResponse)
listKeyspacesResponse_keyspaces :: Lens.Lens' ListKeyspacesResponse [KeyspaceSummary]
listKeyspacesResponse_keyspaces :: Lens' ListKeyspacesResponse [KeyspaceSummary]
listKeyspacesResponse_keyspaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyspacesResponse' {[KeyspaceSummary]
keyspaces :: [KeyspaceSummary]
$sel:keyspaces:ListKeyspacesResponse' :: ListKeyspacesResponse -> [KeyspaceSummary]
keyspaces} -> [KeyspaceSummary]
keyspaces) (\s :: ListKeyspacesResponse
s@ListKeyspacesResponse' {} [KeyspaceSummary]
a -> ListKeyspacesResponse
s {$sel:keyspaces:ListKeyspacesResponse' :: [KeyspaceSummary]
keyspaces = [KeyspaceSummary]
a} :: ListKeyspacesResponse) 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 Prelude.NFData ListKeyspacesResponse where
rnf :: ListKeyspacesResponse -> ()
rnf ListKeyspacesResponse' {Int
[KeyspaceSummary]
Maybe Text
keyspaces :: [KeyspaceSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:keyspaces:ListKeyspacesResponse' :: ListKeyspacesResponse -> [KeyspaceSummary]
$sel:httpStatus:ListKeyspacesResponse' :: ListKeyspacesResponse -> Int
$sel:nextToken:ListKeyspacesResponse' :: ListKeyspacesResponse -> Maybe Text
..} =
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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [KeyspaceSummary]
keyspaces