{-# 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.EC2.SearchLocalGatewayRoutes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Searches for routes in the specified local gateway route table.
--
-- This operation returns paginated results.
module Amazonka.EC2.SearchLocalGatewayRoutes
  ( -- * Creating a Request
    SearchLocalGatewayRoutes (..),
    newSearchLocalGatewayRoutes,

    -- * Request Lenses
    searchLocalGatewayRoutes_dryRun,
    searchLocalGatewayRoutes_filters,
    searchLocalGatewayRoutes_maxResults,
    searchLocalGatewayRoutes_nextToken,
    searchLocalGatewayRoutes_localGatewayRouteTableId,

    -- * Destructuring the Response
    SearchLocalGatewayRoutesResponse (..),
    newSearchLocalGatewayRoutesResponse,

    -- * Response Lenses
    searchLocalGatewayRoutesResponse_nextToken,
    searchLocalGatewayRoutesResponse_routes,
    searchLocalGatewayRoutesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSearchLocalGatewayRoutes' smart constructor.
data SearchLocalGatewayRoutes = SearchLocalGatewayRoutes'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    SearchLocalGatewayRoutes -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters.
    --
    -- -   @route-search.exact-match@ - The exact match of the specified
    --     filter.
    --
    -- -   @route-search.longest-prefix-match@ - The longest prefix that
    --     matches the route.
    --
    -- -   @route-search.subnet-of-match@ - The routes with a subnet that match
    --     the specified CIDR filter.
    --
    -- -   @route-search.supernet-of-match@ - The routes with a CIDR that
    --     encompass the CIDR filter. For example, if you have 10.0.1.0\/29 and
    --     10.0.1.0\/31 routes in your route table and you specify
    --     @supernet-of-match@ as 10.0.1.0\/30, then the result returns
    --     10.0.1.0\/29.
    --
    -- -   @state@ - The state of the route.
    --
    -- -   @type@ - The route type.
    SearchLocalGatewayRoutes -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The maximum number of results to return with a single call. To retrieve
    -- the remaining results, make another call with the returned @nextToken@
    -- value.
    SearchLocalGatewayRoutes -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The token for the next page of results.
    SearchLocalGatewayRoutes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the local gateway route table.
    SearchLocalGatewayRoutes -> Text
localGatewayRouteTableId :: Prelude.Text
  }
  deriving (SearchLocalGatewayRoutes -> SearchLocalGatewayRoutes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchLocalGatewayRoutes -> SearchLocalGatewayRoutes -> Bool
$c/= :: SearchLocalGatewayRoutes -> SearchLocalGatewayRoutes -> Bool
== :: SearchLocalGatewayRoutes -> SearchLocalGatewayRoutes -> Bool
$c== :: SearchLocalGatewayRoutes -> SearchLocalGatewayRoutes -> Bool
Prelude.Eq, ReadPrec [SearchLocalGatewayRoutes]
ReadPrec SearchLocalGatewayRoutes
Int -> ReadS SearchLocalGatewayRoutes
ReadS [SearchLocalGatewayRoutes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchLocalGatewayRoutes]
$creadListPrec :: ReadPrec [SearchLocalGatewayRoutes]
readPrec :: ReadPrec SearchLocalGatewayRoutes
$creadPrec :: ReadPrec SearchLocalGatewayRoutes
readList :: ReadS [SearchLocalGatewayRoutes]
$creadList :: ReadS [SearchLocalGatewayRoutes]
readsPrec :: Int -> ReadS SearchLocalGatewayRoutes
$creadsPrec :: Int -> ReadS SearchLocalGatewayRoutes
Prelude.Read, Int -> SearchLocalGatewayRoutes -> ShowS
[SearchLocalGatewayRoutes] -> ShowS
SearchLocalGatewayRoutes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchLocalGatewayRoutes] -> ShowS
$cshowList :: [SearchLocalGatewayRoutes] -> ShowS
show :: SearchLocalGatewayRoutes -> String
$cshow :: SearchLocalGatewayRoutes -> String
showsPrec :: Int -> SearchLocalGatewayRoutes -> ShowS
$cshowsPrec :: Int -> SearchLocalGatewayRoutes -> ShowS
Prelude.Show, forall x.
Rep SearchLocalGatewayRoutes x -> SearchLocalGatewayRoutes
forall x.
SearchLocalGatewayRoutes -> Rep SearchLocalGatewayRoutes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchLocalGatewayRoutes x -> SearchLocalGatewayRoutes
$cfrom :: forall x.
SearchLocalGatewayRoutes -> Rep SearchLocalGatewayRoutes x
Prelude.Generic)

