{-# 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.DescribeRouteTables
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes one or more of your route tables.
--
-- Each subnet in your VPC must be associated with a route table. If a
-- subnet is not explicitly associated with any route table, it is
-- implicitly associated with the main route table. This command does not
-- return the subnet ID for implicit associations.
--
-- For more information, see
-- <https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html Route tables>
-- in the /Amazon Virtual Private Cloud User Guide/.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeRouteTables
  ( -- * Creating a Request
    DescribeRouteTables (..),
    newDescribeRouteTables,

    -- * Request Lenses
    describeRouteTables_dryRun,
    describeRouteTables_filters,
    describeRouteTables_maxResults,
    describeRouteTables_nextToken,
    describeRouteTables_routeTableIds,

    -- * Destructuring the Response
    DescribeRouteTablesResponse (..),
    newDescribeRouteTablesResponse,

    -- * Response Lenses
    describeRouteTablesResponse_nextToken,
    describeRouteTablesResponse_routeTables,
    describeRouteTablesResponse_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:/ 'newDescribeRouteTables' smart constructor.
data DescribeRouteTables = DescribeRouteTables'
  { -- | 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@.
    DescribeRouteTables -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters.
    --
    -- -   @association.route-table-association-id@ - The ID of an association
    --     ID for the route table.
    --
    -- -   @association.route-table-id@ - The ID of the route table involved in
    --     the association.
    --
    -- -   @association.subnet-id@ - The ID of the subnet involved in the
    --     association.
    --
    -- -   @association.main@ - Indicates whether the route table is the main
    --     route table for the VPC (@true@ | @false@). Route tables that do not
    --     have an association ID are not returned in the response.
    --
    -- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
    --     route table.
    --
    -- -   @route-table-id@ - The ID of the route table.
    --
    -- -   @route.destination-cidr-block@ - The IPv4 CIDR range specified in a
    --     route in the table.
    --
    -- -   @route.destination-ipv6-cidr-block@ - The IPv6 CIDR range specified
    --     in a route in the route table.
    --
    -- -   @route.destination-prefix-list-id@ - The ID (prefix) of the Amazon
    --     Web Service specified in a route in the table.
    --
    -- -   @route.egress-only-internet-gateway-id@ - The ID of an egress-only
    --     Internet gateway specified in a route in the route table.
    --
    -- -   @route.gateway-id@ - The ID of a gateway specified in a route in the
    --     table.
    --
    -- -   @route.instance-id@ - The ID of an instance specified in a route in
    --     the table.
    --
    -- -   @route.nat-gateway-id@ - The ID of a NAT gateway.
    --
    -- -   @route.transit-gateway-id@ - The ID of a transit gateway.
    --
    -- -   @route.origin@ - Describes how the route was created.
    --     @CreateRouteTable@ indicates that the route was automatically
    --     created when the route table was created; @CreateRoute@ indicates
    --     that the route was manually added to the route table;
    --     @EnableVgwRoutePropagation@ indicates that the route was propagated
    --     by route propagation.
    --
    -- -   @route.state@ - The state of a route in the route table (@active@ |
    --     @blackhole@). The blackhole state indicates that the route\'s target
    --     isn\'t available (for example, the specified gateway isn\'t attached
    --     to the VPC, the specified NAT instance has been terminated, and so
    --     on).
    --
    -- -   @route.vpc-peering-connection-id@ - The ID of a VPC peering
    --     connection specified in a route in the table.
    --
    -- -   @tag@:\<key> - The key\/value combination of a tag assigned to the
    --     resource. Use the tag key in the filter name and the tag value as
    --     the filter value. For example, to find all resources that have a tag
    --     with the key @Owner@ and the value @TeamA@, specify @tag:Owner@ for
    --     the filter name and @TeamA@ for the filter value.
    --
    -- -   @tag-key@ - The key of a tag assigned to the resource. Use this
    --     filter to find all resources assigned a tag with a specific key,
    --     regardless of the tag value.
    --
    -- -   @vpc-id@ - The ID of the VPC for the route table.
    DescribeRouteTables -> 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.
    DescribeRouteTables -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    DescribeRouteTables -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | One or more route table IDs.
    --
    -- Default: Describes all your route tables.
    DescribeRouteTables -> Maybe [Text]
routeTableIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeRouteTables -> DescribeRouteTables -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRouteTables -> DescribeRouteTables -> Bool
$c/= :: DescribeRouteTables -> DescribeRouteTables -> Bool
== :: DescribeRouteTables -> DescribeRouteTables -> Bool
$c== :: DescribeRouteTables -> DescribeRouteTables -> Bool
Prelude.Eq, ReadPrec [DescribeRouteTables]
ReadPrec DescribeRouteTables
Int -> ReadS DescribeRouteTables
ReadS [DescribeRouteTables]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRouteTables]
$creadListPrec :: ReadPrec [DescribeRouteTables]
readPrec :: ReadPrec DescribeRouteTables
$creadPrec :: ReadPrec DescribeRouteTables
readList :: ReadS [DescribeRouteTables]
$creadList :: ReadS [DescribeRouteTables]
readsPrec :: Int -> ReadS DescribeRouteTables
$creadsPrec :: Int -> ReadS DescribeRouteTables
Prelude.Read, Int -> DescribeRouteTables -> ShowS
[DescribeRouteTables] -> ShowS
DescribeRouteTables -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRouteTables] -> ShowS
$cshowList :: [DescribeRouteTables] -> ShowS
show :: DescribeRouteTables -> String
$cshow :: DescribeRouteTables -> String
showsPrec :: Int -> DescribeRouteTables -> ShowS
$cshowsPrec :: Int -> DescribeRouteTables -> ShowS
Prelude.Show, forall x. Rep DescribeRouteTables x -> DescribeRouteTables
forall x. DescribeRouteTables -> Rep DescribeRouteTables x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeRouteTables x -> DescribeRouteTables
$cfrom :: forall x. DescribeRouteTables -> Rep DescribeRouteTables x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRouteTables' 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', 'describeRouteTables_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', 'describeRouteTables_filters' - One or more filters.
--
-- -   @association.route-table-association-id@ - The ID of an association
--     ID for the route table.
--
-- -   @association.route-table-id@ - The ID of the route table involved in
--     the association.
--
-- -   @association.subnet-id@ - The ID of the subnet involved in the
--     association.
--
-- -   @association.main@ - Indicates whether the route table is the main
--     route table for the VPC (@true@ | @false@). Route tables that do not
--     have an association ID are not returned in the response.
--
-- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
--     route table.
--
-- -   @route-table-id@ - The ID of the route table.
--
-- -   @route.destination-cidr-block@ - The IPv4 CIDR range specified in a
--     route in the table.
--
-- -   @route.destination-ipv6-cidr-block@ - The IPv6 CIDR range specified
--     in a route in the route table.
--
-- -   @route.destination-prefix-list-id@ - The ID (prefix) of the Amazon
--     Web Service specified in a route in the table.
--
-- -   @route.egress-only-internet-gateway-id@ - The ID of an egress-only
--     Internet gateway specified in a route in the route table.
--
-- -   @route.gateway-id@ - The ID of a gateway specified in a route in the
--     table.
--
-- -   @route.instance-id@ - The ID of an instance specified in a route in
--     the table.
--
-- -   @route.nat-gateway-id@ - The ID of a NAT gateway.
--
-- -   @route.transit-gateway-id@ - The ID of a transit gateway.
--
-- -   @route.origin@ - Describes how the route was created.
--     @CreateRouteTable@ indicates that the route was automatically
--     created when the route table was created; @CreateRoute@ indicates
--     that the route was manually added to the route table;
--     @EnableVgwRoutePropagation@ indicates that the route was propagated
--     by route propagation.
--
-- -   @route.state@ - The state of a route in the route table (@active@ |
--     @blackhole@). The blackhole state indicates that the route\'s target
--     isn\'t available (for example, the specified gateway isn\'t attached
--     to the VPC, the specified NAT instance has been terminated, and so
--     on).
--
-- -   @route.vpc-peering-connection-id@ - The ID of a VPC peering
--     connection specified in a route in the table.
--
-- -   @tag@:\<key> - The key\/value combination of a tag assigned to the
--     resource. Use the tag key in the filter name and the tag value as
--     the filter value. For example, to find all resources that have a tag
--     with the key @Owner@ and the value @TeamA@, specify @tag:Owner@ for
--     the filter name and @TeamA@ for the filter value.
--
-- -   @tag-key@ - The key of a tag assigned to the resource. Use this
--     filter to find all resources assigned a tag with a specific key,
--     regardless of the tag value.
--
-- -   @vpc-id@ - The ID of the VPC for the route table.
--
-- 'maxResults', 'describeRouteTables_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', 'describeRouteTables_nextToken' - The token for the next page of results.
--
-- 'routeTableIds', 'describeRouteTables_routeTableIds' - One or more route table IDs.
--
-- Default: Describes all your route tables.
newDescribeRouteTables ::
  DescribeRouteTables
