{-# 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.DirectConnect.DescribeDirectConnectGatewayAttachments
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the attachments between your Direct Connect gateways and virtual
-- interfaces. You must specify a Direct Connect gateway, a virtual
-- interface, or both. If you specify a Direct Connect gateway, the
-- response contains all virtual interfaces attached to the Direct Connect
-- gateway. If you specify a virtual interface, the response contains all
-- Direct Connect gateways attached to the virtual interface. If you
-- specify both, the response contains the attachment between the Direct
-- Connect gateway and the virtual interface.
--
-- This operation returns paginated results.
module Amazonka.DirectConnect.DescribeDirectConnectGatewayAttachments
  ( -- * Creating a Request
    DescribeDirectConnectGatewayAttachments (..),
    newDescribeDirectConnectGatewayAttachments,

    -- * Request Lenses
    describeDirectConnectGatewayAttachments_directConnectGatewayId,
    describeDirectConnectGatewayAttachments_nextToken,
    describeDirectConnectGatewayAttachments_maxResults,
    describeDirectConnectGatewayAttachments_virtualInterfaceId,

    -- * Destructuring the Response
    DescribeDirectConnectGatewayAttachmentsResponse (..),
    newDescribeDirectConnectGatewayAttachmentsResponse,

    -- * Response Lenses
    describeDirectConnectGatewayAttachmentsResponse_nextToken,
    describeDirectConnectGatewayAttachmentsResponse_directConnectGatewayAttachments,
    describeDirectConnectGatewayAttachmentsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeDirectConnectGatewayAttachments' smart constructor.
data DescribeDirectConnectGatewayAttachments = DescribeDirectConnectGatewayAttachments'
  { -- | The ID of the Direct Connect gateway.
    DescribeDirectConnectGatewayAttachments -> Maybe Text
directConnectGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The token provided in the previous call to retrieve the next page.
    DescribeDirectConnectGatewayAttachments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return with a single call. To retrieve
    -- the remaining results, make another call with the returned @nextToken@
    -- value.
    --
    -- If @MaxResults@ is given a value larger than 100, only 100 results are
    -- returned.
    DescribeDirectConnectGatewayAttachments -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The ID of the virtual interface.
    DescribeDirectConnectGatewayAttachments -> Maybe Text
virtualInterfaceId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeDirectConnectGatewayAttachments
-> DescribeDirectConnectGatewayAttachments -> Bool
(DescribeDirectConnectGatewayAttachments
 -> DescribeDirectConnectGatewayAttachments -> Bool)
-> (DescribeDirectConnectGatewayAttachments
    -> DescribeDirectConnectGatewayAttachments -> Bool)
-> Eq DescribeDirectConnectGatewayAttachments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDirectConnectGatewayAttachments
-> DescribeDirectConnectGatewayAttachments -> Bool
$c/= :: DescribeDirectConnectGatewayAttachments
-> DescribeDirectConnectGatewayAttachments -> Bool
== :: DescribeDirectConnectGatewayAttachments
-> DescribeDirectConnectGatewayAttachments -> Bool
$c== :: DescribeDirectConnectGatewayAttachments
-> DescribeDirectConnectGatewayAttachments -> Bool
Prelude.Eq, ReadPrec [DescribeDirectConnectGatewayAttachments]
ReadPrec DescribeDirectConnectGatewayAttachments
Int -> ReadS DescribeDirectConnectGatewayAttachments
ReadS [DescribeDirectConnectGatewayAttachments]
(Int -> ReadS DescribeDirectConnectGatewayAttachments)
-> ReadS [DescribeDirectConnectGatewayAttachments]
-> ReadPrec DescribeDirectConnectGatewayAttachments
-> ReadPrec [DescribeDirectConnectGatewayAttachments]
-> Read DescribeDirectConnectGatewayAttachments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDirectConnectGatewayAttachments]
$creadListPrec :: ReadPrec [DescribeDirectConnectGatewayAttachments]
readPrec :: ReadPrec DescribeDirectConnectGatewayAttachments
$creadPrec :: ReadPrec DescribeDirectConnectGatewayAttachments
readList :: ReadS [DescribeDirectConnectGatewayAttachments]
$creadList :: ReadS [DescribeDirectConnectGatewayAttachments]
readsPrec :: Int -> ReadS DescribeDirectConnectGatewayAttachments
$creadsPrec :: Int -> ReadS DescribeDirectConnectGatewayAttachments
Prelude.Read, Int -> DescribeDirectConnectGatewayAttachments -> ShowS
[DescribeDirectConnectGatewayAttachments] -> ShowS
DescribeDirectConnectGatewayAttachments -> String
(Int -> DescribeDirectConnectGatewayAttachments -> ShowS)
-> (DescribeDirectConnectGatewayAttachments -> String)
-> ([DescribeDirectConnectGatewayAttachments] -> ShowS)
-> Show DescribeDirectConnectGatewayAttachments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDirectConnectGatewayAttachments] -> ShowS
$cshowList :: [DescribeDirectConnectGatewayAttachments] -> ShowS
show :: DescribeDirectConnectGatewayAttachments -> String
$cshow :: DescribeDirectConnectGatewayAttachments -> String
showsPrec :: Int -> DescribeDirectConnectGatewayAttachments -> ShowS
$cshowsPrec :: Int -> DescribeDirectConnectGatewayAttachments -> ShowS
Prelude.Show, (forall x.
 DescribeDirectConnectGatewayAttachments
 -> Rep DescribeDirectConnectGatewayAttachments x)
-> (forall x.
    Rep DescribeDirectConnectGatewayAttachments x
    -> DescribeDirectConnectGatewayAttachments)
-> Generic DescribeDirectConnectGatewayAttachments
forall x.
Rep DescribeDirectConnectGatewayAttachments x
-> DescribeDirectConnectGatewayAttachments
forall x.
DescribeDirectConnectGatewayAttachments
-> Rep DescribeDirectConnectGatewayAttachments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDirectConnectGatewayAttachments x
-> DescribeDirectConnectGatewayAttachments
$cfrom :: forall x.
DescribeDirectConnectGatewayAttachments
-> Rep DescribeDirectConnectGatewayAttachments x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDirectConnectGatewayAttachments' 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:
--
-- 'directConnectGatewayId', 'describeDirectConnectGatewayAttachments_directConnectGatewayId' - The ID of the Direct Connect gateway.
--
-- 'nextToken', 'describeDirectConnectGatewayAttachments_nextToken' - The token provided in the previous call to retrieve the next page.
--
-- 'maxResults', 'describeDirectConnectGatewayAttachments_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.
--
-- If @MaxResults@ is given a value larger than 100, only 100 results are
-- returned.
--
-- 'virtualInterfaceId', 'describeDirectConnectGatewayAttachments_virtualInterfaceId' - The ID of the virtual interface.
newDescribeDirectConnectGatewayAttachments ::
  DescribeDirectConnectGatewayAttachments
newDescribeDirectConnectGatewayAttachments :: DescribeDirectConnectGatewayAttachments
newDescribeDirectConnectGatewayAttachments =
  DescribeDirectConnectGatewayAttachments' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> DescribeDirectConnectGatewayAttachments
DescribeDirectConnectGatewayAttachments'
    { $sel:directConnectGatewayId:DescribeDirectConnectGatewayAttachments' :: Maybe Text
directConnectGatewayId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeDirectConnectGatewayAttachments' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeDirectConnectGatewayAttachments' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:virtualInterfaceId:DescribeDirectConnectGatewayAttachments' :: Maybe Text
virtualInterfaceId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the Direct Connect gateway.
describeDirectConnectGatewayAttachments_directConnectGatewayId :: Lens.Lens' DescribeDirectConnectGatewayAttachments (Prelude.Maybe Prelude.Text)
describeDirectConnectGatewayAttachments_directConnectGatewayId :: (Maybe Text -> f (Maybe Text))
-> DescribeDirectConnectGatewayAttachments
-> f DescribeDirectConnectGatewayAttachments
describeDirectConnectGatewayAttachments_directConnectGatewayId = (DescribeDirectConnectGatewayAttachments -> Maybe Text)
-> (DescribeDirectConnectGatewayAttachments
    -> Maybe Text -> DescribeDirectConnectGatewayAttachments)
-> Lens
     DescribeDirectConnectGatewayAttachments
     DescribeDirectConnectGatewayAttachments
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewayAttachments' {Maybe Text
directConnectGatewayId :: Maybe Text
$sel:directConnectGatewayId:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Text
directConnectGatewayId} -> Maybe Text
directConnectGatewayId) (\s :: DescribeDirectConnectGatewayAttachments
s@DescribeDirectConnectGatewayAttachments' {} Maybe Text
a -> DescribeDirectConnectGatewayAttachments
s {$sel:directConnectGatewayId:DescribeDirectConnectGatewayAttachments' :: Maybe Text
directConnectGatewayId = Maybe Text
a} :: DescribeDirectConnectGatewayAttachments)

