{-# 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.DescribeDirectConnectGateways
-- 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 all your Direct Connect gateways or only the specified Direct
-- Connect gateway. Deleted Direct Connect gateways are not returned.
--
-- This operation returns paginated results.
module Amazonka.DirectConnect.DescribeDirectConnectGateways
  ( -- * Creating a Request
    DescribeDirectConnectGateways (..),
    newDescribeDirectConnectGateways,

    -- * Request Lenses
    describeDirectConnectGateways_directConnectGatewayId,
    describeDirectConnectGateways_nextToken,
    describeDirectConnectGateways_maxResults,

    -- * Destructuring the Response
    DescribeDirectConnectGatewaysResponse (..),
    newDescribeDirectConnectGatewaysResponse,

    -- * Response Lenses
    describeDirectConnectGatewaysResponse_directConnectGateways,
    describeDirectConnectGatewaysResponse_nextToken,
    describeDirectConnectGatewaysResponse_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:/ 'newDescribeDirectConnectGateways' smart constructor.
data DescribeDirectConnectGateways = DescribeDirectConnectGateways'
  { -- | The ID of the Direct Connect gateway.
    DescribeDirectConnectGateways -> Maybe Text
directConnectGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The token provided in the previous call to retrieve the next page.
    DescribeDirectConnectGateways -> 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.
    DescribeDirectConnectGateways -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeDirectConnectGateways
-> DescribeDirectConnectGateways -> Bool
(DescribeDirectConnectGateways
 -> DescribeDirectConnectGateways -> Bool)
-> (DescribeDirectConnectGateways
    -> DescribeDirectConnectGateways -> Bool)
-> Eq DescribeDirectConnectGateways
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDirectConnectGateways
-> DescribeDirectConnectGateways -> Bool
$c/= :: DescribeDirectConnectGateways
-> DescribeDirectConnectGateways -> Bool
== :: DescribeDirectConnectGateways
-> DescribeDirectConnectGateways -> Bool
$c== :: DescribeDirectConnectGateways
-> DescribeDirectConnectGateways -> Bool
Prelude.Eq, ReadPrec [DescribeDirectConnectGateways]
ReadPrec DescribeDirectConnectGateways
Int -> ReadS DescribeDirectConnectGateways
ReadS [DescribeDirectConnectGateways]
(Int -> ReadS DescribeDirectConnectGateways)
-> ReadS [DescribeDirectConnectGateways]
-> ReadPrec DescribeDirectConnectGateways
-> ReadPrec [DescribeDirectConnectGateways]
-> Read DescribeDirectConnectGateways
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDirectConnectGateways]
$creadListPrec :: ReadPrec [DescribeDirectConnectGateways]
readPrec :: ReadPrec DescribeDirectConnectGateways
$creadPrec :: ReadPrec DescribeDirectConnectGateways
readList :: ReadS [DescribeDirectConnectGateways]
$creadList :: ReadS [DescribeDirectConnectGateways]
readsPrec :: Int -> ReadS DescribeDirectConnectGateways
$creadsPrec :: Int -> ReadS DescribeDirectConnectGateways
Prelude.Read, Int -> DescribeDirectConnectGateways -> ShowS
[DescribeDirectConnectGateways] -> ShowS
DescribeDirectConnectGateways -> String
(Int -> DescribeDirectConnectGateways -> ShowS)
-> (DescribeDirectConnectGateways -> String)
-> ([DescribeDirectConnectGateways] -> ShowS)
-> Show DescribeDirectConnectGateways
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDirectConnectGateways] -> ShowS
$cshowList :: [DescribeDirectConnectGateways] -> ShowS
show :: DescribeDirectConnectGateways -> String
$cshow :: DescribeDirectConnectGateways -> String
showsPrec :: Int -> DescribeDirectConnectGateways -> ShowS
$cshowsPrec :: Int -> DescribeDirectConnectGateways -> ShowS
Prelude.Show, (forall x.
 DescribeDirectConnectGateways
 -> Rep DescribeDirectConnectGateways x)
-> (forall x.
    Rep DescribeDirectConnectGateways x
    -> DescribeDirectConnectGateways)
-> Generic DescribeDirectConnectGateways
forall x.
Rep DescribeDirectConnectGateways x
-> DescribeDirectConnectGateways
forall x.
DescribeDirectConnectGateways
-> Rep DescribeDirectConnectGateways x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDirectConnectGateways x
-> DescribeDirectConnectGateways
$cfrom :: forall x.
DescribeDirectConnectGateways
-> Rep DescribeDirectConnectGateways x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDirectConnectGateways' 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', 'describeDirectConnectGateways_directConnectGatewayId' - The ID of the Direct Connect gateway.
--
-- 'nextToken', 'describeDirectConnectGateways_nextToken' - The token provided in the previous call to retrieve the next page.
--
-- 'maxResults', 'describeDirectConnectGateways_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.
newDescribeDirectConnectGateways ::
  DescribeDirectConnectGateways
newDescribeDirectConnectGateways :: DescribeDirectConnectGateways
newDescribeDirectConnectGateways =
  DescribeDirectConnectGateways' :: Maybe Text
-> Maybe Text -> Maybe Int -> DescribeDirectConnectGateways
DescribeDirectConnectGateways'
    { $sel:directConnectGatewayId:DescribeDirectConnectGateways' :: Maybe Text
directConnectGatewayId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeDirectConnectGateways' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeDirectConnectGateways' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | 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.
describeDirectConnectGateways_maxResults :: Lens.Lens' DescribeDirectConnectGateways (Prelude.Maybe Prelude.Int)
describeDirectConnectGateways_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeDirectConnectGateways -> f DescribeDirectConnectGateways
describeDirectConnectGateways_maxResults = (DescribeDirectConnectGateways -> Maybe Int)
-> (DescribeDirectConnectGateways
    -> Maybe Int -> DescribeDirectConnectGateways)
-> Lens
     DescribeDirectConnectGateways
     DescribeDirectConnectGateways
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGateways' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeDirectConnectGateways' :: DescribeDirectConnectGateways -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeDirectConnectGateways
s@DescribeDirectConnectGateways' {} Maybe Int
a -> DescribeDirectConnectGateways
s {$sel:maxResults:DescribeDirectConnectGateways' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeDirectConnectGateways)

instance Core.AWSPager DescribeDirectConnectGateways where
  page :: DescribeDirectConnectGateways
-> AWSResponse DescribeDirectConnectGateways
-> Maybe DescribeDirectConnectGateways
page DescribeDirectConnectGateways
rq AWSResponse DescribeDirectConnectGateways
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDirectConnectGateways
DescribeDirectConnectGatewaysResponse
rs
            DescribeDirectConnectGatewaysResponse
-> Getting (First Text) DescribeDirectConnectGatewaysResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDirectConnectGatewaysResponse
-> Const (First Text) DescribeDirectConnectGatewaysResponse
Lens' DescribeDirectConnectGatewaysResponse (Maybe Text)
describeDirectConnectGatewaysResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDirectConnectGatewaysResponse
 -> Const (First Text) DescribeDirectConnectGatewaysResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeDirectConnectGatewaysResponse 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 DescribeDirectConnectGateways
forall a. Maybe a
Prelude.Nothing
    | Maybe [DirectConnectGateway] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDirectConnectGateways
DescribeDirectConnectGatewaysResponse
rs
            DescribeDirectConnectGatewaysResponse
-> Getting
     (First [DirectConnectGateway])
     DescribeDirectConnectGatewaysResponse
     [DirectConnectGateway]
-> Maybe [DirectConnectGateway]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DirectConnectGateway]
 -> Const
      (First [DirectConnectGateway]) (Maybe [DirectConnectGateway]))
-> DescribeDirectConnectGatewaysResponse
-> Const
     (First [DirectConnectGateway])
     DescribeDirectConnectGatewaysResponse
Lens'
  DescribeDirectConnectGatewaysResponse
  (Maybe [DirectConnectGateway])
describeDirectConnectGatewaysResponse_directConnectGateways
              ((Maybe [DirectConnectGateway]
  -> Const
       (First [DirectConnectGateway]) (Maybe [DirectConnectGateway]))
 -> DescribeDirectConnectGatewaysResponse
 -> Const
      (First [DirectConnectGateway])
      DescribeDirectConnectGatewaysResponse)
-> (([DirectConnectGateway]
     -> Const (First [DirectConnectGateway]) [DirectConnectGateway])
    -> Maybe [DirectConnectGateway]
    -> Const
         (First [DirectConnectGateway]) (Maybe [DirectConnectGateway]))
-> Getting
     (First [DirectConnectGateway])
     DescribeDirectConnectGatewaysResponse
     [DirectConnectGateway]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DirectConnectGateway]
 -> Const (First [DirectConnectGateway]) [DirectConnectGateway])
