{-# 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.DescribeTransitGatewayAttachments
-- 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 attachments between resources and transit
-- gateways. By default, all attachments are described. Alternatively, you
-- can filter the results by attachment ID, attachment state, resource ID,
-- or resource owner.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeTransitGatewayAttachments
  ( -- * Creating a Request
    DescribeTransitGatewayAttachments (..),
    newDescribeTransitGatewayAttachments,

    -- * Request Lenses
    describeTransitGatewayAttachments_dryRun,
    describeTransitGatewayAttachments_filters,
    describeTransitGatewayAttachments_maxResults,
    describeTransitGatewayAttachments_nextToken,
    describeTransitGatewayAttachments_transitGatewayAttachmentIds,

    -- * Destructuring the Response
    DescribeTransitGatewayAttachmentsResponse (..),
    newDescribeTransitGatewayAttachmentsResponse,

    -- * Response Lenses
    describeTransitGatewayAttachmentsResponse_nextToken,
    describeTransitGatewayAttachmentsResponse_transitGatewayAttachments,
    describeTransitGatewayAttachmentsResponse_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:/ 'newDescribeTransitGatewayAttachments' smart constructor.
data DescribeTransitGatewayAttachments = DescribeTransitGatewayAttachments'
  { -- | 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@.
    DescribeTransitGatewayAttachments -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters. The possible values are:
    --
    -- -   @association.state@ - The state of the association (@associating@ |
    --     @associated@ | @disassociating@).
    --
    -- -   @association.transit-gateway-route-table-id@ - The ID of the route
    --     table for the transit gateway.
    --
    -- -   @resource-id@ - The ID of the resource.
    --
    -- -   @resource-owner-id@ - The ID of the Amazon Web Services account that
    --     owns the resource.
    --
    -- -   @resource-type@ - The resource type. Valid values are @vpc@ | @vpn@
    --     | @direct-connect-gateway@ | @peering@ | @connect@.
    --
    -- -   @state@ - The state of the attachment. Valid values are @available@
    --     | @deleted@ | @deleting@ | @failed@ | @failing@ |
    --     @initiatingRequest@ | @modifying@ | @pendingAcceptance@ | @pending@
    --     | @rollingBack@ | @rejected@ | @rejecting@.
    --
    -- -   @transit-gateway-attachment-id@ - The ID of the attachment.
    --
    -- -   @transit-gateway-id@ - The ID of the transit gateway.
    --
    -- -   @transit-gateway-owner-id@ - The ID of the Amazon Web Services
    --     account that owns the transit gateway.
    DescribeTransitGatewayAttachments -> 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.
    DescribeTransitGatewayAttachments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    DescribeTransitGatewayAttachments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The IDs of the attachments.
    DescribeTransitGatewayAttachments -> Maybe [Text]
transitGatewayAttachmentIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeTransitGatewayAttachments
-> DescribeTransitGatewayAttachments -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTransitGatewayAttachments
-> DescribeTransitGatewayAttachments -> Bool
$c/= :: DescribeTransitGatewayAttachments
-> DescribeTransitGatewayAttachments -> Bool
== :: DescribeTransitGatewayAttachments
-> DescribeTransitGatewayAttachments -> Bool
$c== :: DescribeTransitGatewayAttachments
-> DescribeTransitGatewayAttachments -> Bool
Prelude.Eq, ReadPrec [DescribeTransitGatewayAttachments]
ReadPrec DescribeTransitGatewayAttachments
Int -> ReadS DescribeTransitGatewayAttachments
ReadS [DescribeTransitGatewayAttachments]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTransitGatewayAttachments]
$creadListPrec :: ReadPrec [DescribeTransitGatewayAttachments]
readPrec :: ReadPrec DescribeTransitGatewayAttachments
$creadPrec :: ReadPrec DescribeTransitGatewayAttachments
readList :: ReadS [DescribeTransitGatewayAttachments]
$creadList :: ReadS [DescribeTransitGatewayAttachments]
readsPrec :: Int -> ReadS DescribeTransitGatewayAttachments
$creadsPrec :: Int -> ReadS DescribeTransitGatewayAttachments
Prelude.Read, Int -> DescribeTransitGatewayAttachments -> ShowS
[DescribeTransitGatewayAttachments] -> ShowS
DescribeTransitGatewayAttachments -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTransitGatewayAttachments] -> ShowS
$cshowList :: [DescribeTransitGatewayAttachments] -> ShowS
show :: DescribeTransitGatewayAttachments -> String
$cshow :: DescribeTransitGatewayAttachments -> String
showsPrec :: Int -> DescribeTransitGatewayAttachments -> ShowS
$cshowsPrec :: Int -> DescribeTransitGatewayAttachments -> ShowS
Prelude.Show, forall x.
Rep DescribeTransitGatewayAttachments x
-> DescribeTransitGatewayAttachments
forall x.
DescribeTransitGatewayAttachments
-> Rep DescribeTransitGatewayAttachments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTransitGatewayAttachments x
-> DescribeTransitGatewayAttachments
$cfrom :: forall x.
DescribeTransitGatewayAttachments
-> Rep DescribeTransitGatewayAttachments x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTransitGatewayAttachments' 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', 'describeTransitGatewayAttachments_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', 'describeTransitGatewayAttachments_filters' - One or more filters. The possible values are:
--
-- -   @association.state@ - The state of the association (@associating@ |
--     @associated@ | @disassociating@).
--
-- -   @association.transit-gateway-route-table-id@ - The ID of the route
--     table for the transit gateway.
--
-- -   @resource-id@ - The ID of the resource.
--
-- -   @resource-owner-id@ - The ID of the Amazon Web Services account that
--     owns the resource.
--
-- -   @resource-type@ - The resource type. Valid values are @vpc@ | @vpn@
--     | @direct-connect-gateway@ | @peering@ | @connect@.
--
-- -   @state@ - The state of the attachment. Valid values are @available@
--     | @deleted@ | @deleting@ | @failed@ | @failing@ |
--     @initiatingRequest@ | @modifying@ | @pendingAcceptance@ | @pending@
--     | @rollingBack@ | @rejected@ | @rejecting@.
--
-- -   @transit-gateway-attachment-id@ - The ID of the attachment.
--
-- -   @transit-gateway-id@ - The ID of the transit gateway.
--
-- -   @transit-gateway-owner-id@ - The ID of the Amazon Web Services
--     account that owns the transit gateway.
--
-- 'maxResults', 'describeTransitGatewayAttachments_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', 'describeTransitGatewayAttachments_nextToken' - The token for the next page of results.
--
-- 'transitGatewayAttachmentIds', 'describeTransitGatewayAttachments_transitGatewayAttachmentIds' - The IDs of the attachments.
newDescribeTransitGatewayAttachments ::
  DescribeTransitGatewayAttachments
newDescribeTransitGatewayAttachments :: DescribeTransitGatewayAttachments
newDescribeTransitGatewayAttachments =
  DescribeTransitGatewayAttachments'
    { $sel:dryRun:DescribeTransitGatewayAttachments' :: Maybe Bool
dryRun =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeTransitGatewayAttachments' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeTransitGatewayAttachments' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeTransitGatewayAttachments' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAttachmentIds:DescribeTransitGatewayAttachments' :: Maybe [Text]
transitGatewayAttachmentIds =
        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@.
describeTransitGatewayAttachments_dryRun :: Lens.Lens' DescribeTransitGatewayAttachments (Prelude.Maybe Prelude.Bool)
describeTransitGatewayAttachments_dryRun :: Lens' DescribeTransitGatewayAttachments (Maybe Bool)
describeTransitGatewayAttachments_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachments' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeTransitGatewayAttachments
s@DescribeTransitGatewayAttachments' {} Maybe Bool
a -> DescribeTransitGatewayAttachments
s {$sel:dryRun:DescribeTransitGatewayAttachments' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeTransitGatewayAttachments)

-- | One or more filters. The possible values are:
--
-- -   @association.state@ - The state of the association (@associating@ |
--     @associated@ | @disassociating@).
--
-- -   @association.transit-gateway-route-table-id@ - The ID of the route
--     table for the transit gateway.
--
-- -   @resource-id@ - The ID of the resource.
--
-- -   @resource-owner-id@ - The ID of the Amazon Web Services account that
--     owns the resource.
--
-- -   @resource-type@ - The resource type. Valid values are @vpc@ | @vpn@
--     | @direct-connect-gateway@ | @peering@ | @connect@.
--
-- -   @state@ - The state of the attachment. Valid values are @available@
--     | @deleted@ | @deleting@ | @failed@ | @failing@ |
--     @initiatingRequest@ | @modifying@ | @pendingAcceptance@ | @pending@
--     | @rollingBack@ | @rejected@ | @rejecting@.
--
-- -   @transit-gateway-attachment-id@ - The ID of the attachment.
--
-- -   @transit-gateway-id@ - The ID of the transit gateway.
--
-- -   @transit-gateway-owner-id@ - The ID of the Amazon Web Services
--     account that owns the transit gateway.
describeTransitGatewayAttachments_filters :: Lens.Lens' DescribeTransitGatewayAttachments (Prelude.Maybe [Filter])
describeTransitGatewayAttachments_filters :: Lens' DescribeTransitGatewayAttachments (Maybe [Filter])
describeTransitGatewayAttachments_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachments' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeTransitGatewayAttachments
s@DescribeTransitGatewayAttachments' {} Maybe [Filter]
a -> DescribeTransitGatewayAttachments
s {$sel:filters:DescribeTransitGatewayAttachments' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeTransitGatewayAttachments) 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.
describeTransitGatewayAttachments_maxResults :: Lens.Lens' DescribeTransitGatewayAttachments (Prelude.Maybe Prelude.Natural)
describeTransitGatewayAttachments_maxResults :: Lens' DescribeTransitGatewayAttachments (Maybe Natural)
describeTransitGatewayAttachments_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeTransitGatewayAttachments
s@DescribeTransitGatewayAttachments' {} Maybe Natural
a -> DescribeTransitGatewayAttachments
s {$sel:maxResults:DescribeTransitGatewayAttachments' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeTransitGatewayAttachments)

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

-- | The IDs of the attachments.
describeTransitGatewayAttachments_transitGatewayAttachmentIds :: Lens.Lens' DescribeTransitGatewayAttachments (Prelude.Maybe [Prelude.Text])
describeTransitGatewayAttachments_transitGatewayAttachmentIds :: Lens' DescribeTransitGatewayAttachments (Maybe [Text])
describeTransitGatewayAttachments_transitGatewayAttachmentIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachments' {Maybe [Text]
transitGatewayAttachmentIds :: Maybe [Text]
$sel:transitGatewayAttachmentIds:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe [Text]
transitGatewayAttachmentIds} -> Maybe [Text]
transitGatewayAttachmentIds) (\s :: DescribeTransitGatewayAttachments
s@DescribeTransitGatewayAttachments' {} Maybe [Text]
a -> DescribeTransitGatewayAttachments
s {$sel:transitGatewayAttachmentIds:DescribeTransitGatewayAttachments' :: Maybe [Text]
transitGatewayAttachmentIds = Maybe [Text]
a} :: DescribeTransitGatewayAttachments) 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
    DescribeTransitGatewayAttachments
  where
  page :: DescribeTransitGatewayAttachments
-> AWSResponse DescribeTransitGatewayAttachments
-> Maybe DescribeTransitGatewayAttachments
page DescribeTransitGatewayAttachments
rq AWSResponse DescribeTransitGatewayAttachments
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeTransitGatewayAttachments
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTransitGatewayAttachmentsResponse (Maybe Text)
describeTransitGatewayAttachmentsResponse_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 DescribeTransitGatewayAttachments
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  DescribeTransitGatewayAttachmentsResponse
  (Maybe [TransitGatewayAttachment])
describeTransitGatewayAttachmentsResponse_transitGatewayAttachments
            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.$ DescribeTransitGatewayAttachments
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeTransitGatewayAttachments (Maybe Text)
describeTransitGatewayAttachments_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeTransitGatewayAttachments
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTransitGatewayAttachmentsResponse (Maybe Text)
describeTransitGatewayAttachmentsResponse_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
    DescribeTransitGatewayAttachments
  where
  type
    AWSResponse DescribeTransitGatewayAttachments =
      DescribeTransitGatewayAttachmentsResponse
  request :: (Service -> Service)
-> DescribeTransitGatewayAttachments
-> Request DescribeTransitGatewayAttachments
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 DescribeTransitGatewayAttachments
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeTransitGatewayAttachments)))
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 [TransitGatewayAttachment]
-> Int
-> DescribeTransitGatewayAttachmentsResponse
DescribeTransitGatewayAttachmentsResponse'
            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
"transitGatewayAttachments"
                            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
    DescribeTransitGatewayAttachments
  where
  hashWithSalt :: Int -> DescribeTransitGatewayAttachments -> Int
hashWithSalt
    Int
_salt
    DescribeTransitGatewayAttachments' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
transitGatewayAttachmentIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:transitGatewayAttachmentIds:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe [Text]
$sel:nextToken:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe Text
$sel:maxResults:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe Natural
$sel:filters:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> Maybe [Filter]
$sel:dryRun:DescribeTransitGatewayAttachments' :: DescribeTransitGatewayAttachments -> 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]
transitGatewayAttachmentIds

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

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

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

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

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

-- |
-- Create a value of 'DescribeTransitGatewayAttachmentsResponse' 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', 'describeTransitGatewayAttachmentsResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'transitGatewayAttachments', 'describeTransitGatewayAttachmentsResponse_transitGatewayAttachments' - Information about the attachments.
--
-- 'httpStatus', 'describeTransitGatewayAttachmentsResponse_httpStatus' - The response's http status code.
newDescribeTransitGatewayAttachmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTransitGatewayAttachmentsResponse
newDescribeTransitGatewayAttachmentsResponse :: Int -> DescribeTransitGatewayAttachmentsResponse
newDescribeTransitGatewayAttachmentsResponse
  Int