-- | The token provided in the previous call to retrieve the next page.
describeDirectConnectGatewayAttachments_nextToken :: Lens.Lens' DescribeDirectConnectGatewayAttachments (Prelude.Maybe Prelude.Text)
describeDirectConnectGatewayAttachments_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeDirectConnectGatewayAttachments
-> f DescribeDirectConnectGatewayAttachments
describeDirectConnectGatewayAttachments_nextToken = (DescribeDirectConnectGatewayAttachments -> Maybe Text)
-> (DescribeDirectConnectGatewayAttachments
    -> Maybe Text -> DescribeDirectConnectGatewayAttachments)
-> Lens
     DescribeDirectConnectGatewayAttachments
     DescribeDirectConnectGatewayAttachments
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewayAttachments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDirectConnectGatewayAttachments
s@DescribeDirectConnectGatewayAttachments' {} Maybe Text
a -> DescribeDirectConnectGatewayAttachments
s {$sel:nextToken:DescribeDirectConnectGatewayAttachments' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDirectConnectGatewayAttachments)

-- | The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
--
-- If @MaxResults@ is given a value larger than 100, only 100 results are
-- returned.
describeDirectConnectGatewayAttachments_maxResults :: Lens.Lens' DescribeDirectConnectGatewayAttachments (Prelude.Maybe Prelude.Int)
describeDirectConnectGatewayAttachments_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeDirectConnectGatewayAttachments
-> f DescribeDirectConnectGatewayAttachments
describeDirectConnectGatewayAttachments_maxResults = (DescribeDirectConnectGatewayAttachments -> Maybe Int)
-> (DescribeDirectConnectGatewayAttachments
    -> Maybe Int -> DescribeDirectConnectGatewayAttachments)
-> Lens
     DescribeDirectConnectGatewayAttachments
     DescribeDirectConnectGatewayAttachments
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewayAttachments' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeDirectConnectGatewayAttachments
s@DescribeDirectConnectGatewayAttachments' {} Maybe Int
a -> DescribeDirectConnectGatewayAttachments
s {$sel:maxResults:DescribeDirectConnectGatewayAttachments' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeDirectConnectGatewayAttachments)

-- | The ID of the virtual interface.
describeDirectConnectGatewayAttachments_virtualInterfaceId :: Lens.Lens' DescribeDirectConnectGatewayAttachments (Prelude.Maybe Prelude.Text)
describeDirectConnectGatewayAttachments_virtualInterfaceId :: (Maybe Text -> f (Maybe Text))
-> DescribeDirectConnectGatewayAttachments
-> f DescribeDirectConnectGatewayAttachments
describeDirectConnectGatewayAttachments_virtualInterfaceId = (DescribeDirectConnectGatewayAttachments -> Maybe Text)
-> (DescribeDirectConnectGatewayAttachments
    -> Maybe Text -> DescribeDirectConnectGatewayAttachments)
-> Lens
     DescribeDirectConnectGatewayAttachments
     DescribeDirectConnectGatewayAttachments
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewayAttachments' {Maybe Text
virtualInterfaceId :: Maybe Text
$sel:virtualInterfaceId:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Text
virtualInterfaceId} -> Maybe Text
virtualInterfaceId) (\s :: DescribeDirectConnectGatewayAttachments
s@DescribeDirectConnectGatewayAttachments' {} Maybe Text
a -> DescribeDirectConnectGatewayAttachments
s {$sel:virtualInterfaceId:DescribeDirectConnectGatewayAttachments' :: Maybe Text
virtualInterfaceId = Maybe Text
a} :: DescribeDirectConnectGatewayAttachments)