-> Maybe [DirectConnectGateway]
-> Const
     (First [DirectConnectGateway]) (Maybe [DirectConnectGateway])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeDirectConnectGateways
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeDirectConnectGateways
-> Maybe DescribeDirectConnectGateways
forall a. a -> Maybe a
Prelude.Just (DescribeDirectConnectGateways
 -> Maybe DescribeDirectConnectGateways)
-> DescribeDirectConnectGateways
-> Maybe DescribeDirectConnectGateways
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeDirectConnectGateways
rq
          DescribeDirectConnectGateways
-> (DescribeDirectConnectGateways -> DescribeDirectConnectGateways)
-> DescribeDirectConnectGateways
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeDirectConnectGateways
-> Identity DescribeDirectConnectGateways
Lens
  DescribeDirectConnectGateways
  DescribeDirectConnectGateways
  (Maybe Text)
  (Maybe Text)
describeDirectConnectGateways_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeDirectConnectGateways
 -> Identity DescribeDirectConnectGateways)
-> Maybe Text
-> DescribeDirectConnectGateways
-> DescribeDirectConnectGateways
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeDirectConnectGateways
DescribeDirectConnectGatewaysResponse
rs
          DescribeDirectConnectGatewaysResponse
-> Getting (First Text) DescribeDirectConnectGatewaysResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDirectConnectGatewaysResponse
-> Const (First Text) DescribeDirectConnectGatewaysResponse
Lens' DescribeDirectConnectGatewaysResponse (Maybe Text)
describeDirectConnectGatewaysResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDirectConnectGatewaysResponse
 -> Const (First Text) DescribeDirectConnectGatewaysResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeDirectConnectGatewaysResponse 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
    DescribeDirectConnectGateways
  where
  type
    AWSResponse DescribeDirectConnectGateways =
      DescribeDirectConnectGatewaysResponse
  request :: DescribeDirectConnectGateways
