{-# 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.DescribeTransitGateways
-- 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 transit gateways. By default, all transit gateways
-- are described. Alternatively, you can filter the results.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeTransitGateways
  ( -- * Creating a Request
    DescribeTransitGateways (..),
    newDescribeTransitGateways,

    -- * Request Lenses
    describeTransitGateways_dryRun,
    describeTransitGateways_filters,
    describeTransitGateways_maxResults,
    describeTransitGateways_nextToken,
    describeTransitGateways_transitGatewayIds,

    -- * Destructuring the Response
    DescribeTransitGatewaysResponse (..),
    newDescribeTransitGatewaysResponse,

    -- * Response Lenses
    describeTransitGatewaysResponse_nextToken,
    describeTransitGatewaysResponse_transitGateways,
    describeTransitGatewaysResponse_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:/ 'newDescribeTransitGateways' smart constructor.
data DescribeTransitGateways = DescribeTransitGateways'
  { -- | 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@.
    DescribeTransitGateways -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters. The possible values are:
    --
    -- -   @options.propagation-default-route-table-id@ - The ID of the default
    --     propagation route table.
    --
    -- -   @options.amazon-side-asn@ - The private ASN for the Amazon side of a
    --     BGP session.
    --
    -- -   @options.association-default-route-table-id@ - The ID of the default
    --     association route table.
    --
    -- -   @options.auto-accept-shared-attachments@ - Indicates whether there
    --     is automatic acceptance of attachment requests (@enable@ |
    --     @disable@).
    --
    -- -   @options.default-route-table-association@ - Indicates whether
    --     resource attachments are automatically associated with the default
    --     association route table (@enable@ | @disable@).
    --
    -- -   @options.default-route-table-propagation@ - Indicates whether
    --     resource attachments automatically propagate routes to the default
    --     propagation route table (@enable@ | @disable@).
    --
    -- -   @options.dns-support@ - Indicates whether DNS support is enabled
    --     (@enable@ | @disable@).
    --
    -- -   @options.vpn-ecmp-support@ - Indicates whether Equal Cost Multipath
    --     Protocol support is enabled (@enable@ | @disable@).
    --
    -- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
    --     transit gateway.
    --
    -- -   @state@ - The state of the transit gateway (@available@ | @deleted@
    --     | @deleting@ | @modifying@ | @pending@).
    --
    -- -   @transit-gateway-id@ - The ID of the transit gateway.
    DescribeTransitGateways -> 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.
    DescribeTransitGateways -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    DescribeTransitGateways -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The IDs of the transit gateways.
    DescribeTransitGateways -> Maybe [Text]
transitGatewayIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeTransitGateways -> DescribeTransitGateways -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTransitGateways -> DescribeTransitGateways -> Bool
$c/= :: DescribeTransitGateways -> DescribeTransitGateways -> Bool
== :: DescribeTransitGateways -> DescribeTransitGateways -> Bool
$c== :: DescribeTransitGateways -> DescribeTransitGateways -> Bool
Prelude.Eq, ReadPrec [DescribeTransitGateways]
ReadPrec DescribeTransitGateways
Int -> ReadS DescribeTransitGateways
ReadS [DescribeTransitGateways]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTransitGateways]
$creadListPrec :: ReadPrec [DescribeTransitGateways]
readPrec :: ReadPrec DescribeTransitGateways
$creadPrec :: ReadPrec DescribeTransitGateways
readList :: ReadS [DescribeTransitGateways]
$creadList :: ReadS [DescribeTransitGateways]
readsPrec :: Int -> ReadS DescribeTransitGateways
$creadsPrec :: Int -> ReadS DescribeTransitGateways
Prelude.Read, Int -> DescribeTransitGateways -> ShowS
[DescribeTransitGateways] -> ShowS
DescribeTransitGateways -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTransitGateways] -> ShowS
$cshowList :: [DescribeTransitGateways] -> ShowS
show :: DescribeTransitGateways -> String
$cshow :: DescribeTransitGateways -> String
showsPrec :: Int -> DescribeTransitGateways -> ShowS
$cshowsPrec :: Int -> DescribeTransitGateways -> ShowS
Prelude.Show, forall x. Rep DescribeTransitGateways x -> DescribeTransitGateways
forall x. DescribeTransitGateways -> Rep DescribeTransitGateways x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTransitGateways x -> DescribeTransitGateways
$cfrom :: forall x. DescribeTransitGateways -> Rep DescribeTransitGateways x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTransitGateways' 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', 'describeTransitGateways_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', 'describeTransitGateways_filters' - One or more filters. The possible values are:
--
-- -   @options.propagation-default-route-table-id@ - The ID of the default
--     propagation route table.
--
-- -   @options.amazon-side-asn@ - The private ASN for the Amazon side of a
--     BGP session.
--
-- -   @options.association-default-route-table-id@ - The ID of the default
--     association route table.
--
-- -   @options.auto-accept-shared-attachments@ - Indicates whether there
--     is automatic acceptance of attachment requests (@enable@ |
--     @disable@).
--
-- -   @options.default-route-table-association@ - Indicates whether
--     resource attachments are automatically associated with the default
--     association route table (@enable@ | @disable@).
--
-- -   @options.default-route-table-propagation@ - Indicates whether
--     resource attachments automatically propagate routes to the default
--     propagation route table (@enable@ | @disable@).
--
-- -   @options.dns-support@ - Indicates whether DNS support is enabled
--     (@enable@ | @disable@).
--
-- -   @options.vpn-ecmp-support@ - Indicates whether Equal Cost Multipath
--     Protocol support is enabled (@enable@ | @disable@).
--
-- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
--     transit gateway.
--
-- -   @state@ - The state of the transit gateway (@available@ | @deleted@
--     | @deleting@ | @modifying@ | @pending@).
--
-- -   @transit-gateway-id@ - The ID of the transit gateway.
--
-- 'maxResults', 'describeTransitGateways_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', 'describeTransitGateways_nextToken' - The token for the next page of results.
--
-- 'transitGatewayIds', 'describeTransitGateways_transitGatewayIds' - The IDs of the transit gateways.
newDescribeTransitGateways ::
  DescribeTransitGateways
newDescribeTransitGateways :: DescribeTransitGateways
newDescribeTransitGateways =
  DescribeTransitGateways'
    { $sel:dryRun:DescribeTransitGateways' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeTransitGateways' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeTransitGateways' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeTransitGateways' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayIds:DescribeTransitGateways' :: Maybe [Text]
transitGatewayIds = 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@.
describeTransitGateways_dryRun :: Lens.Lens' DescribeTransitGateways (Prelude.Maybe Prelude.Bool)
describeTransitGateways_dryRun :: Lens' DescribeTransitGateways (Maybe Bool)
describeTransitGateways_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGateways' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeTransitGateways
s@DescribeTransitGateways' {} Maybe Bool
a -> DescribeTransitGateways
s {$sel:dryRun:DescribeTransitGateways' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeTransitGateways)

-- | One or more filters. The possible values are:
--
-- -   @options.propagation-default-route-table-id@ - The ID of the default
--     propagation route table.
--
-- -   @options.amazon-side-asn@ - The private ASN for the Amazon side of a
--     BGP session.
--
-- -   @options.association-default-route-table-id@ - The ID of the default
--     association route table.
--
-- -   @options.auto-accept-shared-attachments@ - Indicates whether there
--     is automatic acceptance of attachment requests (@enable@ |
--     @disable@).
--
-- -   @options.default-route-table-association@ - Indicates whether
--     resource attachments are automatically associated with the default
--     association route table (@enable@ | @disable@).
--
-- -   @options.default-route-table-propagation@ - Indicates whether
--     resource attachments automatically propagate routes to the default
--     propagation route table (@enable@ | @disable@).
--
-- -   @options.dns-support@ - Indicates whether DNS support is enabled
--     (@enable@ | @disable@).
--
-- -   @options.vpn-ecmp-support@ - Indicates whether Equal Cost Multipath
--     Protocol support is enabled (@enable@ | @disable@).
--
-- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
--     transit gateway.
--
-- -   @state@ - The state of the transit gateway (@available@ | @deleted@
--     | @deleting@ | @modifying@ | @pending@).
--
-- -   @transit-gateway-id@ - The ID of the transit gateway.
describeTransitGateways_filters :: Lens.Lens' DescribeTransitGateways (Prelude.Maybe [Filter])
describeTransitGateways_filters :: Lens' DescribeTransitGateways (Maybe [Filter])
describeTransitGateways_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGateways' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeTransitGateways
s@DescribeTransitGateways' {} Maybe [Filter]
a -> DescribeTransitGateways
s {$sel:filters:DescribeTransitGateways' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeTransitGateways) 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.
describeTransitGateways_maxResults :: Lens.Lens' DescribeTransitGateways (Prelude.Maybe Prelude.Natural)
describeTransitGateways_maxResults :: Lens' DescribeTransitGateways (Maybe Natural)
describeTransitGateways_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGateways' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeTransitGateways
s@DescribeTransitGateways' {} Maybe Natural
a -> DescribeTransitGateways
s {$sel:maxResults:DescribeTransitGateways' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeTransitGateways)

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

-- | The IDs of the transit gateways.
describeTransitGateways_transitGatewayIds :: Lens.Lens' DescribeTransitGateways (Prelude.Maybe [Prelude.Text])
describeTransitGateways_transitGatewayIds :: Lens' DescribeTransitGateways (Maybe [Text])
describeTransitGateways_transitGatewayIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGateways' {Maybe [Text]
transitGatewayIds :: Maybe [Text]
$sel:transitGatewayIds:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe [Text]
transitGatewayIds} -> Maybe [Text]
transitGatewayIds) (\s :: DescribeTransitGateways
s@DescribeTransitGateways' {} Maybe [Text]
a -> DescribeTransitGateways
s {$sel:transitGatewayIds:DescribeTransitGateways' :: Maybe [Text]
transitGatewayIds = Maybe [Text]
a} :: DescribeTransitGateways) 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 DescribeTransitGateways where
  page :: DescribeTransitGateways
-> AWSResponse DescribeTransitGateways
-> Maybe DescribeTransitGateways
page DescribeTransitGateways
rq AWSResponse DescribeTransitGateways
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeTransitGateways
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTransitGatewaysResponse (Maybe Text)
describeTransitGatewaysResponse_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 DescribeTransitGateways
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTransitGatewaysResponse (Maybe [TransitGateway])
describeTransitGatewaysResponse_transitGateways
            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.$ DescribeTransitGateways
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeTransitGateways (Maybe Text)
describeTransitGateways_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeTransitGateways
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTransitGatewaysResponse (Maybe Text)
describeTransitGatewaysResponse_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 DescribeTransitGateways where
  type
    AWSResponse DescribeTransitGateways =
      DescribeTransitGatewaysResponse
  request :: (Service -> Service)
-> DescribeTransitGateways -> Request DescribeTransitGateways
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 DescribeTransitGateways
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTransitGateways)))
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 [TransitGateway] -> Int -> DescribeTransitGatewaysResponse
DescribeTransitGatewaysResponse'
            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