instance
  Core.AWSPager
    DescribeDirectConnectGatewayAttachments
  where
  page :: DescribeDirectConnectGatewayAttachments
-> AWSResponse DescribeDirectConnectGatewayAttachments
-> Maybe DescribeDirectConnectGatewayAttachments
page DescribeDirectConnectGatewayAttachments
rq AWSResponse DescribeDirectConnectGatewayAttachments
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDirectConnectGatewayAttachments
DescribeDirectConnectGatewayAttachmentsResponse
rs
            DescribeDirectConnectGatewayAttachmentsResponse
-> Getting
     (First Text) DescribeDirectConnectGatewayAttachmentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDirectConnectGatewayAttachmentsResponse
-> Const
     (First Text) DescribeDirectConnectGatewayAttachmentsResponse
Lens' DescribeDirectConnectGatewayAttachmentsResponse (Maybe Text)
describeDirectConnectGatewayAttachmentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDirectConnectGatewayAttachmentsResponse
 -> Const
      (First Text) DescribeDirectConnectGatewayAttachmentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeDirectConnectGatewayAttachmentsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeDirectConnectGatewayAttachments
forall a. Maybe a
Prelude.Nothing
    | Maybe [DirectConnectGatewayAttachment] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDirectConnectGatewayAttachments
DescribeDirectConnectGatewayAttachmentsResponse
rs
            DescribeDirectConnectGatewayAttachmentsResponse