-- |
-- Create a value of 'SearchLocalGatewayRoutes' 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:
--
-- 'dryRun', 'searchLocalGatewayRoutes_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'filters', 'searchLocalGatewayRoutes_filters' - One or more filters.
--
-- -   @route-search.exact-match@ - The exact match of the specified
--     filter.
--
-- -   @route-search.longest-prefix-match@ - The longest prefix that
--     matches the route.
--
-- -   @route-search.subnet-of-match@ - The routes with a subnet that match
--     the specified CIDR filter.
--
-- -   @route-search.supernet-of-match@ - The routes with a CIDR that
--     encompass the CIDR filter. For example, if you have 10.0.1.0\/29 and
--     10.0.1.0\/31 routes in your route table and you specify
--     @supernet-of-match@ as 10.0.1.0\/30, then the result returns
--     10.0.1.0\/29.
--
-- -   @state@ - The state of the route.
--
-- -   @type@ - The route type.
--
-- 'maxResults', 'searchLocalGatewayRoutes_maxResults' - The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
--
-- 'nextToken', 'searchLocalGatewayRoutes_nextToken' - The token for the next page of results.
--
-- 'localGatewayRouteTableId', 'searchLocalGatewayRoutes_localGatewayRouteTableId' - The ID of the local gateway route table.
newSearchLocalGatewayRoutes ::
  -- | 'localGatewayRouteTableId'
  Prelude.Text ->
  SearchLocalGatewayRoutes
newSearchLocalGatewayRoutes :: Text -> SearchLocalGatewayRoutes
newSearchLocalGatewayRoutes
  Text
pLocalGatewayRouteTableId_ =
    SearchLocalGatewayRoutes'
      { $sel:dryRun:SearchLocalGatewayRoutes' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
        $sel:filters:SearchLocalGatewayRoutes' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:SearchLocalGatewayRoutes' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:SearchLocalGatewayRoutes' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:localGatewayRouteTableId:SearchLocalGatewayRoutes' :: Text
localGatewayRouteTableId =
          Text
pLocalGatewayRouteTableId_
      }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
searchLocalGatewayRoutes_dryRun :: Lens.Lens' SearchLocalGatewayRoutes (Prelude.Maybe Prelude.Bool)
searchLocalGatewayRoutes_dryRun :: Lens' SearchLocalGatewayRoutes (Maybe Bool)
searchLocalGatewayRoutes_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutes' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: SearchLocalGatewayRoutes
s@SearchLocalGatewayRoutes' {} Maybe Bool
a -> SearchLocalGatewayRoutes
s {$sel:dryRun:SearchLocalGatewayRoutes' :: Maybe Bool
dryRun = Maybe Bool
a} :: SearchLocalGatewayRoutes)

-- | One or more filters.
--
-- -   @route-search.exact-match@ - The exact match of the specified
--     filter.
--
-- -   @route-search.longest-prefix-match@ - The longest prefix that
--     matches the route.
--
-- -   @route-search.subnet-of-match@ - The routes with a subnet that match
--     the specified CIDR filter.
--
-- -   @route-search.supernet-of-match@ - The routes with a CIDR that
--     encompass the CIDR filter. For example, if you have 10.0.1.0\/29 and
--     10.0.1.0\/31 routes in your route table and you specify
--     @supernet-of-match@ as 10.0.1.0\/30, then the result returns
--     10.0.1.0\/29.
--
-- -   @state@ - The state of the route.
--
-- -   @type@ - The route type.
searchLocalGatewayRoutes_filters :: Lens.Lens' SearchLocalGatewayRoutes (Prelude.Maybe [Filter])
searchLocalGatewayRoutes_filters :: Lens' SearchLocalGatewayRoutes (Maybe [Filter])
searchLocalGatewayRoutes_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutes' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchLocalGatewayRoutes
s@SearchLocalGatewayRoutes' {} Maybe [Filter]
a -> SearchLocalGatewayRoutes
s {$sel:filters:SearchLocalGatewayRoutes' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchLocalGatewayRoutes) 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

-- | The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
searchLocalGatewayRoutes_maxResults :: Lens.Lens' SearchLocalGatewayRoutes (Prelude.Maybe Prelude.Int)
searchLocalGatewayRoutes_maxResults :: Lens' SearchLocalGatewayRoutes (Maybe Int)
searchLocalGatewayRoutes_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutes' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: SearchLocalGatewayRoutes
s@SearchLocalGatewayRoutes' {} Maybe Int
a -> SearchLocalGatewayRoutes
s {$sel:maxResults:SearchLocalGatewayRoutes' :: Maybe Int
maxResults = Maybe Int
a} :: SearchLocalGatewayRoutes)