newDescribeRouteTables :: DescribeRouteTables
newDescribeRouteTables =
  DescribeRouteTables'
    { $sel:dryRun:DescribeRouteTables' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeRouteTables' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeRouteTables' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeRouteTables' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableIds:DescribeRouteTables' :: Maybe [Text]
routeTableIds = forall a. Maybe a
Prelude.Nothing
    }

-- | 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@.
describeRouteTables_dryRun :: Lens.Lens' DescribeRouteTables (Prelude.Maybe Prelude.Bool)
describeRouteTables_dryRun :: Lens' DescribeRouteTables (Maybe Bool)
describeRouteTables_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTables' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeRouteTables' :: DescribeRouteTables -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeRouteTables
s@DescribeRouteTables' {} Maybe Bool
a -> DescribeRouteTables
s {$sel:dryRun:DescribeRouteTables' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeRouteTables)

-- | One or more filters.
--
-- -   @association.route-table-association-id@ - The ID of an association
--     ID for the route table.
--
-- -   @association.route-table-id@ - The ID of the route table involved in
--     the association.
--
-- -   @association.subnet-id@ - The ID of the subnet involved in the
--     association.
--
-- -   @association.main@ - Indicates whether the route table is the main
--     route table for the VPC (@true@ | @false@). Route tables that do not
--     have an association ID are not returned in the response.
--
-- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
--     route table.
--
-- -   @route-table-id@ - The ID of the route table.
--
-- -   @route.destination-cidr-block@ - The IPv4 CIDR range specified in a
--     route in the table.
--
-- -   @route.destination-ipv6-cidr-block@ - The IPv6 CIDR range specified
--     in a route in the route table.
--
-- -   @route.destination-prefix-list-id@ - The ID (prefix) of the Amazon
--     Web Service specified in a route in the table.
--
-- -   @route.egress-only-internet-gateway-id@ - The ID of an egress-only
--     Internet gateway specified in a route in the route table.
--
-- -   @route.gateway-id@ - The ID of a gateway specified in a route in the
--     table.
--
-- -   @route.instance-id@ - The ID of an instance specified in a route in
--     the table.
--
-- -   @route.nat-gateway-id@ - The ID of a NAT gateway.
--
-- -   @route.transit-gateway-id@ - The ID of a transit gateway.
--
-- -   @route.origin@ - Describes how the route was created.
--     @CreateRouteTable@ indicates that the route was automatically
--     created when the route table was created; @CreateRoute@ indicates
--     that the route was manually added to the route table;
--     @EnableVgwRoutePropagation@ indicates that the route was propagated
--     by route propagation.
--
-- -   @route.state@ - The state of a route in the route table (@active@ |
--     @blackhole@). The blackhole state indicates that the route\'s target
--     isn\'t available (for example, the specified gateway isn\'t attached
--     to the VPC, the specified NAT instance has been terminated, and so
--     on).
--
-- -   @route.vpc-peering-connection-id@ - The ID of a VPC peering
--     connection specified in a route in the table.
--
-- -   @tag@:\<key> - The key\/value combination of a tag assigned to the
--     resource. Use the tag key in the filter name and the tag value as
--     the filter value. For example, to find all resources that have a tag
--     with the key @Owner@ and the value @TeamA@, specify @tag:Owner@ for
--     the filter name and @TeamA@ for the filter value.
--
-- -   @tag-key@ - The key of a tag assigned to the resource. Use this
--     filter to find all resources assigned a tag with a specific key,
--     regardless of the tag value.
--
-- -   @vpc-id@ - The ID of the VPC for the route table.
describeRouteTables_filters :: Lens.Lens' DescribeRouteTables (Prelude.Maybe [Filter])
describeRouteTables_filters :: Lens' DescribeRouteTables (Maybe [Filter])
describeRouteTables_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTables' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeRouteTables
s@DescribeRouteTables' {} Maybe [Filter]
a -> DescribeRouteTables
s {$sel:filters:DescribeRouteTables' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeRouteTables) 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.
describeRouteTables_maxResults :: Lens.Lens' DescribeRouteTables (Prelude.Maybe Prelude.Natural)
describeRouteTables_maxResults :: Lens' DescribeRouteTables (Maybe Natural)
describeRouteTables_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTables' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeRouteTables' :: DescribeRouteTables -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeRouteTables
s@DescribeRouteTables' {} Maybe Natural
a -> DescribeRouteTables
s {$sel:maxResults:DescribeRouteTables' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeRouteTables)

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

-- | One or more route table IDs.
--
-- Default: Describes all your route tables.
describeRouteTables_routeTableIds :: Lens.Lens' DescribeRouteTables (Prelude.Maybe [Prelude.Text])
describeRouteTables_routeTableIds :: Lens' DescribeRouteTables (Maybe [Text])
describeRouteTables_routeTableIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTables' {Maybe [Text]
routeTableIds :: Maybe [Text]
$sel:routeTableIds:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Text]
routeTableIds} -> Maybe [Text]
routeTableIds) (\s :: DescribeRouteTables
s@DescribeRouteTables' {} Maybe [Text]
a -> DescribeRouteTables
s {$sel:routeTableIds:DescribeRouteTables' :: Maybe [Text]
routeTableIds = Maybe [Text]
a} :: DescribeRouteTables) 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

instance Core.AWSPager DescribeRouteTables where
  page :: DescribeRouteTables
-> AWSResponse DescribeRouteTables -> Maybe DescribeRouteTables
page DescribeRouteTables
rq AWSResponse DescribeRouteTables
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeRouteTables
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeRouteTablesResponse (Maybe Text)
describeRouteTablesResponse_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 DescribeRouteTables
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeRouteTablesResponse (Maybe [RouteTable])
describeRouteTablesResponse_routeTables
            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.$ DescribeRouteTables
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeRouteTables (Maybe Text)
describeRouteTables_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeRouteTables
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeRouteTablesResponse (Maybe Text)
describeRouteTablesResponse_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 DescribeRouteTables where
  type
    AWSResponse DescribeRouteTables =
      DescribeRouteTablesResponse
  request :: (Service -> Service)
-> DescribeRouteTables -> Request DescribeRouteTables
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 DescribeRouteTables
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRouteTables)))
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 [RouteTable] -> Int -> DescribeRouteTablesResponse
DescribeRouteTablesResponse'
            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
"routeTableSet"
                            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 DescribeRouteTables where
  hashWithSalt :: Int -> DescribeRouteTables -> Int
hashWithSalt Int
_salt DescribeRouteTables' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
routeTableIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:routeTableIds:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Text]
$sel:nextToken:DescribeRouteTables' :: DescribeRouteTables -> Maybe Text
$sel:maxResults:DescribeRouteTables' :: DescribeRouteTables -> Maybe Natural
$sel:filters:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Filter]
$sel:dryRun:DescribeRouteTables' :: DescribeRouteTables -> 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 Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
routeTableIds

instance Prelude.NFData DescribeRouteTables where
  rnf :: DescribeRouteTables -> ()
rnf DescribeRouteTables' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
routeTableIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:routeTableIds:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Text]
$sel:nextToken:DescribeRouteTables' :: DescribeRouteTables -> Maybe Text
$sel:maxResults:DescribeRouteTables' :: DescribeRouteTables -> Maybe Natural
$sel:filters:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Filter]
$sel:dryRun:DescribeRouteTables' :: DescribeRouteTables -> 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 Natural
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 Maybe [Text]
routeTableIds

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

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

instance Data.ToQuery DescribeRouteTables where
  toQuery :: DescribeRouteTables -> QueryString
toQuery DescribeRouteTables' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
routeTableIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:routeTableIds:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Text]
$sel:nextToken:DescribeRouteTables' :: DescribeRouteTables -> Maybe Text
$sel:maxResults:DescribeRouteTables' :: DescribeRouteTables -> Maybe Natural
$sel:filters:DescribeRouteTables' :: DescribeRouteTables -> Maybe [Filter]
$sel:dryRun:DescribeRouteTables' :: DescribeRouteTables -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeRouteTables" :: 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 Natural
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"RouteTableId"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
routeTableIds
          )
      ]

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

-- |
-- Create a value of 'DescribeRouteTablesResponse' 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', 'describeRouteTablesResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'routeTables', 'describeRouteTablesResponse_routeTables' - Information about one or more route tables.
--
-- 'httpStatus', 'describeRouteTablesResponse_httpStatus' - The response's http status code.
newDescribeRouteTablesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeRouteTablesResponse
newDescribeRouteTablesResponse :: Int -> DescribeRouteTablesResponse
newDescribeRouteTablesResponse Int
pHttpStatus_ =
  DescribeRouteTablesResponse'
    { $sel:nextToken:DescribeRouteTablesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:routeTables:DescribeRouteTablesResponse' :: Maybe [RouteTable]
routeTables = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeRouteTablesResponse' :: 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.
describeRouteTablesResponse_nextToken :: Lens.Lens' DescribeRouteTablesResponse (Prelude.Maybe Prelude.Text)
describeRouteTablesResponse_nextToken :: Lens' DescribeRouteTablesResponse (Maybe Text)
describeRouteTablesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTablesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeRouteTablesResponse' :: DescribeRouteTablesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeRouteTablesResponse
s@DescribeRouteTablesResponse' {} Maybe Text
a -> DescribeRouteTablesResponse
s {$sel:nextToken:DescribeRouteTablesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeRouteTablesResponse)

-- | Information about one or more route tables.
describeRouteTablesResponse_routeTables :: Lens.Lens' DescribeRouteTablesResponse (Prelude.Maybe [RouteTable])
describeRouteTablesResponse_routeTables :: Lens' DescribeRouteTablesResponse (Maybe [RouteTable])
describeRouteTablesResponse_routeTables = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTablesResponse' {Maybe [RouteTable]
routeTables :: Maybe [RouteTable]
$sel:routeTables:DescribeRouteTablesResponse' :: DescribeRouteTablesResponse -> Maybe [RouteTable]
routeTables} -> Maybe [RouteTable]
routeTables) (\s :: DescribeRouteTablesResponse
s@DescribeRouteTablesResponse' {} Maybe [RouteTable]
a -> DescribeRouteTablesResponse
s {$sel:routeTables:DescribeRouteTablesResponse' :: Maybe [RouteTable]
routeTables = Maybe [RouteTable]
a} :: DescribeRouteTablesResponse) 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.
describeRouteTablesResponse_httpStatus :: Lens.Lens' DescribeRouteTablesResponse Prelude.Int
describeRouteTablesResponse_httpStatus :: Lens' DescribeRouteTablesResponse Int
describeRouteTablesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRouteTablesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeRouteTablesResponse' :: DescribeRouteTablesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeRouteTablesResponse
s@DescribeRouteTablesResponse' {} Int
a -> DescribeRouteTablesResponse
s {$sel:httpStatus:DescribeRouteTablesResponse' :: Int
httpStatus = Int
a} :: DescribeRouteTablesResponse)

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