-> Getting
     (First [DirectConnectGatewayAttachment])
     DescribeDirectConnectGatewayAttachmentsResponse
     [DirectConnectGatewayAttachment]
-> Maybe [DirectConnectGatewayAttachment]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DirectConnectGatewayAttachment]
 -> Const
      (First [DirectConnectGatewayAttachment])
      (Maybe [DirectConnectGatewayAttachment]))
-> DescribeDirectConnectGatewayAttachmentsResponse
-> Const
     (First [DirectConnectGatewayAttachment])
     DescribeDirectConnectGatewayAttachmentsResponse
Lens'
  DescribeDirectConnectGatewayAttachmentsResponse
  (Maybe [DirectConnectGatewayAttachment])
describeDirectConnectGatewayAttachmentsResponse_directConnectGatewayAttachments
              ((Maybe [DirectConnectGatewayAttachment]
  -> Const
       (First [DirectConnectGatewayAttachment])
       (Maybe [DirectConnectGatewayAttachment]))
 -> DescribeDirectConnectGatewayAttachmentsResponse
 -> Const
      (First [DirectConnectGatewayAttachment])
      DescribeDirectConnectGatewayAttachmentsResponse)
-> (([DirectConnectGatewayAttachment]
     -> Const
          (First [DirectConnectGatewayAttachment])
          [DirectConnectGatewayAttachment])
    -> Maybe [DirectConnectGatewayAttachment]
    -> Const
         (First [DirectConnectGatewayAttachment])
         (Maybe [DirectConnectGatewayAttachment]))
-> Getting
     (First [DirectConnectGatewayAttachment])
     DescribeDirectConnectGatewayAttachmentsResponse
     [DirectConnectGatewayAttachment]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DirectConnectGatewayAttachment]
 -> Const
      (First [DirectConnectGatewayAttachment])
      [DirectConnectGatewayAttachment])
-> Maybe [DirectConnectGatewayAttachment]
-> Const
     (First [DirectConnectGatewayAttachment])
     (Maybe [DirectConnectGatewayAttachment])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeDirectConnectGatewayAttachments
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeDirectConnectGatewayAttachments
-> Maybe DescribeDirectConnectGatewayAttachments
forall a. a -> Maybe a
Prelude.Just (DescribeDirectConnectGatewayAttachments
 -> Maybe DescribeDirectConnectGatewayAttachments)