-> Request DescribeDirectConnectGateways
request = Service
-> DescribeDirectConnectGateways
-> Request DescribeDirectConnectGateways
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDirectConnectGateways
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDirectConnectGateways)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDirectConnectGateways))
-> Logger
-> Service
-> Proxy DescribeDirectConnectGateways
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDirectConnectGateways)))
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 [DirectConnectGateway]
-> Maybe Text -> Int -> DescribeDirectConnectGatewaysResponse
DescribeDirectConnectGatewaysResponse'
            (Maybe [DirectConnectGateway]
 -> Maybe Text -> Int -> DescribeDirectConnectGatewaysResponse)
-> Either String (Maybe [DirectConnectGateway])
-> Either
     String (Maybe Text -> Int -> DescribeDirectConnectGatewaysResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [DirectConnectGateway]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"directConnectGateways"
                            Either String (Maybe (Maybe [DirectConnectGateway]))
-> Maybe [DirectConnectGateway]
-> Either String (Maybe [DirectConnectGateway])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DirectConnectGateway]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> DescribeDirectConnectGatewaysResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeDirectConnectGatewaysResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> DescribeDirectConnectGatewaysResponse)
-> Either String Int
-> Either String DescribeDirectConnectGatewaysResponse
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
    DescribeDirectConnectGateways

instance Prelude.NFData DescribeDirectConnectGateways

instance Core.ToHeaders DescribeDirectConnectGateways where
  toHeaders :: DescribeDirectConnectGateways -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeDirectConnectGateways -> 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.DescribeDirectConnectGateways" ::
                          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 DescribeDirectConnectGateways where
  toJSON :: DescribeDirectConnectGateways -> Value