-- | The token for the next page of results.
searchLocalGatewayRoutes_nextToken :: Lens.Lens' SearchLocalGatewayRoutes (Prelude.Maybe Prelude.Text)
searchLocalGatewayRoutes_nextToken :: Lens' SearchLocalGatewayRoutes (Maybe Text)
searchLocalGatewayRoutes_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchLocalGatewayRoutes
s@SearchLocalGatewayRoutes' {} Maybe Text
a -> SearchLocalGatewayRoutes
s {$sel:nextToken:SearchLocalGatewayRoutes' :: Maybe Text
nextToken = Maybe Text
a} :: SearchLocalGatewayRoutes)

-- | The ID of the local gateway route table.
searchLocalGatewayRoutes_localGatewayRouteTableId :: Lens.Lens' SearchLocalGatewayRoutes Prelude.Text
searchLocalGatewayRoutes_localGatewayRouteTableId :: Lens' SearchLocalGatewayRoutes Text
searchLocalGatewayRoutes_localGatewayRouteTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutes' {Text
localGatewayRouteTableId :: Text
$sel:localGatewayRouteTableId:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Text
localGatewayRouteTableId} -> Text
localGatewayRouteTableId) (\s :: SearchLocalGatewayRoutes
s@SearchLocalGatewayRoutes' {} Text
a -> SearchLocalGatewayRoutes
s {$sel:localGatewayRouteTableId:SearchLocalGatewayRoutes' :: Text
localGatewayRouteTableId = Text
a} :: SearchLocalGatewayRoutes)

instance Core.AWSPager SearchLocalGatewayRoutes where
  page :: SearchLocalGatewayRoutes
-> AWSResponse SearchLocalGatewayRoutes
-> Maybe SearchLocalGatewayRoutes
page SearchLocalGatewayRoutes
rq AWSResponse SearchLocalGatewayRoutes
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse SearchLocalGatewayRoutes
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SearchLocalGatewayRoutesResponse (Maybe Text)
searchLocalGatewayRoutesResponse_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 SearchLocalGatewayRoutes
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SearchLocalGatewayRoutesResponse (Maybe [LocalGatewayRoute])
searchLocalGatewayRoutesResponse_routes
            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.$ SearchLocalGatewayRoutes
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' SearchLocalGatewayRoutes (Maybe Text)
searchLocalGatewayRoutes_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse SearchLocalGatewayRoutes
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SearchLocalGatewayRoutesResponse (Maybe Text)
searchLocalGatewayRoutesResponse_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 SearchLocalGatewayRoutes where
  type
    AWSResponse SearchLocalGatewayRoutes =
      SearchLocalGatewayRoutesResponse
  request :: (Service -> Service)
-> SearchLocalGatewayRoutes -> Request SearchLocalGatewayRoutes
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SearchLocalGatewayRoutes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SearchLocalGatewayRoutes)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [LocalGatewayRoute]
-> Int
-> SearchLocalGatewayRoutesResponse
SearchLocalGatewayRoutesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"routeSet"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                        )
            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 SearchLocalGatewayRoutes where
  hashWithSalt :: Int -> SearchLocalGatewayRoutes -> Int
hashWithSalt Int
_salt SearchLocalGatewayRoutes' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
Text
localGatewayRouteTableId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:localGatewayRouteTableId:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Text
$sel:nextToken:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Text
$sel:maxResults:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Int
$sel:filters:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe [Filter]
$sel:dryRun:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localGatewayRouteTableId

instance Prelude.NFData SearchLocalGatewayRoutes where
  rnf :: SearchLocalGatewayRoutes -> ()