-> DescribeDirectConnectGatewayAttachments
-> Maybe DescribeDirectConnectGatewayAttachments
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeDirectConnectGatewayAttachments
rq
          DescribeDirectConnectGatewayAttachments
-> (DescribeDirectConnectGatewayAttachments
    -> DescribeDirectConnectGatewayAttachments)
-> DescribeDirectConnectGatewayAttachments
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeDirectConnectGatewayAttachments
-> Identity DescribeDirectConnectGatewayAttachments
Lens
  DescribeDirectConnectGatewayAttachments
  DescribeDirectConnectGatewayAttachments
  (Maybe Text)
  (Maybe Text)
describeDirectConnectGatewayAttachments_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeDirectConnectGatewayAttachments
 -> Identity DescribeDirectConnectGatewayAttachments)
-> Maybe Text
-> DescribeDirectConnectGatewayAttachments
-> DescribeDirectConnectGatewayAttachments
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeDirectConnectGatewayAttachments
DescribeDirectConnectGatewayAttachmentsResponse
rs
            DescribeDirectConnectGatewayAttachmentsResponse
-> Getting
     (First Text) DescribeDirectConnectGatewayAttachmentsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDirectConnectGatewayAttachmentsResponse
-> Const
     (First Text) DescribeDirectConnectGatewayAttachmentsResponse
Lens' DescribeDirectConnectGatewayAttachmentsResponse (Maybe Text)
describeDirectConnectGatewayAttachmentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDirectConnectGatewayAttachmentsResponse
 -> Const
      (First Text) DescribeDirectConnectGatewayAttachmentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) DescribeDirectConnectGatewayAttachmentsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    DescribeDirectConnectGatewayAttachments
  where
  type
    AWSResponse
      DescribeDirectConnectGatewayAttachments =
      DescribeDirectConnectGatewayAttachmentsResponse
  request :: DescribeDirectConnectGatewayAttachments
-> Request DescribeDirectConnectGatewayAttachments
request = Service
-> DescribeDirectConnectGatewayAttachments
-> Request DescribeDirectConnectGatewayAttachments
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDirectConnectGatewayAttachments
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeDirectConnectGatewayAttachments)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse DescribeDirectConnectGatewayAttachments))
-> Logger
-> Service
-> Proxy DescribeDirectConnectGatewayAttachments
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DescribeDirectConnectGatewayAttachments)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [DirectConnectGatewayAttachment]
-> Int
-> DescribeDirectConnectGatewayAttachmentsResponse
DescribeDirectConnectGatewayAttachmentsResponse'
            (Maybe Text
 -> Maybe [DirectConnectGatewayAttachment]
 -> Int
 -> DescribeDirectConnectGatewayAttachmentsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [DirectConnectGatewayAttachment]
      -> Int -> DescribeDirectConnectGatewayAttachmentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
              Either
  String
  (Maybe [DirectConnectGatewayAttachment]
   -> Int -> DescribeDirectConnectGatewayAttachmentsResponse)
-> Either String (Maybe [DirectConnectGatewayAttachment])
-> Either
     String (Int -> DescribeDirectConnectGatewayAttachmentsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [DirectConnectGatewayAttachment]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"directConnectGatewayAttachments"
                              Either String (Maybe (Maybe [DirectConnectGatewayAttachment]))
-> Maybe [DirectConnectGatewayAttachment]
-> Either String (Maybe [DirectConnectGatewayAttachment])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DirectConnectGatewayAttachment]
forall a. Monoid a => a
Prelude.mempty
                          )
              Either
  String (Int -> DescribeDirectConnectGatewayAttachmentsResponse)
-> Either String Int
-> Either String DescribeDirectConnectGatewayAttachmentsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DescribeDirectConnectGatewayAttachments

instance
  Prelude.NFData
    DescribeDirectConnectGatewayAttachments

instance
  Core.ToHeaders
    DescribeDirectConnectGatewayAttachments
  where
  toHeaders :: DescribeDirectConnectGatewayAttachments -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeDirectConnectGatewayAttachments -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.DescribeDirectConnectGatewayAttachments" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    DescribeDirectConnectGatewayAttachments
  where
  toJSON :: DescribeDirectConnectGatewayAttachments -> Value
toJSON DescribeDirectConnectGatewayAttachments' {Maybe Int
Maybe Text
virtualInterfaceId :: Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
directConnectGatewayId :: Maybe Text
$sel:virtualInterfaceId:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Text
$sel:maxResults:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Int
$sel:nextToken:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Text
$sel:directConnectGatewayId:DescribeDirectConnectGatewayAttachments' :: DescribeDirectConnectGatewayAttachments -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"directConnectGatewayId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
directConnectGatewayId,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Text
"virtualInterfaceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
virtualInterfaceId
          ]
      )

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

instance
  Core.ToQuery
    DescribeDirectConnectGatewayAttachments
  where
  toQuery :: DescribeDirectConnectGatewayAttachments -> QueryString
toQuery = QueryString
-> DescribeDirectConnectGatewayAttachments -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeDirectConnectGatewayAttachmentsResponse' smart constructor.
data DescribeDirectConnectGatewayAttachmentsResponse = DescribeDirectConnectGatewayAttachmentsResponse'
  { -- | The token to retrieve the next page.
    DescribeDirectConnectGatewayAttachmentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The attachments.
    DescribeDirectConnectGatewayAttachmentsResponse
-> Maybe [DirectConnectGatewayAttachment]
directConnectGatewayAttachments :: Prelude.Maybe [DirectConnectGatewayAttachment],
    -- | The response's http status code.
    DescribeDirectConnectGatewayAttachmentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDirectConnectGatewayAttachmentsResponse
-> DescribeDirectConnectGatewayAttachmentsResponse -> Bool
(DescribeDirectConnectGatewayAttachmentsResponse
 -> DescribeDirectConnectGatewayAttachmentsResponse -> Bool)
-> (DescribeDirectConnectGatewayAttachmentsResponse
    -> DescribeDirectConnectGatewayAttachmentsResponse -> Bool)
-> Eq DescribeDirectConnectGatewayAttachmentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDirectConnectGatewayAttachmentsResponse
-> DescribeDirectConnectGatewayAttachmentsResponse -> Bool
$c/= :: DescribeDirectConnectGatewayAttachmentsResponse
-> DescribeDirectConnectGatewayAttachmentsResponse -> Bool
== :: DescribeDirectConnectGatewayAttachmentsResponse
-> DescribeDirectConnectGatewayAttachmentsResponse -> Bool
$c== :: DescribeDirectConnectGatewayAttachmentsResponse
-> DescribeDirectConnectGatewayAttachmentsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDirectConnectGatewayAttachmentsResponse]
ReadPrec DescribeDirectConnectGatewayAttachmentsResponse
Int -> ReadS DescribeDirectConnectGatewayAttachmentsResponse
ReadS [DescribeDirectConnectGatewayAttachmentsResponse]
(Int -> ReadS DescribeDirectConnectGatewayAttachmentsResponse)
-> ReadS [DescribeDirectConnectGatewayAttachmentsResponse]
-> ReadPrec DescribeDirectConnectGatewayAttachmentsResponse
-> ReadPrec [DescribeDirectConnectGatewayAttachmentsResponse]
-> Read DescribeDirectConnectGatewayAttachmentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDirectConnectGatewayAttachmentsResponse]
$creadListPrec :: ReadPrec [DescribeDirectConnectGatewayAttachmentsResponse]
readPrec :: ReadPrec DescribeDirectConnectGatewayAttachmentsResponse
$creadPrec :: ReadPrec DescribeDirectConnectGatewayAttachmentsResponse
readList :: ReadS [DescribeDirectConnectGatewayAttachmentsResponse]
$creadList :: ReadS [DescribeDirectConnectGatewayAttachmentsResponse]
readsPrec :: Int -> ReadS DescribeDirectConnectGatewayAttachmentsResponse
$creadsPrec :: Int -> ReadS DescribeDirectConnectGatewayAttachmentsResponse
Prelude.Read, Int -> DescribeDirectConnectGatewayAttachmentsResponse -> ShowS
[DescribeDirectConnectGatewayAttachmentsResponse] -> ShowS
DescribeDirectConnectGatewayAttachmentsResponse -> String
(Int -> DescribeDirectConnectGatewayAttachmentsResponse -> ShowS)
-> (DescribeDirectConnectGatewayAttachmentsResponse -> String)
-> ([DescribeDirectConnectGatewayAttachmentsResponse] -> ShowS)
-> Show DescribeDirectConnectGatewayAttachmentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDirectConnectGatewayAttachmentsResponse] -> ShowS
$cshowList :: [DescribeDirectConnectGatewayAttachmentsResponse] -> ShowS
show :: DescribeDirectConnectGatewayAttachmentsResponse -> String
$cshow :: DescribeDirectConnectGatewayAttachmentsResponse -> String
showsPrec :: Int -> DescribeDirectConnectGatewayAttachmentsResponse -> ShowS
$cshowsPrec :: Int -> DescribeDirectConnectGatewayAttachmentsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDirectConnectGatewayAttachmentsResponse
 -> Rep DescribeDirectConnectGatewayAttachmentsResponse x)
