{-# 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.AppMesh.ListMeshes
(
ListMeshes (..),
newListMeshes,
listMeshes_nextToken,
listMeshes_limit,
ListMeshesResponse (..),
newListMeshesResponse,
listMeshesResponse_nextToken,
listMeshesResponse_httpStatus,
listMeshesResponse_meshes,
)
where
import Amazonka.AppMesh.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListMeshes = ListMeshes'
{
ListMeshes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMeshes -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
}
deriving (ListMeshes -> ListMeshes -> Bool
(ListMeshes -> ListMeshes -> Bool)
-> (ListMeshes -> ListMeshes -> Bool) -> Eq ListMeshes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMeshes -> ListMeshes -> Bool
$c/= :: ListMeshes -> ListMeshes -> Bool
== :: ListMeshes -> ListMeshes -> Bool
$c== :: ListMeshes -> ListMeshes -> Bool
Prelude.Eq, ReadPrec [ListMeshes]
ReadPrec ListMeshes
Int -> ReadS ListMeshes
ReadS [ListMeshes]
(Int -> ReadS ListMeshes)
-> ReadS [ListMeshes]
-> ReadPrec ListMeshes
-> ReadPrec [ListMeshes]
-> Read ListMeshes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMeshes]
$creadListPrec :: ReadPrec [ListMeshes]
readPrec :: ReadPrec ListMeshes
$creadPrec :: ReadPrec ListMeshes
readList :: ReadS [ListMeshes]
$creadList :: ReadS [ListMeshes]
readsPrec :: Int -> ReadS ListMeshes
$creadsPrec :: Int -> ReadS ListMeshes
Prelude.Read, Int -> ListMeshes -> ShowS
[ListMeshes] -> ShowS
ListMeshes -> String
(Int -> ListMeshes -> ShowS)
-> (ListMeshes -> String)
-> ([ListMeshes] -> ShowS)
-> Show ListMeshes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMeshes] -> ShowS
$cshowList :: [ListMeshes] -> ShowS
show :: ListMeshes -> String
$cshow :: ListMeshes -> String
showsPrec :: Int -> ListMeshes -> ShowS
$cshowsPrec :: Int -> ListMeshes -> ShowS
Prelude.Show, (forall x. ListMeshes -> Rep ListMeshes x)
-> (forall x. Rep ListMeshes x -> ListMeshes) -> Generic ListMeshes
forall x. Rep ListMeshes x -> ListMeshes
forall x. ListMeshes -> Rep ListMeshes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMeshes x -> ListMeshes
$cfrom :: forall x. ListMeshes -> Rep ListMeshes x
Prelude.Generic)
newListMeshes ::
ListMeshes
newListMeshes :: ListMeshes
newListMeshes =
ListMeshes' :: Maybe Text -> Maybe Natural -> ListMeshes
ListMeshes'
{ $sel:nextToken:ListMeshes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListMeshes' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listMeshes_nextToken :: Lens.Lens' ListMeshes (Prelude.Maybe Prelude.Text)
listMeshes_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListMeshes -> f ListMeshes
listMeshes_nextToken = (ListMeshes -> Maybe Text)
-> (ListMeshes -> Maybe Text -> ListMeshes)
-> Lens ListMeshes ListMeshes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeshes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMeshes' :: ListMeshes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMeshes
s@ListMeshes' {} Maybe Text
a -> ListMeshes
s {$sel:nextToken:ListMeshes' :: Maybe Text
nextToken = Maybe Text
a} :: ListMeshes)
listMeshes_limit :: Lens.Lens' ListMeshes (Prelude.Maybe Prelude.Natural)
listMeshes_limit :: (Maybe Natural -> f (Maybe Natural)) -> ListMeshes -> f ListMeshes
listMeshes_limit = (ListMeshes -> Maybe Natural)
-> (ListMeshes -> Maybe Natural -> ListMeshes)
-> Lens ListMeshes ListMeshes (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeshes' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListMeshes' :: ListMeshes -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListMeshes
s@ListMeshes' {} Maybe Natural
a -> ListMeshes
s {$sel:limit:ListMeshes' :: Maybe Natural
limit = Maybe Natural
a} :: ListMeshes)
instance Core.AWSPager ListMeshes where
page :: ListMeshes -> AWSResponse ListMeshes -> Maybe ListMeshes
page ListMeshes
rq AWSResponse ListMeshes
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListMeshes
ListMeshesResponse
rs
ListMeshesResponse
-> Getting (First Text) ListMeshesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListMeshesResponse -> Const (First Text) ListMeshesResponse
Lens' ListMeshesResponse (Maybe Text)
listMeshesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListMeshesResponse -> Const (First Text) ListMeshesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListMeshesResponse 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 ListMeshes
forall a. Maybe a
Prelude.Nothing
| [MeshRef] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListMeshes
ListMeshesResponse
rs ListMeshesResponse
-> Getting [MeshRef] ListMeshesResponse [MeshRef] -> [MeshRef]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [MeshRef] ListMeshesResponse [MeshRef]
Lens' ListMeshesResponse [MeshRef]
listMeshesResponse_meshes) =
Maybe ListMeshes
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListMeshes -> Maybe ListMeshes
forall a. a -> Maybe a
Prelude.Just (ListMeshes -> Maybe ListMeshes) -> ListMeshes -> Maybe ListMeshes
forall a b. (a -> b) -> a -> b
Prelude.$
ListMeshes
rq
ListMeshes -> (ListMeshes -> ListMeshes) -> ListMeshes
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListMeshes -> Identity ListMeshes
Lens ListMeshes ListMeshes (Maybe Text) (Maybe Text)
listMeshes_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListMeshes -> Identity ListMeshes)
-> Maybe Text -> ListMeshes -> ListMeshes
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListMeshes
ListMeshesResponse
rs
ListMeshesResponse
-> Getting (First Text) ListMeshesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListMeshesResponse -> Const (First Text) ListMeshesResponse
Lens' ListMeshesResponse (Maybe Text)
listMeshesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListMeshesResponse -> Const (First Text) ListMeshesResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListMeshesResponse 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 ListMeshes where
type AWSResponse ListMeshes = ListMeshesResponse
request :: ListMeshes -> Request ListMeshes
request = Service -> ListMeshes -> Request ListMeshes
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListMeshes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMeshes)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListMeshes))
-> Logger
-> Service
-> Proxy ListMeshes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMeshes)))
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 Text -> Int -> [MeshRef] -> ListMeshesResponse
ListMeshesResponse'
(Maybe Text -> Int -> [MeshRef] -> ListMeshesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [MeshRef] -> ListMeshesResponse)
forall (f :: * -> *) a b. Functor 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 -> [MeshRef] -> ListMeshesResponse)
-> Either String Int
-> Either String ([MeshRef] -> ListMeshesResponse)
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))
Either String ([MeshRef] -> ListMeshesResponse)
-> Either String [MeshRef] -> Either String ListMeshesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [MeshRef])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"meshes" Either String (Maybe [MeshRef])
-> [MeshRef] -> Either String [MeshRef]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [MeshRef]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListMeshes
instance Prelude.NFData ListMeshes
instance Core.ToHeaders ListMeshes where
toHeaders :: ListMeshes -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListMeshes -> 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 ListMeshes where
toPath :: ListMeshes -> ByteString
toPath = ByteString -> ListMeshes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v20190125/meshes"
instance Core.ToQuery ListMeshes where
toQuery :: ListMeshes -> QueryString
toQuery ListMeshes' {Maybe Natural
Maybe Text
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:limit:ListMeshes' :: ListMeshes -> Maybe Natural
$sel:nextToken:ListMeshes' :: ListMeshes -> 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
"limit" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
limit
]
data ListMeshesResponse = ListMeshesResponse'
{
ListMeshesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListMeshesResponse -> Int
httpStatus :: Prelude.Int,
ListMeshesResponse -> [MeshRef]
meshes :: [MeshRef]
}
deriving (ListMeshesResponse -> ListMeshesResponse -> Bool
(ListMeshesResponse -> ListMeshesResponse -> Bool)
-> (ListMeshesResponse -> ListMeshesResponse -> Bool)
-> Eq ListMeshesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMeshesResponse -> ListMeshesResponse -> Bool
$c/= :: ListMeshesResponse -> ListMeshesResponse -> Bool
== :: ListMeshesResponse -> ListMeshesResponse -> Bool
$c== :: ListMeshesResponse -> ListMeshesResponse -> Bool
Prelude.Eq, ReadPrec [ListMeshesResponse]
ReadPrec ListMeshesResponse
Int -> ReadS ListMeshesResponse
ReadS [ListMeshesResponse]
(Int -> ReadS ListMeshesResponse)
-> ReadS [ListMeshesResponse]
-> ReadPrec ListMeshesResponse
-> ReadPrec [ListMeshesResponse]
-> Read ListMeshesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMeshesResponse]
$creadListPrec :: ReadPrec [ListMeshesResponse]
readPrec :: ReadPrec ListMeshesResponse
$creadPrec :: ReadPrec ListMeshesResponse
readList :: ReadS [ListMeshesResponse]
$creadList :: ReadS [ListMeshesResponse]
readsPrec :: Int -> ReadS ListMeshesResponse
$creadsPrec :: Int -> ReadS ListMeshesResponse
Prelude.Read, Int -> ListMeshesResponse -> ShowS
[ListMeshesResponse] -> ShowS
ListMeshesResponse -> String
(Int -> ListMeshesResponse -> ShowS)
-> (ListMeshesResponse -> String)
-> ([ListMeshesResponse] -> ShowS)
-> Show ListMeshesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMeshesResponse] -> ShowS
$cshowList :: [ListMeshesResponse] -> ShowS
show :: ListMeshesResponse -> String
$cshow :: ListMeshesResponse -> String
showsPrec :: Int -> ListMeshesResponse -> ShowS
$cshowsPrec :: Int -> ListMeshesResponse -> ShowS
Prelude.Show, (forall x. ListMeshesResponse -> Rep ListMeshesResponse x)
-> (forall x. Rep ListMeshesResponse x -> ListMeshesResponse)
-> Generic ListMeshesResponse
forall x. Rep ListMeshesResponse x -> ListMeshesResponse
forall x. ListMeshesResponse -> Rep ListMeshesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMeshesResponse x -> ListMeshesResponse
$cfrom :: forall x. ListMeshesResponse -> Rep ListMeshesResponse x
Prelude.Generic)
newListMeshesResponse ::
Prelude.Int ->
ListMeshesResponse
newListMeshesResponse :: Int -> ListMeshesResponse
newListMeshesResponse Int
pHttpStatus_ =
ListMeshesResponse' :: Maybe Text -> Int -> [MeshRef] -> ListMeshesResponse
ListMeshesResponse'
{ $sel:nextToken:ListMeshesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListMeshesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:meshes:ListMeshesResponse' :: [MeshRef]
meshes = [MeshRef]
forall a. Monoid a => a
Prelude.mempty
}
listMeshesResponse_nextToken :: Lens.Lens' ListMeshesResponse (Prelude.Maybe Prelude.Text)
listMeshesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListMeshesResponse -> f ListMeshesResponse
listMeshesResponse_nextToken = (ListMeshesResponse -> Maybe Text)
-> (ListMeshesResponse -> Maybe Text -> ListMeshesResponse)
-> Lens' ListMeshesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeshesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMeshesResponse' :: ListMeshesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMeshesResponse
s@ListMeshesResponse' {} Maybe Text
a -> ListMeshesResponse
s {$sel:nextToken:ListMeshesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMeshesResponse)
listMeshesResponse_httpStatus :: Lens.Lens' ListMeshesResponse Prelude.Int
listMeshesResponse_httpStatus :: (Int -> f Int) -> ListMeshesResponse -> f ListMeshesResponse
listMeshesResponse_httpStatus = (ListMeshesResponse -> Int)
-> (ListMeshesResponse -> Int -> ListMeshesResponse)
-> Lens ListMeshesResponse ListMeshesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeshesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListMeshesResponse' :: ListMeshesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListMeshesResponse
s@ListMeshesResponse' {} Int
a -> ListMeshesResponse
s {$sel:httpStatus:ListMeshesResponse' :: Int
httpStatus = Int
a} :: ListMeshesResponse)
listMeshesResponse_meshes :: Lens.Lens' ListMeshesResponse [MeshRef]
listMeshesResponse_meshes :: ([MeshRef] -> f [MeshRef])
-> ListMeshesResponse -> f ListMeshesResponse
listMeshesResponse_meshes = (ListMeshesResponse -> [MeshRef])
-> (ListMeshesResponse -> [MeshRef] -> ListMeshesResponse)
-> Lens' ListMeshesResponse [MeshRef]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeshesResponse' {[MeshRef]
meshes :: [MeshRef]
$sel:meshes:ListMeshesResponse' :: ListMeshesResponse -> [MeshRef]
meshes} -> [MeshRef]
meshes) (\s :: ListMeshesResponse
s@ListMeshesResponse' {} [MeshRef]
a -> ListMeshesResponse
s {$sel:meshes:ListMeshesResponse' :: [MeshRef]
meshes = [MeshRef]
a} :: ListMeshesResponse) (([MeshRef] -> f [MeshRef])
-> ListMeshesResponse -> f ListMeshesResponse)
-> (([MeshRef] -> f [MeshRef]) -> [MeshRef] -> f [MeshRef])
-> ([MeshRef] -> f [MeshRef])
-> ListMeshesResponse
-> f ListMeshesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MeshRef] -> f [MeshRef]) -> [MeshRef] -> f [MeshRef]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListMeshesResponse