{-# 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.AppSync.ListApiKeys
(
ListApiKeys (..),
newListApiKeys,
listApiKeys_maxResults,
listApiKeys_nextToken,
listApiKeys_apiId,
ListApiKeysResponse (..),
newListApiKeysResponse,
listApiKeysResponse_apiKeys,
listApiKeysResponse_nextToken,
listApiKeysResponse_httpStatus,
)
where
import Amazonka.AppSync.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 ListApiKeys = ListApiKeys'
{
ListApiKeys -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListApiKeys -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListApiKeys -> Text
apiId :: Prelude.Text
}
deriving (ListApiKeys -> ListApiKeys -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListApiKeys -> ListApiKeys -> Bool
$c/= :: ListApiKeys -> ListApiKeys -> Bool
== :: ListApiKeys -> ListApiKeys -> Bool
$c== :: ListApiKeys -> ListApiKeys -> Bool
Prelude.Eq, ReadPrec [ListApiKeys]
ReadPrec ListApiKeys
Int -> ReadS ListApiKeys
ReadS [ListApiKeys]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListApiKeys]
$creadListPrec :: ReadPrec [ListApiKeys]
readPrec :: ReadPrec ListApiKeys
$creadPrec :: ReadPrec ListApiKeys
readList :: ReadS [ListApiKeys]
$creadList :: ReadS [ListApiKeys]
readsPrec :: Int -> ReadS ListApiKeys
$creadsPrec :: Int -> ReadS ListApiKeys
Prelude.Read, Int -> ListApiKeys -> ShowS
[ListApiKeys] -> ShowS
ListApiKeys -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListApiKeys] -> ShowS
$cshowList :: [ListApiKeys] -> ShowS
show :: ListApiKeys -> String
$cshow :: ListApiKeys -> String
showsPrec :: Int -> ListApiKeys -> ShowS
$cshowsPrec :: Int -> ListApiKeys -> ShowS
Prelude.Show, forall x. Rep ListApiKeys x -> ListApiKeys
forall x. ListApiKeys -> Rep ListApiKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListApiKeys x -> ListApiKeys
$cfrom :: forall x. ListApiKeys -> Rep ListApiKeys x
Prelude.Generic)
newListApiKeys ::
Prelude.Text ->
ListApiKeys
newListApiKeys :: Text -> ListApiKeys
newListApiKeys Text
pApiId_ =
ListApiKeys'
{ $sel:maxResults:ListApiKeys' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListApiKeys' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:apiId:ListApiKeys' :: Text
apiId = Text
pApiId_
}
listApiKeys_maxResults :: Lens.Lens' ListApiKeys (Prelude.Maybe Prelude.Natural)
listApiKeys_maxResults :: Lens' ListApiKeys (Maybe Natural)
listApiKeys_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApiKeys' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListApiKeys' :: ListApiKeys -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListApiKeys
s@ListApiKeys' {} Maybe Natural
a -> ListApiKeys
s {$sel:maxResults:ListApiKeys' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListApiKeys)
listApiKeys_nextToken :: Lens.Lens' ListApiKeys (Prelude.Maybe Prelude.Text)
listApiKeys_nextToken :: Lens' ListApiKeys (Maybe Text)
listApiKeys_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApiKeys' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListApiKeys' :: ListApiKeys -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListApiKeys
s@ListApiKeys' {} Maybe Text
a -> ListApiKeys
s {$sel:nextToken:ListApiKeys' :: Maybe Text
nextToken = Maybe Text
a} :: ListApiKeys)
listApiKeys_apiId :: Lens.Lens' ListApiKeys Prelude.Text
listApiKeys_apiId :: Lens' ListApiKeys Text
listApiKeys_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApiKeys' {Text
apiId :: Text
$sel:apiId:ListApiKeys' :: ListApiKeys -> Text
apiId} -> Text
apiId) (\s :: ListApiKeys
s@ListApiKeys' {} Text
a -> ListApiKeys
s {$sel:apiId:ListApiKeys' :: Text
apiId = Text
a} :: ListApiKeys)
instance Core.AWSPager ListApiKeys where
page :: ListApiKeys -> AWSResponse ListApiKeys -> Maybe ListApiKeys
page ListApiKeys
rq AWSResponse ListApiKeys
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListApiKeys
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListApiKeysResponse (Maybe Text)
listApiKeysResponse_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 ListApiKeys
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListApiKeysResponse (Maybe [ApiKey])
listApiKeysResponse_apiKeys
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.$ ListApiKeys
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListApiKeys (Maybe Text)
listApiKeys_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListApiKeys
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListApiKeysResponse (Maybe Text)
listApiKeysResponse_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 ListApiKeys where
type AWSResponse ListApiKeys = ListApiKeysResponse
request :: (Service -> Service) -> ListApiKeys -> Request ListApiKeys
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListApiKeys
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListApiKeys)))
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 [ApiKey] -> Maybe Text -> Int -> ListApiKeysResponse
ListApiKeysResponse'
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
"apiKeys" 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 ListApiKeys where
hashWithSalt :: Int -> ListApiKeys -> Int
hashWithSalt Int
_salt ListApiKeys' {Maybe Natural
Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:apiId:ListApiKeys' :: ListApiKeys -> Text
$sel:nextToken:ListApiKeys' :: ListApiKeys -> Maybe Text
$sel:maxResults:ListApiKeys' :: ListApiKeys -> 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
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
instance Prelude.NFData ListApiKeys where
rnf :: ListApiKeys -> ()
rnf ListApiKeys' {Maybe Natural
Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:apiId:ListApiKeys' :: ListApiKeys -> Text
$sel:nextToken:ListApiKeys' :: ListApiKeys -> Maybe Text
$sel:maxResults:ListApiKeys' :: ListApiKeys -> 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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
apiId
instance Data.ToHeaders ListApiKeys where
toHeaders :: ListApiKeys -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListApiKeys where
toPath :: ListApiKeys -> ByteString
toPath ListApiKeys' {Maybe Natural
Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:apiId:ListApiKeys' :: ListApiKeys -> Text
$sel:nextToken:ListApiKeys' :: ListApiKeys -> Maybe Text
$sel:maxResults:ListApiKeys' :: ListApiKeys -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/apikeys"]
instance Data.ToQuery ListApiKeys where
toQuery :: ListApiKeys -> QueryString
toQuery ListApiKeys' {Maybe Natural
Maybe Text
Text
apiId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:apiId:ListApiKeys' :: ListApiKeys -> Text
$sel:nextToken:ListApiKeys' :: ListApiKeys -> Maybe Text
$sel:maxResults:ListApiKeys' :: ListApiKeys -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListApiKeysResponse = ListApiKeysResponse'
{
ListApiKeysResponse -> Maybe [ApiKey]
apiKeys :: Prelude.Maybe [ApiKey],
ListApiKeysResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListApiKeysResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListApiKeysResponse -> ListApiKeysResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListApiKeysResponse -> ListApiKeysResponse -> Bool
$c/= :: ListApiKeysResponse -> ListApiKeysResponse -> Bool
== :: ListApiKeysResponse -> ListApiKeysResponse -> Bool
$c== :: ListApiKeysResponse -> ListApiKeysResponse -> Bool
Prelude.Eq, ReadPrec [ListApiKeysResponse]
ReadPrec ListApiKeysResponse
Int -> ReadS ListApiKeysResponse
ReadS [ListApiKeysResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListApiKeysResponse]
$creadListPrec :: ReadPrec [ListApiKeysResponse]
readPrec :: ReadPrec ListApiKeysResponse
$creadPrec :: ReadPrec ListApiKeysResponse
readList :: ReadS [ListApiKeysResponse]
$creadList :: ReadS [ListApiKeysResponse]
readsPrec :: Int -> ReadS ListApiKeysResponse
$creadsPrec :: Int -> ReadS ListApiKeysResponse
Prelude.Read, Int -> ListApiKeysResponse -> ShowS
[ListApiKeysResponse] -> ShowS
ListApiKeysResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListApiKeysResponse] -> ShowS
$cshowList :: [ListApiKeysResponse] -> ShowS
show :: ListApiKeysResponse -> String
$cshow :: ListApiKeysResponse -> String
showsPrec :: Int -> ListApiKeysResponse -> ShowS
$cshowsPrec :: Int -> ListApiKeysResponse -> ShowS
Prelude.Show, forall x. Rep ListApiKeysResponse x -> ListApiKeysResponse
forall x. ListApiKeysResponse -> Rep ListApiKeysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListApiKeysResponse x -> ListApiKeysResponse
$cfrom :: forall x. ListApiKeysResponse -> Rep ListApiKeysResponse x
Prelude.Generic)
newListApiKeysResponse ::
Prelude.Int ->
ListApiKeysResponse
newListApiKeysResponse :: Int -> ListApiKeysResponse
newListApiKeysResponse Int
pHttpStatus_ =
ListApiKeysResponse'
{ $sel:apiKeys:ListApiKeysResponse' :: Maybe [ApiKey]
apiKeys = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListApiKeysResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListApiKeysResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listApiKeysResponse_apiKeys :: Lens.Lens' ListApiKeysResponse (Prelude.Maybe [ApiKey])
listApiKeysResponse_apiKeys :: Lens' ListApiKeysResponse (Maybe [ApiKey])
listApiKeysResponse_apiKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApiKeysResponse' {Maybe [ApiKey]
apiKeys :: Maybe [ApiKey]
$sel:apiKeys:ListApiKeysResponse' :: ListApiKeysResponse -> Maybe [ApiKey]
apiKeys} -> Maybe [ApiKey]
apiKeys) (\s :: ListApiKeysResponse
s@ListApiKeysResponse' {} Maybe [ApiKey]
a -> ListApiKeysResponse
s {$sel:apiKeys:ListApiKeysResponse' :: Maybe [ApiKey]
apiKeys = Maybe [ApiKey]
a} :: ListApiKeysResponse) 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
listApiKeysResponse_nextToken :: Lens.Lens' ListApiKeysResponse (Prelude.Maybe Prelude.Text)
listApiKeysResponse_nextToken :: Lens' ListApiKeysResponse (Maybe Text)
listApiKeysResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApiKeysResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListApiKeysResponse' :: ListApiKeysResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListApiKeysResponse
s@ListApiKeysResponse' {} Maybe Text
a -> ListApiKeysResponse
s {$sel:nextToken:ListApiKeysResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListApiKeysResponse)
listApiKeysResponse_httpStatus :: Lens.Lens' ListApiKeysResponse Prelude.Int
listApiKeysResponse_httpStatus :: Lens' ListApiKeysResponse Int
listApiKeysResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApiKeysResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListApiKeysResponse' :: ListApiKeysResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListApiKeysResponse
s@ListApiKeysResponse' {} Int
a -> ListApiKeysResponse
s {$sel:httpStatus:ListApiKeysResponse' :: Int
httpStatus = Int
a} :: ListApiKeysResponse)
instance Prelude.NFData ListApiKeysResponse where
rnf :: ListApiKeysResponse -> ()
rnf ListApiKeysResponse' {Int
Maybe [ApiKey]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
apiKeys :: Maybe [ApiKey]
$sel:httpStatus:ListApiKeysResponse' :: ListApiKeysResponse -> Int
$sel:nextToken:ListApiKeysResponse' :: ListApiKeysResponse -> Maybe Text
$sel:apiKeys:ListApiKeysResponse' :: ListApiKeysResponse -> Maybe [ApiKey]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ApiKey]
apiKeys
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