rnf SearchLocalGatewayRoutes' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
Text
localGatewayRouteTableId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:localGatewayRouteTableId:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Text
$sel:nextToken:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Text
$sel:maxResults:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Int
$sel:filters:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe [Filter]
$sel:dryRun:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
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
localGatewayRouteTableId

instance Data.ToHeaders SearchLocalGatewayRoutes where
  toHeaders :: SearchLocalGatewayRoutes -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath SearchLocalGatewayRoutes where
  toPath :: SearchLocalGatewayRoutes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery SearchLocalGatewayRoutes where
  toQuery :: SearchLocalGatewayRoutes -> QueryString
toQuery SearchLocalGatewayRoutes' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
Text
localGatewayRouteTableId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:localGatewayRouteTableId:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Text
$sel:nextToken:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Text
$sel:maxResults:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Int
$sel:filters:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe [Filter]
$sel:dryRun:SearchLocalGatewayRoutes' :: SearchLocalGatewayRoutes -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"SearchLocalGatewayRoutes" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Filter" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"LocalGatewayRouteTableId"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
localGatewayRouteTableId
      ]

-- | /See:/ 'newSearchLocalGatewayRoutesResponse' smart constructor.
data SearchLocalGatewayRoutesResponse = SearchLocalGatewayRoutesResponse'
  { -- | The token to use to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    SearchLocalGatewayRoutesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the routes.
    SearchLocalGatewayRoutesResponse -> Maybe [LocalGatewayRoute]
routes :: Prelude.Maybe [LocalGatewayRoute],
    -- | The response's http status code.
    SearchLocalGatewayRoutesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchLocalGatewayRoutesResponse
-> SearchLocalGatewayRoutesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchLocalGatewayRoutesResponse
-> SearchLocalGatewayRoutesResponse -> Bool
$c/= :: SearchLocalGatewayRoutesResponse
-> SearchLocalGatewayRoutesResponse -> Bool
== :: SearchLocalGatewayRoutesResponse
-> SearchLocalGatewayRoutesResponse -> Bool
$c== :: SearchLocalGatewayRoutesResponse
-> SearchLocalGatewayRoutesResponse -> Bool
Prelude.Eq, ReadPrec [SearchLocalGatewayRoutesResponse]
ReadPrec SearchLocalGatewayRoutesResponse
Int -> ReadS SearchLocalGatewayRoutesResponse
ReadS [SearchLocalGatewayRoutesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchLocalGatewayRoutesResponse]
$creadListPrec :: ReadPrec [SearchLocalGatewayRoutesResponse]
readPrec :: ReadPrec SearchLocalGatewayRoutesResponse
$creadPrec :: ReadPrec SearchLocalGatewayRoutesResponse
readList :: ReadS [SearchLocalGatewayRoutesResponse]
$creadList :: ReadS [SearchLocalGatewayRoutesResponse]
readsPrec :: Int -> ReadS SearchLocalGatewayRoutesResponse
$creadsPrec :: Int -> ReadS SearchLocalGatewayRoutesResponse
Prelude.Read, Int -> SearchLocalGatewayRoutesResponse -> ShowS
[SearchLocalGatewayRoutesResponse] -> ShowS
SearchLocalGatewayRoutesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchLocalGatewayRoutesResponse] -> ShowS
$cshowList :: [SearchLocalGatewayRoutesResponse] -> ShowS
show :: SearchLocalGatewayRoutesResponse -> String
$cshow :: SearchLocalGatewayRoutesResponse -> String
showsPrec :: Int -> SearchLocalGatewayRoutesResponse -> ShowS
$cshowsPrec :: Int -> SearchLocalGatewayRoutesResponse -> ShowS
Prelude.Show, forall x.
Rep SearchLocalGatewayRoutesResponse x
-> SearchLocalGatewayRoutesResponse
forall x.
SearchLocalGatewayRoutesResponse
-> Rep SearchLocalGatewayRoutesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchLocalGatewayRoutesResponse x
-> SearchLocalGatewayRoutesResponse
$cfrom :: forall x.
SearchLocalGatewayRoutesResponse
-> Rep SearchLocalGatewayRoutesResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchLocalGatewayRoutesResponse' 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', 'searchLocalGatewayRoutesResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'routes', 'searchLocalGatewayRoutesResponse_routes' - Information about the routes.
--
-- 'httpStatus', 'searchLocalGatewayRoutesResponse_httpStatus' - The response's http status code.
newSearchLocalGatewayRoutesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchLocalGatewayRoutesResponse
newSearchLocalGatewayRoutesResponse :: Int -> SearchLocalGatewayRoutesResponse
newSearchLocalGatewayRoutesResponse Int
pHttpStatus_ =
  SearchLocalGatewayRoutesResponse'
    { $sel:nextToken:SearchLocalGatewayRoutesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:routes:SearchLocalGatewayRoutesResponse' :: Maybe [LocalGatewayRoute]
routes = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchLocalGatewayRoutesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
searchLocalGatewayRoutesResponse_nextToken :: Lens.Lens' SearchLocalGatewayRoutesResponse (Prelude.Maybe Prelude.Text)
searchLocalGatewayRoutesResponse_nextToken :: Lens' SearchLocalGatewayRoutesResponse (Maybe Text)
searchLocalGatewayRoutesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchLocalGatewayRoutesResponse' :: SearchLocalGatewayRoutesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchLocalGatewayRoutesResponse
s@SearchLocalGatewayRoutesResponse' {} Maybe Text
a -> SearchLocalGatewayRoutesResponse
s {$sel:nextToken:SearchLocalGatewayRoutesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchLocalGatewayRoutesResponse)

-- | Information about the routes.
searchLocalGatewayRoutesResponse_routes :: Lens.Lens' SearchLocalGatewayRoutesResponse (Prelude.Maybe [LocalGatewayRoute])
searchLocalGatewayRoutesResponse_routes :: Lens' SearchLocalGatewayRoutesResponse (Maybe [LocalGatewayRoute])
searchLocalGatewayRoutesResponse_routes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutesResponse' {Maybe [LocalGatewayRoute]
routes :: Maybe [LocalGatewayRoute]
$sel:routes:SearchLocalGatewayRoutesResponse' :: SearchLocalGatewayRoutesResponse -> Maybe [LocalGatewayRoute]
routes} -> Maybe [LocalGatewayRoute]
routes) (\s :: SearchLocalGatewayRoutesResponse
s@SearchLocalGatewayRoutesResponse' {} Maybe [LocalGatewayRoute]
a -> SearchLocalGatewayRoutesResponse
s {$sel:routes:SearchLocalGatewayRoutesResponse' :: Maybe [LocalGatewayRoute]
routes = Maybe [LocalGatewayRoute]
a} :: SearchLocalGatewayRoutesResponse) 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