-> (forall x.
    Rep DescribeDirectConnectGatewayAttachmentsResponse x
    -> DescribeDirectConnectGatewayAttachmentsResponse)
-> Generic DescribeDirectConnectGatewayAttachmentsResponse
forall x.
Rep DescribeDirectConnectGatewayAttachmentsResponse x
-> DescribeDirectConnectGatewayAttachmentsResponse
forall x.
DescribeDirectConnectGatewayAttachmentsResponse
-> Rep DescribeDirectConnectGatewayAttachmentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDirectConnectGatewayAttachmentsResponse x
-> DescribeDirectConnectGatewayAttachmentsResponse
$cfrom :: forall x.
DescribeDirectConnectGatewayAttachmentsResponse
-> Rep DescribeDirectConnectGatewayAttachmentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDirectConnectGatewayAttachmentsResponse' 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', 'describeDirectConnectGatewayAttachmentsResponse_nextToken' - The token to retrieve the next page.
--
-- 'directConnectGatewayAttachments', 'describeDirectConnectGatewayAttachmentsResponse_directConnectGatewayAttachments' - The attachments.
--
-- 'httpStatus', 'describeDirectConnectGatewayAttachmentsResponse_httpStatus' - The response's http status code.
newDescribeDirectConnectGatewayAttachmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDirectConnectGatewayAttachmentsResponse
newDescribeDirectConnectGatewayAttachmentsResponse :: Int -> DescribeDirectConnectGatewayAttachmentsResponse
newDescribeDirectConnectGatewayAttachmentsResponse
  Int
pHttpStatus_ =
    DescribeDirectConnectGatewayAttachmentsResponse' :: Maybe Text
-> Maybe [DirectConnectGatewayAttachment]
-> Int
-> DescribeDirectConnectGatewayAttachmentsResponse
DescribeDirectConnectGatewayAttachmentsResponse'
      { $sel:nextToken:DescribeDirectConnectGatewayAttachmentsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:directConnectGatewayAttachments:DescribeDirectConnectGatewayAttachmentsResponse' :: Maybe [DirectConnectGatewayAttachment]
directConnectGatewayAttachments =
          Maybe [DirectConnectGatewayAttachment]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeDirectConnectGatewayAttachmentsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The token to retrieve the next page.
describeDirectConnectGatewayAttachmentsResponse_nextToken :: Lens.Lens' DescribeDirectConnectGatewayAttachmentsResponse (Prelude.Maybe Prelude.Text)
describeDirectConnectGatewayAttachmentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeDirectConnectGatewayAttachmentsResponse
-> f DescribeDirectConnectGatewayAttachmentsResponse
describeDirectConnectGatewayAttachmentsResponse_nextToken = (DescribeDirectConnectGatewayAttachmentsResponse -> Maybe Text)
-> (DescribeDirectConnectGatewayAttachmentsResponse
    -> Maybe Text -> DescribeDirectConnectGatewayAttachmentsResponse)
-> Lens'
     DescribeDirectConnectGatewayAttachmentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewayAttachmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDirectConnectGatewayAttachmentsResponse' :: DescribeDirectConnectGatewayAttachmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDirectConnectGatewayAttachmentsResponse
s@DescribeDirectConnectGatewayAttachmentsResponse' {} Maybe Text
a -> DescribeDirectConnectGatewayAttachmentsResponse
s {$sel:nextToken:DescribeDirectConnectGatewayAttachmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDirectConnectGatewayAttachmentsResponse)

-- | The attachments.
describeDirectConnectGatewayAttachmentsResponse_directConnectGatewayAttachments :: Lens.Lens' DescribeDirectConnectGatewayAttachmentsResponse (Prelude.Maybe [DirectConnectGatewayAttachment])
describeDirectConnectGatewayAttachmentsResponse_directConnectGatewayAttachments :: (Maybe [DirectConnectGatewayAttachment]
 -> f (Maybe [DirectConnectGatewayAttachment]))
-> DescribeDirectConnectGatewayAttachmentsResponse
-> f DescribeDirectConnectGatewayAttachmentsResponse
describeDirectConnectGatewayAttachmentsResponse_directConnectGatewayAttachments = (DescribeDirectConnectGatewayAttachmentsResponse
 -> Maybe [DirectConnectGatewayAttachment])
-> (DescribeDirectConnectGatewayAttachmentsResponse
    -> Maybe [DirectConnectGatewayAttachment]
    -> DescribeDirectConnectGatewayAttachmentsResponse)
-> Lens'
     DescribeDirectConnectGatewayAttachmentsResponse
     (Maybe [DirectConnectGatewayAttachment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewayAttachmentsResponse' {Maybe [DirectConnectGatewayAttachment]
directConnectGatewayAttachments :: Maybe [DirectConnectGatewayAttachment]
$sel:directConnectGatewayAttachments:DescribeDirectConnectGatewayAttachmentsResponse' :: DescribeDirectConnectGatewayAttachmentsResponse
-> Maybe [DirectConnectGatewayAttachment]
directConnectGatewayAttachments} -> Maybe [DirectConnectGatewayAttachment]
directConnectGatewayAttachments) (\s :: DescribeDirectConnectGatewayAttachmentsResponse
s@DescribeDirectConnectGatewayAttachmentsResponse' {} Maybe [DirectConnectGatewayAttachment]
a -> DescribeDirectConnectGatewayAttachmentsResponse
s {$sel:directConnectGatewayAttachments:DescribeDirectConnectGatewayAttachmentsResponse' :: Maybe [DirectConnectGatewayAttachment]
directConnectGatewayAttachments = Maybe [DirectConnectGatewayAttachment]
a} :: DescribeDirectConnectGatewayAttachmentsResponse) ((Maybe [DirectConnectGatewayAttachment]
  -> f (Maybe [DirectConnectGatewayAttachment]))
 -> DescribeDirectConnectGatewayAttachmentsResponse
 -> f DescribeDirectConnectGatewayAttachmentsResponse)
-> ((Maybe [DirectConnectGatewayAttachment]
     -> f (Maybe [DirectConnectGatewayAttachment]))
    -> Maybe [DirectConnectGatewayAttachment]
    -> f (Maybe [DirectConnectGatewayAttachment]))
-> (Maybe [DirectConnectGatewayAttachment]
    -> f (Maybe [DirectConnectGatewayAttachment]))
-> DescribeDirectConnectGatewayAttachmentsResponse
-> f DescribeDirectConnectGatewayAttachmentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DirectConnectGatewayAttachment]
  [DirectConnectGatewayAttachment]
  [DirectConnectGatewayAttachment]
  [DirectConnectGatewayAttachment]
-> Iso
     (Maybe [DirectConnectGatewayAttachment])
     (Maybe [DirectConnectGatewayAttachment])
     (Maybe [DirectConnectGatewayAttachment])
     (Maybe [DirectConnectGatewayAttachment])
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 AnIso
  [DirectConnectGatewayAttachment]
  [DirectConnectGatewayAttachment]
  [DirectConnectGatewayAttachment]
  [DirectConnectGatewayAttachment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeDirectConnectGatewayAttachmentsResponse