{-# 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.ListRoutes
(
ListRoutes (..),
newListRoutes,
listRoutes_limit,
listRoutes_meshOwner,
listRoutes_nextToken,
listRoutes_meshName,
listRoutes_virtualRouterName,
ListRoutesResponse (..),
newListRoutesResponse,
listRoutesResponse_nextToken,
listRoutesResponse_httpStatus,
listRoutesResponse_routes,
)
where
import Amazonka.AppMesh.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 ListRoutes = ListRoutes'
{
ListRoutes -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListRoutes -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
ListRoutes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListRoutes -> Text
meshName :: Prelude.Text,
ListRoutes -> Text
virtualRouterName :: Prelude.Text
}
deriving (ListRoutes -> ListRoutes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRoutes -> ListRoutes -> Bool
$c/= :: ListRoutes -> ListRoutes -> Bool
== :: ListRoutes -> ListRoutes -> Bool
$c== :: ListRoutes -> ListRoutes -> Bool
Prelude.Eq, ReadPrec [ListRoutes]
ReadPrec ListRoutes
Int -> ReadS ListRoutes
ReadS [ListRoutes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRoutes]
$creadListPrec :: ReadPrec [ListRoutes]
readPrec :: ReadPrec ListRoutes
$creadPrec :: ReadPrec ListRoutes
readList :: ReadS [ListRoutes]
$creadList :: ReadS [ListRoutes]
readsPrec :: Int -> ReadS ListRoutes
$creadsPrec :: Int -> ReadS ListRoutes
Prelude.Read, Int -> ListRoutes -> ShowS
[ListRoutes] -> ShowS
ListRoutes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRoutes] -> ShowS
$cshowList :: [ListRoutes] -> ShowS
show :: ListRoutes -> String
$cshow :: ListRoutes -> String
showsPrec :: Int -> ListRoutes -> ShowS
$cshowsPrec :: Int -> ListRoutes -> ShowS
Prelude.Show, forall x. Rep ListRoutes x -> ListRoutes
forall x. ListRoutes -> Rep ListRoutes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRoutes x -> ListRoutes
$cfrom :: forall x. ListRoutes -> Rep ListRoutes x
Prelude.Generic)
newListRoutes ::
Prelude.Text ->
Prelude.Text ->
ListRoutes
newListRoutes :: Text -> Text -> ListRoutes
newListRoutes Text
pMeshName_ Text
pVirtualRouterName_ =
ListRoutes'
{ $sel:limit:ListRoutes' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:meshOwner:ListRoutes' :: Maybe Text
meshOwner = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListRoutes' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:meshName:ListRoutes' :: Text
meshName = Text
pMeshName_,
$sel:virtualRouterName:ListRoutes' :: Text
virtualRouterName = Text
pVirtualRouterName_
}
listRoutes_limit :: Lens.Lens' ListRoutes (Prelude.Maybe Prelude.Natural)
listRoutes_limit :: Lens' ListRoutes (Maybe Natural)
listRoutes_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutes' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListRoutes' :: ListRoutes -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListRoutes
s@ListRoutes' {} Maybe Natural
a -> ListRoutes
s {$sel:limit:ListRoutes' :: Maybe Natural
limit = Maybe Natural
a} :: ListRoutes)
listRoutes_meshOwner :: Lens.Lens' ListRoutes (Prelude.Maybe Prelude.Text)
listRoutes_meshOwner :: Lens' ListRoutes (Maybe Text)
listRoutes_meshOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutes' {Maybe Text
meshOwner :: Maybe Text
$sel:meshOwner:ListRoutes' :: ListRoutes -> Maybe Text
meshOwner} -> Maybe Text
meshOwner) (\s :: ListRoutes
s@ListRoutes' {} Maybe Text
a -> ListRoutes
s {$sel:meshOwner:ListRoutes' :: Maybe Text
meshOwner = Maybe Text
a} :: ListRoutes)
listRoutes_nextToken :: Lens.Lens' ListRoutes (Prelude.Maybe Prelude.Text)
listRoutes_nextToken :: Lens' ListRoutes (Maybe Text)
listRoutes_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRoutes' :: ListRoutes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRoutes
s@ListRoutes' {} Maybe Text
a -> ListRoutes
s {$sel:nextToken:ListRoutes' :: Maybe Text
nextToken = Maybe Text
a} :: ListRoutes)
listRoutes_meshName :: Lens.Lens' ListRoutes Prelude.Text
listRoutes_meshName :: Lens' ListRoutes Text
listRoutes_meshName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutes' {Text
meshName :: Text
$sel:meshName:ListRoutes' :: ListRoutes -> Text
meshName} -> Text
meshName) (\s :: ListRoutes
s@ListRoutes' {} Text
a -> ListRoutes
s {$sel:meshName:ListRoutes' :: Text
meshName = Text
a} :: ListRoutes)
listRoutes_virtualRouterName :: Lens.Lens' ListRoutes Prelude.Text
listRoutes_virtualRouterName :: Lens' ListRoutes Text
listRoutes_virtualRouterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutes' {Text
virtualRouterName :: Text
$sel:virtualRouterName:ListRoutes' :: ListRoutes -> Text
virtualRouterName} -> Text
virtualRouterName) (\s :: ListRoutes
s@ListRoutes' {} Text
a -> ListRoutes
s {$sel:virtualRouterName:ListRoutes' :: Text
virtualRouterName = Text
a} :: ListRoutes)
instance Core.AWSPager ListRoutes where
page :: ListRoutes -> AWSResponse ListRoutes -> Maybe ListRoutes
page ListRoutes
rq AWSResponse ListRoutes
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListRoutes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRoutesResponse (Maybe Text)
listRoutesResponse_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 ListRoutes
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListRoutesResponse [RouteRef]
listRoutesResponse_routes) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListRoutes
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListRoutes (Maybe Text)
listRoutes_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRoutes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRoutesResponse (Maybe Text)
listRoutesResponse_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 ListRoutes where
type AWSResponse ListRoutes = ListRoutesResponse
request :: (Service -> Service) -> ListRoutes -> Request ListRoutes
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 ListRoutes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRoutes)))
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 -> [RouteRef] -> ListRoutesResponse
ListRoutesResponse'
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
"routes" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListRoutes where
hashWithSalt :: Int -> ListRoutes -> Int
hashWithSalt Int
_salt ListRoutes' {Maybe Natural
Maybe Text
Text
virtualRouterName :: Text
meshName :: Text
nextToken :: Maybe Text
meshOwner :: Maybe Text
limit :: Maybe Natural
$sel:virtualRouterName:ListRoutes' :: ListRoutes -> Text
$sel:meshName:ListRoutes' :: ListRoutes -> Text
$sel:nextToken:ListRoutes' :: ListRoutes -> Maybe Text
$sel:meshOwner:ListRoutes' :: ListRoutes -> Maybe Text
$sel:limit:ListRoutes' :: ListRoutes -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
meshOwner
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meshName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
virtualRouterName
instance Prelude.NFData ListRoutes where
rnf :: ListRoutes -> ()
rnf ListRoutes' {Maybe Natural
Maybe Text
Text
virtualRouterName :: Text
meshName :: Text
nextToken :: Maybe Text
meshOwner :: Maybe Text
limit :: Maybe Natural
$sel:virtualRouterName:ListRoutes' :: ListRoutes -> Text
$sel:meshName:ListRoutes' :: ListRoutes -> Text
$sel:nextToken:ListRoutes' :: ListRoutes -> Maybe Text
$sel:meshOwner:ListRoutes' :: ListRoutes -> Maybe Text
$sel:limit:ListRoutes' :: ListRoutes -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
meshOwner
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
meshName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
virtualRouterName
instance Data.ToHeaders ListRoutes where
toHeaders :: ListRoutes -> 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 ListRoutes where
toPath :: ListRoutes -> ByteString
toPath ListRoutes' {Maybe Natural
Maybe Text
Text
virtualRouterName :: Text
meshName :: Text
nextToken :: Maybe Text
meshOwner :: Maybe Text
limit :: Maybe Natural
$sel:virtualRouterName:ListRoutes' :: ListRoutes -> Text
$sel:meshName:ListRoutes' :: ListRoutes -> Text
$sel:nextToken:ListRoutes' :: ListRoutes -> Maybe Text
$sel:meshOwner:ListRoutes' :: ListRoutes -> Maybe Text
$sel:limit:ListRoutes' :: ListRoutes -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v20190125/meshes/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
meshName,
ByteString
"/virtualRouter/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
virtualRouterName,
ByteString
"/routes"
]
instance Data.ToQuery ListRoutes where
toQuery :: ListRoutes -> QueryString
toQuery ListRoutes' {Maybe Natural
Maybe Text
Text
virtualRouterName :: Text
meshName :: Text
nextToken :: Maybe Text
meshOwner :: Maybe Text
limit :: Maybe Natural
$sel:virtualRouterName:ListRoutes' :: ListRoutes -> Text
$sel:meshName:ListRoutes' :: ListRoutes -> Text
$sel:nextToken:ListRoutes' :: ListRoutes -> Maybe Text
$sel:meshOwner:ListRoutes' :: ListRoutes -> Maybe Text
$sel:limit:ListRoutes' :: ListRoutes -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"limit" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
limit,
ByteString
"meshOwner" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
meshOwner,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListRoutesResponse = ListRoutesResponse'
{
ListRoutesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListRoutesResponse -> Int
httpStatus :: Prelude.Int,
ListRoutesResponse -> [RouteRef]
routes :: [RouteRef]
}
deriving (ListRoutesResponse -> ListRoutesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRoutesResponse -> ListRoutesResponse -> Bool
$c/= :: ListRoutesResponse -> ListRoutesResponse -> Bool
== :: ListRoutesResponse -> ListRoutesResponse -> Bool
$c== :: ListRoutesResponse -> ListRoutesResponse -> Bool
Prelude.Eq, ReadPrec [ListRoutesResponse]
ReadPrec ListRoutesResponse
Int -> ReadS ListRoutesResponse
ReadS [ListRoutesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRoutesResponse]
$creadListPrec :: ReadPrec [ListRoutesResponse]
readPrec :: ReadPrec ListRoutesResponse
$creadPrec :: ReadPrec ListRoutesResponse
readList :: ReadS [ListRoutesResponse]
$creadList :: ReadS [ListRoutesResponse]
readsPrec :: Int -> ReadS ListRoutesResponse
$creadsPrec :: Int -> ReadS ListRoutesResponse
Prelude.Read, Int -> ListRoutesResponse -> ShowS
[ListRoutesResponse] -> ShowS
ListRoutesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRoutesResponse] -> ShowS
$cshowList :: [ListRoutesResponse] -> ShowS
show :: ListRoutesResponse -> String
$cshow :: ListRoutesResponse -> String
showsPrec :: Int -> ListRoutesResponse -> ShowS
$cshowsPrec :: Int -> ListRoutesResponse -> ShowS
Prelude.Show, forall x. Rep ListRoutesResponse x -> ListRoutesResponse
forall x. ListRoutesResponse -> Rep ListRoutesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRoutesResponse x -> ListRoutesResponse
$cfrom :: forall x. ListRoutesResponse -> Rep ListRoutesResponse x
Prelude.Generic)
newListRoutesResponse ::
Prelude.Int ->
ListRoutesResponse
newListRoutesResponse :: Int -> ListRoutesResponse
newListRoutesResponse Int
pHttpStatus_ =
ListRoutesResponse'
{ $sel:nextToken:ListRoutesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListRoutesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:routes:ListRoutesResponse' :: [RouteRef]
routes = forall a. Monoid a => a
Prelude.mempty
}
listRoutesResponse_nextToken :: Lens.Lens' ListRoutesResponse (Prelude.Maybe Prelude.Text)
listRoutesResponse_nextToken :: Lens' ListRoutesResponse (Maybe Text)
listRoutesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRoutesResponse' :: ListRoutesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRoutesResponse
s@ListRoutesResponse' {} Maybe Text
a -> ListRoutesResponse
s {$sel:nextToken:ListRoutesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRoutesResponse)
listRoutesResponse_httpStatus :: Lens.Lens' ListRoutesResponse Prelude.Int
listRoutesResponse_httpStatus :: Lens' ListRoutesResponse Int
listRoutesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListRoutesResponse' :: ListRoutesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListRoutesResponse
s@ListRoutesResponse' {} Int
a -> ListRoutesResponse
s {$sel:httpStatus:ListRoutesResponse' :: Int
httpStatus = Int
a} :: ListRoutesResponse)
listRoutesResponse_routes :: Lens.Lens' ListRoutesResponse [RouteRef]
listRoutesResponse_routes :: Lens' ListRoutesResponse [RouteRef]
listRoutesResponse_routes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoutesResponse' {[RouteRef]
routes :: [RouteRef]
$sel:routes:ListRoutesResponse' :: ListRoutesResponse -> [RouteRef]
routes} -> [RouteRef]
routes) (\s :: ListRoutesResponse
s@ListRoutesResponse' {} [RouteRef]
a -> ListRoutesResponse
s {$sel:routes:ListRoutesResponse' :: [RouteRef]
routes = [RouteRef]
a} :: ListRoutesResponse) 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 ListRoutesResponse where
rnf :: ListRoutesResponse -> ()
rnf ListRoutesResponse' {Int
[RouteRef]
Maybe Text
routes :: [RouteRef]
httpStatus :: Int
nextToken :: Maybe Text
$sel:routes:ListRoutesResponse' :: ListRoutesResponse -> [RouteRef]
$sel:httpStatus:ListRoutesResponse' :: ListRoutesResponse -> Int
$sel:nextToken:ListRoutesResponse' :: ListRoutesResponse -> 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 [RouteRef]
routes