-- | The response's http status code.
searchLocalGatewayRoutesResponse_httpStatus :: Lens.Lens' SearchLocalGatewayRoutesResponse Prelude.Int
searchLocalGatewayRoutesResponse_httpStatus :: Lens' SearchLocalGatewayRoutesResponse Int
searchLocalGatewayRoutesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchLocalGatewayRoutesResponse' {Int
httpStatus :: Int
$sel:httpStatus:SearchLocalGatewayRoutesResponse' :: SearchLocalGatewayRoutesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SearchLocalGatewayRoutesResponse
s@SearchLocalGatewayRoutesResponse' {} Int
a -> SearchLocalGatewayRoutesResponse
s {$sel:httpStatus:SearchLocalGatewayRoutesResponse' :: Int
httpStatus = Int
a} :: SearchLocalGatewayRoutesResponse)

instance
  Prelude.NFData
    SearchLocalGatewayRoutesResponse
  where
  rnf :: SearchLocalGatewayRoutesResponse -> ()
rnf SearchLocalGatewayRoutesResponse' {Int
Maybe [LocalGatewayRoute]
Maybe Text
httpStatus :: Int
routes :: Maybe [LocalGatewayRoute]
nextToken :: Maybe Text
$sel:httpStatus:SearchLocalGatewayRoutesResponse' :: SearchLocalGatewayRoutesResponse -> Int
$sel:routes:SearchLocalGatewayRoutesResponse' :: SearchLocalGatewayRoutesResponse -> Maybe [LocalGatewayRoute]
$sel:nextToken:SearchLocalGatewayRoutesResponse' :: SearchLocalGatewayRoutesResponse -> 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 Maybe [LocalGatewayRoute]
routes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus