{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AppMesh.ListRoutes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of existing routes in a service mesh.
--
-- This operation returns paginated results.
module Amazonka.AppMesh.ListRoutes
  ( -- * Creating a Request
    ListRoutes (..),
    newListRoutes,

    -- * Request Lenses
    listRoutes_limit,
    listRoutes_meshOwner,
    listRoutes_nextToken,
    listRoutes_meshName,
    listRoutes_virtualRouterName,

    -- * Destructuring the Response
    ListRoutesResponse (..),
    newListRoutesResponse,

    -- * Response Lenses
    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

-- |
--
-- /See:/ 'newListRoutes' smart constructor.
data ListRoutes = ListRoutes'
  { -- | The maximum number of results returned by @ListRoutes@ in paginated
    -- output. When you use this parameter, @ListRoutes@ returns only @limit@
    -- results in a single page along with a @nextToken@ response element. You
    -- can see the remaining results of the initial request by sending another
    -- @ListRoutes@ request with the returned @nextToken@ value. This value can
    -- be between 1 and 100. If you don\'t use this parameter, @ListRoutes@
    -- returns up to 100 results and a @nextToken@ value if applicable.
    ListRoutes -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Web Services IAM account ID of the service mesh owner. If the
    -- account ID is not your own, then it\'s the ID of the account that shared
    -- the mesh with your account. For more information about mesh sharing, see
    -- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
    ListRoutes -> Maybe Text
meshOwner :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a previous paginated @ListRoutes@
    -- request where @limit@ was used and the results exceeded the value of
    -- that parameter. Pagination continues from the end of the previous
    -- results that returned the @nextToken@ value.
    ListRoutes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the service mesh to list routes in.
    ListRoutes -> Text
meshName :: Prelude.Text,
    -- | The name of the virtual router to list routes in.
    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)

-- |
-- Create a value of 'ListRoutes' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'limit', 'listRoutes_limit' - The maximum number of results returned by @ListRoutes@ in paginated
-- output. When you use this parameter, @ListRoutes@ returns only @limit@
-- results in a single page along with a @nextToken@ response element. You
-- can see the remaining results of the initial request by sending another
-- @ListRoutes@ request with the returned @nextToken@ value. This value can
-- be between 1 and 100. If you don\'t use this parameter, @ListRoutes@
-- returns up to 100 results and a @nextToken@ value if applicable.
--
-- 'meshOwner', 'listRoutes_meshOwner' - The Amazon Web Services IAM account ID of the service mesh owner. If the
-- account ID is not your own, then it\'s the ID of the account that shared
-- the mesh with your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
--
-- 'nextToken', 'listRoutes_nextToken' - The @nextToken@ value returned from a previous paginated @ListRoutes@
-- request where @limit@ was used and the results exceeded the value of
-- that parameter. Pagination continues from the end of the previous
-- results that returned the @nextToken@ value.
--
-- 'meshName', 'listRoutes_meshName' - The name of the service mesh to list routes in.
--
-- 'virtualRouterName', 'listRoutes_virtualRouterName' - The name of the virtual router to list routes in.
newListRoutes ::
  -- | 'meshName'
  Prelude.Text ->
  -- | 'virtualRouterName'
  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_
    }

-- | The maximum number of results returned by @ListRoutes@ in paginated
-- output. When you use this parameter, @ListRoutes@ returns only @limit@
-- results in a single page along with a @nextToken@ response element. You
-- can see the remaining results of the initial request by sending another
-- @ListRoutes@ request with the returned @nextToken@ value. This value can
-- be between 1 and 100. If you don\'t use this parameter, @ListRoutes@
-- returns up to 100 results and a @nextToken@ value if applicable.
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)

-- | The Amazon Web Services IAM account ID of the service mesh owner. If the
-- account ID is not your own, then it\'s the ID of the account that shared
-- the mesh with your account. For more information about mesh sharing, see
-- <https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html Working with shared meshes>.
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)

-- | The @nextToken@ value returned from a previous paginated @ListRoutes@
-- request where @limit@ was used and the results exceeded the value of
-- that parameter. Pagination continues from the end of the previous
-- results that returned the @nextToken@ value.
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)

-- | The name of the service mesh to list routes in.
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)

-- | The name of the virtual router to list routes in.
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
      ]

-- |
--
-- /See:/ 'newListRoutesResponse' smart constructor.
data ListRoutesResponse = ListRoutesResponse'
  { -- | The @nextToken@ value to include in a future @ListRoutes@ request. When
    -- the results of a @ListRoutes@ request exceed @limit@, you can use this
    -- value to retrieve the next page of results. This value is @null@ when
    -- there are no more results to return.
    ListRoutesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListRoutesResponse -> Int
httpStatus :: Prelude.Int,
    -- | The list of existing routes for the specified service mesh and virtual
    -- router.
    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)

-- |
-- Create a value of 'ListRoutesResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listRoutesResponse_nextToken' - The @nextToken@ value to include in a future @ListRoutes@ request. When
-- the results of a @ListRoutes@ request exceed @limit@, you can use this
-- value to retrieve the next page of results. This value is @null@ when
-- there are no more results to return.
--
-- 'httpStatus', 'listRoutesResponse_httpStatus' - The response's http status code.
--
-- 'routes', 'listRoutesResponse_routes' - The list of existing routes for the specified service mesh and virtual
-- router.
newListRoutesResponse ::
  -- | 'httpStatus'
  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
    }

-- | The @nextToken@ value to include in a future @ListRoutes@ request. When
-- the results of a @ListRoutes@ request exceed @limit@, you can use this
-- value to retrieve the next page of results. This value is @null@ when
-- there are no more results to return.
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)

-- | The response's http status code.
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)

-- | The list of existing routes for the specified service mesh and virtual
-- router.
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