pHttpStatus_ =
    DescribeTransitGatewayAttachmentsResponse'
      { $sel:nextToken:DescribeTransitGatewayAttachmentsResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:transitGatewayAttachments:DescribeTransitGatewayAttachmentsResponse' :: Maybe [TransitGatewayAttachment]
transitGatewayAttachments =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeTransitGatewayAttachmentsResponse' :: 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.
describeTransitGatewayAttachmentsResponse_nextToken :: Lens.Lens' DescribeTransitGatewayAttachmentsResponse (Prelude.Maybe Prelude.Text)
describeTransitGatewayAttachmentsResponse_nextToken :: Lens' DescribeTransitGatewayAttachmentsResponse (Maybe Text)
describeTransitGatewayAttachmentsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeTransitGatewayAttachmentsResponse' :: DescribeTransitGatewayAttachmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeTransitGatewayAttachmentsResponse
s@DescribeTransitGatewayAttachmentsResponse' {} Maybe Text
a -> DescribeTransitGatewayAttachmentsResponse
s {$sel:nextToken:DescribeTransitGatewayAttachmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeTransitGatewayAttachmentsResponse)

-- | Information about the attachments.
describeTransitGatewayAttachmentsResponse_transitGatewayAttachments :: Lens.Lens' DescribeTransitGatewayAttachmentsResponse (Prelude.Maybe [TransitGatewayAttachment])
describeTransitGatewayAttachmentsResponse_transitGatewayAttachments :: Lens'
  DescribeTransitGatewayAttachmentsResponse
  (Maybe [TransitGatewayAttachment])
describeTransitGatewayAttachmentsResponse_transitGatewayAttachments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachmentsResponse' {Maybe [TransitGatewayAttachment]
transitGatewayAttachments :: Maybe [TransitGatewayAttachment]
$sel:transitGatewayAttachments:DescribeTransitGatewayAttachmentsResponse' :: DescribeTransitGatewayAttachmentsResponse
-> Maybe [TransitGatewayAttachment]
transitGatewayAttachments} -> Maybe [TransitGatewayAttachment]
transitGatewayAttachments) (\s :: DescribeTransitGatewayAttachmentsResponse
s@DescribeTransitGatewayAttachmentsResponse' {} Maybe [TransitGatewayAttachment]
a -> DescribeTransitGatewayAttachmentsResponse
s {$sel:transitGatewayAttachments:DescribeTransitGatewayAttachmentsResponse' :: Maybe [TransitGatewayAttachment]
transitGatewayAttachments = Maybe [TransitGatewayAttachment]
a} :: DescribeTransitGatewayAttachmentsResponse) 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.
describeTransitGatewayAttachmentsResponse_httpStatus :: Lens.Lens' DescribeTransitGatewayAttachmentsResponse Prelude.Int
describeTransitGatewayAttachmentsResponse_httpStatus :: Lens' DescribeTransitGatewayAttachmentsResponse Int
describeTransitGatewayAttachmentsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTransitGatewayAttachmentsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTransitGatewayAttachmentsResponse' :: DescribeTransitGatewayAttachmentsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTransitGatewayAttachmentsResponse
s@DescribeTransitGatewayAttachmentsResponse' {} Int
a -> DescribeTransitGatewayAttachmentsResponse
s {$sel:httpStatus:DescribeTransitGatewayAttachmentsResponse' :: Int
httpStatus = Int
a} :: DescribeTransitGatewayAttachmentsResponse)

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