{-# 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.Mobile.ListBundles
(
ListBundles (..),
newListBundles,
listBundles_nextToken,
listBundles_maxResults,
ListBundlesResponse (..),
newListBundlesResponse,
listBundlesResponse_bundleList,
listBundlesResponse_nextToken,
listBundlesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Mobile.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListBundles = ListBundles'
{
ListBundles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBundles -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
}
deriving (ListBundles -> ListBundles -> Bool
(ListBundles -> ListBundles -> Bool)
-> (ListBundles -> ListBundles -> Bool) -> Eq ListBundles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBundles -> ListBundles -> Bool
$c/= :: ListBundles -> ListBundles -> Bool
== :: ListBundles -> ListBundles -> Bool
$c== :: ListBundles -> ListBundles -> Bool
Prelude.Eq, ReadPrec [ListBundles]
ReadPrec ListBundles
Int -> ReadS ListBundles
ReadS [ListBundles]
(Int -> ReadS ListBundles)
-> ReadS [ListBundles]
-> ReadPrec ListBundles
-> ReadPrec [ListBundles]
-> Read ListBundles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBundles]
$creadListPrec :: ReadPrec [ListBundles]
readPrec :: ReadPrec ListBundles
$creadPrec :: ReadPrec ListBundles
readList :: ReadS [ListBundles]
$creadList :: ReadS [ListBundles]
readsPrec :: Int -> ReadS ListBundles
$creadsPrec :: Int -> ReadS ListBundles
Prelude.Read, Int -> ListBundles -> ShowS
[ListBundles] -> ShowS
ListBundles -> String
(Int -> ListBundles -> ShowS)
-> (ListBundles -> String)
-> ([ListBundles] -> ShowS)
-> Show ListBundles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBundles] -> ShowS
$cshowList :: [ListBundles] -> ShowS
show :: ListBundles -> String
$cshow :: ListBundles -> String
showsPrec :: Int -> ListBundles -> ShowS
$cshowsPrec :: Int -> ListBundles -> ShowS
Prelude.Show, (forall x. ListBundles -> Rep ListBundles x)
-> (forall x. Rep ListBundles x -> ListBundles)
-> Generic ListBundles
forall x. Rep ListBundles x -> ListBundles
forall x. ListBundles -> Rep ListBundles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBundles x -> ListBundles
$cfrom :: forall x. ListBundles -> Rep ListBundles x
Prelude.Generic)
newListBundles ::
ListBundles
newListBundles :: ListBundles
newListBundles =
ListBundles' :: Maybe Text -> Maybe Int -> ListBundles
ListBundles'
{ $sel:nextToken:ListBundles' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListBundles' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
listBundles_nextToken :: Lens.Lens' ListBundles (Prelude.Maybe Prelude.Text)
listBundles_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListBundles -> f ListBundles
listBundles_nextToken = (ListBundles -> Maybe Text)
-> (ListBundles -> Maybe Text -> ListBundles)
-> Lens ListBundles ListBundles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBundles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBundles' :: ListBundles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBundles
s@ListBundles' {} Maybe Text
a -> ListBundles
s {$sel:nextToken:ListBundles' :: Maybe Text
nextToken = Maybe Text
a} :: ListBundles)
listBundles_maxResults :: Lens.Lens' ListBundles (Prelude.Maybe Prelude.Int)
listBundles_maxResults :: (Maybe Int -> f (Maybe Int)) -> ListBundles -> f ListBundles
listBundles_maxResults = (ListBundles -> Maybe Int)
-> (ListBundles -> Maybe Int -> ListBundles)
-> Lens ListBundles ListBundles (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBundles' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListBundles' :: ListBundles -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListBundles
s@ListBundles' {} Maybe Int
a -> ListBundles
s {$sel:maxResults:ListBundles' :: Maybe Int
maxResults = Maybe Int
a} :: ListBundles)
instance Core.AWSPager ListBundles where
page :: ListBundles -> AWSResponse ListBundles -> Maybe ListBundles
page ListBundles
rq AWSResponse ListBundles
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListBundles
ListBundlesResponse
rs
ListBundlesResponse
-> Getting (First Text) ListBundlesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBundlesResponse -> Const (First Text) ListBundlesResponse
Lens' ListBundlesResponse (Maybe Text)
listBundlesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListBundlesResponse -> Const (First Text) ListBundlesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBundlesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListBundles
forall a. Maybe a
Prelude.Nothing
| Maybe [BundleDetails] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListBundles
ListBundlesResponse
rs
ListBundlesResponse
-> Getting
(First [BundleDetails]) ListBundlesResponse [BundleDetails]
-> Maybe [BundleDetails]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [BundleDetails]
-> Const (First [BundleDetails]) (Maybe [BundleDetails]))
-> ListBundlesResponse
-> Const (First [BundleDetails]) ListBundlesResponse
Lens' ListBundlesResponse (Maybe [BundleDetails])
listBundlesResponse_bundleList ((Maybe [BundleDetails]
-> Const (First [BundleDetails]) (Maybe [BundleDetails]))
-> ListBundlesResponse
-> Const (First [BundleDetails]) ListBundlesResponse)
-> (([BundleDetails]
-> Const (First [BundleDetails]) [BundleDetails])
-> Maybe [BundleDetails]
-> Const (First [BundleDetails]) (Maybe [BundleDetails]))
-> Getting
(First [BundleDetails]) ListBundlesResponse [BundleDetails]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BundleDetails] -> Const (First [BundleDetails]) [BundleDetails])
-> Maybe [BundleDetails]
-> Const (First [BundleDetails]) (Maybe [BundleDetails])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListBundles
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListBundles -> Maybe ListBundles
forall a. a -> Maybe a
Prelude.Just (ListBundles -> Maybe ListBundles)
-> ListBundles -> Maybe ListBundles
forall a b. (a -> b) -> a -> b
Prelude.$
ListBundles
rq
ListBundles -> (ListBundles -> ListBundles) -> ListBundles
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListBundles -> Identity ListBundles
Lens ListBundles ListBundles (Maybe Text) (Maybe Text)
listBundles_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListBundles -> Identity ListBundles)
-> Maybe Text -> ListBundles -> ListBundles
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBundles
ListBundlesResponse
rs
ListBundlesResponse
-> Getting (First Text) ListBundlesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListBundlesResponse -> Const (First Text) ListBundlesResponse
Lens' ListBundlesResponse (Maybe Text)
listBundlesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListBundlesResponse -> Const (First Text) ListBundlesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListBundlesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListBundles where
type AWSResponse ListBundles = ListBundlesResponse
request :: ListBundles -> Request ListBundles
request = Service -> ListBundles -> Request ListBundles
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListBundles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBundles)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListBundles))
-> Logger
-> Service
-> Proxy ListBundles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBundles)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [BundleDetails] -> Maybe Text -> Int -> ListBundlesResponse
ListBundlesResponse'
(Maybe [BundleDetails] -> Maybe Text -> Int -> ListBundlesResponse)
-> Either String (Maybe [BundleDetails])
-> Either String (Maybe Text -> Int -> ListBundlesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [BundleDetails]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"bundleList" Either String (Maybe (Maybe [BundleDetails]))
-> Maybe [BundleDetails] -> Either String (Maybe [BundleDetails])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BundleDetails]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListBundlesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListBundlesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either String (Int -> ListBundlesResponse)
-> Either String Int -> Either String ListBundlesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListBundles
instance Prelude.NFData ListBundles
instance Core.ToHeaders ListBundles where
toHeaders :: ListBundles -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListBundles -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath ListBundles where
toPath :: ListBundles -> ByteString
toPath = ByteString -> ListBundles -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/bundles"
instance Core.ToQuery ListBundles where
toQuery :: ListBundles -> QueryString
toQuery ListBundles' {Maybe Int
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
$sel:maxResults:ListBundles' :: ListBundles -> Maybe Int
$sel:nextToken:ListBundles' :: ListBundles -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxResults
]
data ListBundlesResponse = ListBundlesResponse'
{
ListBundlesResponse -> Maybe [BundleDetails]
bundleList :: Prelude.Maybe [BundleDetails],
ListBundlesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBundlesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListBundlesResponse -> ListBundlesResponse -> Bool
(ListBundlesResponse -> ListBundlesResponse -> Bool)
-> (ListBundlesResponse -> ListBundlesResponse -> Bool)
-> Eq ListBundlesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBundlesResponse -> ListBundlesResponse -> Bool
$c/= :: ListBundlesResponse -> ListBundlesResponse -> Bool
== :: ListBundlesResponse -> ListBundlesResponse -> Bool
$c== :: ListBundlesResponse -> ListBundlesResponse -> Bool
Prelude.Eq, ReadPrec [ListBundlesResponse]
ReadPrec ListBundlesResponse
Int -> ReadS ListBundlesResponse
ReadS [ListBundlesResponse]
(Int -> ReadS ListBundlesResponse)
-> ReadS [ListBundlesResponse]
-> ReadPrec ListBundlesResponse
-> ReadPrec [ListBundlesResponse]
-> Read ListBundlesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBundlesResponse]
$creadListPrec :: ReadPrec [ListBundlesResponse]
readPrec :: ReadPrec ListBundlesResponse
$creadPrec :: ReadPrec ListBundlesResponse
readList :: ReadS [ListBundlesResponse]
$creadList :: ReadS [ListBundlesResponse]
readsPrec :: Int -> ReadS ListBundlesResponse
$creadsPrec :: Int -> ReadS ListBundlesResponse
Prelude.Read, Int -> ListBundlesResponse -> ShowS
[ListBundlesResponse] -> ShowS
ListBundlesResponse -> String
(Int -> ListBundlesResponse -> ShowS)
-> (ListBundlesResponse -> String)
-> ([ListBundlesResponse] -> ShowS)
-> Show ListBundlesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBundlesResponse] -> ShowS
$cshowList :: [ListBundlesResponse] -> ShowS
show :: ListBundlesResponse -> String
$cshow :: ListBundlesResponse -> String
showsPrec :: Int -> ListBundlesResponse -> ShowS
$cshowsPrec :: Int -> ListBundlesResponse -> ShowS
Prelude.Show, (forall x. ListBundlesResponse -> Rep ListBundlesResponse x)
-> (forall x. Rep ListBundlesResponse x -> ListBundlesResponse)
-> Generic ListBundlesResponse
forall x. Rep ListBundlesResponse x -> ListBundlesResponse
forall x. ListBundlesResponse -> Rep ListBundlesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBundlesResponse x -> ListBundlesResponse
$cfrom :: forall x. ListBundlesResponse -> Rep ListBundlesResponse x
Prelude.Generic)
newListBundlesResponse ::
Prelude.Int ->
ListBundlesResponse
newListBundlesResponse :: Int -> ListBundlesResponse
newListBundlesResponse Int
pHttpStatus_ =
ListBundlesResponse' :: Maybe [BundleDetails] -> Maybe Text -> Int -> ListBundlesResponse
ListBundlesResponse'
{ $sel:bundleList:ListBundlesResponse' :: Maybe [BundleDetails]
bundleList = Maybe [BundleDetails]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListBundlesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListBundlesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listBundlesResponse_bundleList :: Lens.Lens' ListBundlesResponse (Prelude.Maybe [BundleDetails])
listBundlesResponse_bundleList :: (Maybe [BundleDetails] -> f (Maybe [BundleDetails]))
-> ListBundlesResponse -> f ListBundlesResponse
listBundlesResponse_bundleList = (ListBundlesResponse -> Maybe [BundleDetails])
-> (ListBundlesResponse
-> Maybe [BundleDetails] -> ListBundlesResponse)
-> Lens' ListBundlesResponse (Maybe [BundleDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBundlesResponse' {Maybe [BundleDetails]
bundleList :: Maybe [BundleDetails]
$sel:bundleList:ListBundlesResponse' :: ListBundlesResponse -> Maybe [BundleDetails]
bundleList} -> Maybe [BundleDetails]
bundleList) (\s :: ListBundlesResponse
s@ListBundlesResponse' {} Maybe [BundleDetails]
a -> ListBundlesResponse
s {$sel:bundleList:ListBundlesResponse' :: Maybe [BundleDetails]
bundleList = Maybe [BundleDetails]
a} :: ListBundlesResponse) ((Maybe [BundleDetails] -> f (Maybe [BundleDetails]))
-> ListBundlesResponse -> f ListBundlesResponse)
-> ((Maybe [BundleDetails] -> f (Maybe [BundleDetails]))
-> Maybe [BundleDetails] -> f (Maybe [BundleDetails]))
-> (Maybe [BundleDetails] -> f (Maybe [BundleDetails]))
-> ListBundlesResponse
-> f ListBundlesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[BundleDetails] [BundleDetails] [BundleDetails] [BundleDetails]
-> Iso
(Maybe [BundleDetails])
(Maybe [BundleDetails])
(Maybe [BundleDetails])
(Maybe [BundleDetails])
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 AnIso
[BundleDetails] [BundleDetails] [BundleDetails] [BundleDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listBundlesResponse_nextToken :: Lens.Lens' ListBundlesResponse (Prelude.Maybe Prelude.Text)
listBundlesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBundlesResponse -> f ListBundlesResponse
listBundlesResponse_nextToken = (ListBundlesResponse -> Maybe Text)
-> (ListBundlesResponse -> Maybe Text -> ListBundlesResponse)
-> Lens' ListBundlesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBundlesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBundlesResponse' :: ListBundlesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBundlesResponse
s@ListBundlesResponse' {} Maybe Text
a -> ListBundlesResponse
s {$sel:nextToken:ListBundlesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBundlesResponse)
listBundlesResponse_httpStatus :: Lens.Lens' ListBundlesResponse Prelude.Int
listBundlesResponse_httpStatus :: (Int -> f Int) -> ListBundlesResponse -> f ListBundlesResponse
listBundlesResponse_httpStatus = (ListBundlesResponse -> Int)
-> (ListBundlesResponse -> Int -> ListBundlesResponse)
-> Lens ListBundlesResponse ListBundlesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBundlesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListBundlesResponse' :: ListBundlesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListBundlesResponse
s@ListBundlesResponse' {} Int
a -> ListBundlesResponse
s {$sel:httpStatus:ListBundlesResponse' :: Int
httpStatus = Int
a} :: ListBundlesResponse)
instance Prelude.NFData ListBundlesResponse