toJSON DescribeDirectConnectGateways' {Maybe Int
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
directConnectGatewayId :: Maybe Text
$sel:maxResults:DescribeDirectConnectGateways' :: DescribeDirectConnectGateways -> Maybe Int
$sel:nextToken:DescribeDirectConnectGateways' :: DescribeDirectConnectGateways -> Maybe Text
$sel:directConnectGatewayId:DescribeDirectConnectGateways' :: DescribeDirectConnectGateways -> 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
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeDirectConnectGatewaysResponse' 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:
--
-- 'directConnectGateways', 'describeDirectConnectGatewaysResponse_directConnectGateways' - The Direct Connect gateways.
--
-- 'nextToken', 'describeDirectConnectGatewaysResponse_nextToken' - The token to retrieve the next page.
--
-- 'httpStatus', 'describeDirectConnectGatewaysResponse_httpStatus' - The response's http status code.
newDescribeDirectConnectGatewaysResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDirectConnectGatewaysResponse
newDescribeDirectConnectGatewaysResponse :: Int -> DescribeDirectConnectGatewaysResponse
newDescribeDirectConnectGatewaysResponse Int
pHttpStatus_ =
  DescribeDirectConnectGatewaysResponse' :: Maybe [DirectConnectGateway]
-> Maybe Text -> Int -> DescribeDirectConnectGatewaysResponse
DescribeDirectConnectGatewaysResponse'
    { $sel:directConnectGateways:DescribeDirectConnectGatewaysResponse' :: Maybe [DirectConnectGateway]
directConnectGateways =
        Maybe [DirectConnectGateway]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeDirectConnectGatewaysResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDirectConnectGatewaysResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Direct Connect gateways.
describeDirectConnectGatewaysResponse_directConnectGateways :: Lens.Lens' DescribeDirectConnectGatewaysResponse (Prelude.Maybe [DirectConnectGateway])
describeDirectConnectGatewaysResponse_directConnectGateways :: (Maybe [DirectConnectGateway] -> f (Maybe [DirectConnectGateway]))
-> DescribeDirectConnectGatewaysResponse
-> f DescribeDirectConnectGatewaysResponse
describeDirectConnectGatewaysResponse_directConnectGateways = (DescribeDirectConnectGatewaysResponse
 -> Maybe [DirectConnectGateway])
-> (DescribeDirectConnectGatewaysResponse
    -> Maybe [DirectConnectGateway]
    -> DescribeDirectConnectGatewaysResponse)
-> Lens'
     DescribeDirectConnectGatewaysResponse
     (Maybe [DirectConnectGateway])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectConnectGatewaysResponse' {Maybe [DirectConnectGateway]
directConnectGateways :: Maybe [DirectConnectGateway]
$sel:directConnectGateways:DescribeDirectConnectGatewaysResponse' :: DescribeDirectConnectGatewaysResponse
-> Maybe [DirectConnectGateway]
directConnectGateways} -> Maybe [DirectConnectGateway]
directConnectGateways) (\s :: DescribeDirectConnectGatewaysResponse
s@DescribeDirectConnectGatewaysResponse' {} Maybe [DirectConnectGateway]
a -> DescribeDirectConnectGatewaysResponse
s {$sel:directConnectGateways:DescribeDirectConnectGatewaysResponse' :: Maybe [DirectConnectGateway]
directConnectGateways = Maybe [DirectConnectGateway]
a} :: DescribeDirectConnectGatewaysResponse) ((Maybe [DirectConnectGateway] -> f (Maybe [DirectConnectGateway]))
 -> DescribeDirectConnectGatewaysResponse
 -> f DescribeDirectConnectGatewaysResponse)
-> ((Maybe [DirectConnectGateway]
     -> f (Maybe [DirectConnectGateway]))
    -> Maybe [DirectConnectGateway]
    -> f (Maybe [DirectConnectGateway]))
-> (Maybe [DirectConnectGateway]
    -> f (Maybe [DirectConnectGateway]))
-> DescribeDirectConnectGatewaysResponse
-> f DescribeDirectConnectGatewaysResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DirectConnectGateway]
  [DirectConnectGateway]
  [DirectConnectGateway]
  [DirectConnectGateway]
-> Iso
     (Maybe [DirectConnectGateway])
     (Maybe [DirectConnectGateway])
     (Maybe [DirectConnectGateway])
     (Maybe [DirectConnectGateway])
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
  [DirectConnectGateway]
  [DirectConnectGateway]
  [DirectConnectGateway]
  [DirectConnectGateway]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    DescribeDirectConnectGatewaysResponse