"transitGatewaySet"
                            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 DescribeTransitGateways where
  hashWithSalt :: Int -> DescribeTransitGateways -> Int
hashWithSalt Int
_salt DescribeTransitGateways' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
transitGatewayIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:transitGatewayIds:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe [Text]
$sel:nextToken:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe Text
$sel:maxResults:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe Natural
$sel:filters:DescribeTransitGateways' :: DescribeTransitGateways -> Maybe [Filter]
$sel:dryRun:DescribeTransitGateways' :: DescribeTransitGateways -> 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]
transitGatewayIds

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

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

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

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

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

-- |
-- Create a value of 'DescribeTransitGatewaysResponse' 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', 'describeTransitGatewaysResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'transitGateways', 'describeTransitGatewaysResponse_transitGateways' - Information about the transit gateways.
--
-- 'httpStatus', 'describeTransitGatewaysResponse_httpStatus' - The response's http status code.
newDescribeTransitGatewaysResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTransitGatewaysResponse
newDescribeTransitGatewaysResponse :: Int -> DescribeTransitGatewaysResponse
newDescribeTransitGatewaysResponse Int
pHttpStatus_ =
  DescribeTransitGatewaysResponse'
    { $sel:nextToken:DescribeTransitGatewaysResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:transitGateways:DescribeTransitGatewaysResponse' :: Maybe [TransitGateway]
transitGateways = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTransitGatewaysResponse' :: 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.
describeTransitGatewaysResponse_nextToken :: Lens.Lens' DescribeTransitGatewaysResponse (Prelude.Maybe Prelude.Text)
describeTransitGatewaysResponse_nextToken :: Lens' DescribeTransitGatewaysResponse (Maybe Text)
describeTransitGatewaysResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewaysResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeTransitGatewaysResponse' :: DescribeTransitGatewaysResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeTransitGatewaysResponse
s@DescribeTransitGatewaysResponse' {} Maybe Text
a -> DescribeTransitGatewaysResponse
s {$sel:nextToken:DescribeTransitGatewaysResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeTransitGatewaysResponse)

-- | Information about the transit gateways.
describeTransitGatewaysResponse_transitGateways :: Lens.Lens' DescribeTransitGatewaysResponse (Prelude.Maybe [TransitGateway])
describeTransitGatewaysResponse_transitGateways :: Lens' DescribeTransitGatewaysResponse (Maybe [TransitGateway])
describeTransitGatewaysResponse_transitGateways = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewaysResponse' {Maybe [TransitGateway]
transitGateways :: Maybe [TransitGateway]
$sel:transitGateways:DescribeTransitGatewaysResponse' :: DescribeTransitGatewaysResponse -> Maybe [TransitGateway]
transitGateways} -> Maybe [TransitGateway]
transitGateways) (\s :: DescribeTransitGatewaysResponse
s@DescribeTransitGatewaysResponse' {} Maybe [TransitGateway]
a -> DescribeTransitGatewaysResponse
s {$sel:transitGateways:DescribeTransitGatewaysResponse' :: Maybe [TransitGateway]
transitGateways = Maybe [TransitGateway]
a} :: DescribeTransitGatewaysResponse) 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.
describeTransitGatewaysResponse_httpStatus :: Lens.Lens' DescribeTransitGatewaysResponse Prelude.Int
describeTransitGatewaysResponse_httpStatus :: Lens' DescribeTransitGatewaysResponse Int
describeTransitGatewaysResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewaysResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTransitGatewaysResponse' :: DescribeTransitGatewaysResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTransitGatewaysResponse
s@DescribeTransitGatewaysResponse' {} Int
a -> DescribeTransitGatewaysResponse
s {$sel:httpStatus:DescribeTransitGatewaysResponse' :: Int
httpStatus = Int
a} :: DescribeTransitGatewaysResponse)

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