{-# 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.NetworkManager.GetTransitGatewayRegistrations
-- 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)
--
-- Gets information about the transit gateway registrations in a specified
-- global network.
--
-- This operation returns paginated results.
module Amazonka.NetworkManager.GetTransitGatewayRegistrations
  ( -- * Creating a Request
    GetTransitGatewayRegistrations (..),
    newGetTransitGatewayRegistrations,

    -- * Request Lenses
    getTransitGatewayRegistrations_transitGatewayArns,
    getTransitGatewayRegistrations_nextToken,
    getTransitGatewayRegistrations_maxResults,
    getTransitGatewayRegistrations_globalNetworkId,

    -- * Destructuring the Response
    GetTransitGatewayRegistrationsResponse (..),
    newGetTransitGatewayRegistrationsResponse,

    -- * Response Lenses
    getTransitGatewayRegistrationsResponse_transitGatewayRegistrations,
    getTransitGatewayRegistrationsResponse_nextToken,
    getTransitGatewayRegistrationsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetTransitGatewayRegistrations' smart constructor.
data GetTransitGatewayRegistrations = GetTransitGatewayRegistrations'
  { -- | The Amazon Resource Names (ARNs) of one or more transit gateways. The
    -- maximum is 10.
    GetTransitGatewayRegistrations -> Maybe [Text]
transitGatewayArns :: Prelude.Maybe [Prelude.Text],
    -- | The token for the next page of results.
    GetTransitGatewayRegistrations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    GetTransitGatewayRegistrations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the global network.
    GetTransitGatewayRegistrations -> Text
globalNetworkId :: Prelude.Text
  }
  deriving (GetTransitGatewayRegistrations
-> GetTransitGatewayRegistrations -> Bool
(GetTransitGatewayRegistrations
 -> GetTransitGatewayRegistrations -> Bool)
-> (GetTransitGatewayRegistrations
    -> GetTransitGatewayRegistrations -> Bool)
-> Eq GetTransitGatewayRegistrations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTransitGatewayRegistrations
-> GetTransitGatewayRegistrations -> Bool
$c/= :: GetTransitGatewayRegistrations
-> GetTransitGatewayRegistrations -> Bool
== :: GetTransitGatewayRegistrations
-> GetTransitGatewayRegistrations -> Bool
$c== :: GetTransitGatewayRegistrations
-> GetTransitGatewayRegistrations -> Bool
Prelude.Eq, ReadPrec [GetTransitGatewayRegistrations]
ReadPrec GetTransitGatewayRegistrations
Int -> ReadS GetTransitGatewayRegistrations
ReadS [GetTransitGatewayRegistrations]
(Int -> ReadS GetTransitGatewayRegistrations)
-> ReadS [GetTransitGatewayRegistrations]
-> ReadPrec GetTransitGatewayRegistrations
-> ReadPrec [GetTransitGatewayRegistrations]
-> Read GetTransitGatewayRegistrations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTransitGatewayRegistrations]
$creadListPrec :: ReadPrec [GetTransitGatewayRegistrations]
readPrec :: ReadPrec GetTransitGatewayRegistrations
$creadPrec :: ReadPrec GetTransitGatewayRegistrations
readList :: ReadS [GetTransitGatewayRegistrations]
$creadList :: ReadS [GetTransitGatewayRegistrations]
readsPrec :: Int -> ReadS GetTransitGatewayRegistrations
$creadsPrec :: Int -> ReadS GetTransitGatewayRegistrations
Prelude.Read, Int -> GetTransitGatewayRegistrations -> ShowS
[GetTransitGatewayRegistrations] -> ShowS
GetTransitGatewayRegistrations -> String
(Int -> GetTransitGatewayRegistrations -> ShowS)
-> (GetTransitGatewayRegistrations -> String)
-> ([GetTransitGatewayRegistrations] -> ShowS)
-> Show GetTransitGatewayRegistrations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTransitGatewayRegistrations] -> ShowS
$cshowList :: [GetTransitGatewayRegistrations] -> ShowS
show :: GetTransitGatewayRegistrations -> String
$cshow :: GetTransitGatewayRegistrations -> String
showsPrec :: Int -> GetTransitGatewayRegistrations -> ShowS
$cshowsPrec :: Int -> GetTransitGatewayRegistrations -> ShowS
Prelude.Show, (forall x.
 GetTransitGatewayRegistrations
 -> Rep GetTransitGatewayRegistrations x)
-> (forall x.
    Rep GetTransitGatewayRegistrations x
    -> GetTransitGatewayRegistrations)
-> Generic GetTransitGatewayRegistrations
forall x.
Rep GetTransitGatewayRegistrations x
-> GetTransitGatewayRegistrations
forall x.
GetTransitGatewayRegistrations
-> Rep GetTransitGatewayRegistrations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTransitGatewayRegistrations x
-> GetTransitGatewayRegistrations
$cfrom :: forall x.
GetTransitGatewayRegistrations
-> Rep GetTransitGatewayRegistrations x
Prelude.Generic)

-- |
-- Create a value of 'GetTransitGatewayRegistrations' 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:
--
-- 'transitGatewayArns', 'getTransitGatewayRegistrations_transitGatewayArns' - The Amazon Resource Names (ARNs) of one or more transit gateways. The
-- maximum is 10.
--
-- 'nextToken', 'getTransitGatewayRegistrations_nextToken' - The token for the next page of results.
--
-- 'maxResults', 'getTransitGatewayRegistrations_maxResults' - The maximum number of results to return.
--
-- 'globalNetworkId', 'getTransitGatewayRegistrations_globalNetworkId' - The ID of the global network.
newGetTransitGatewayRegistrations ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  GetTransitGatewayRegistrations
newGetTransitGatewayRegistrations :: Text -> GetTransitGatewayRegistrations
newGetTransitGatewayRegistrations Text
pGlobalNetworkId_ =
  GetTransitGatewayRegistrations' :: Maybe [Text]
-> Maybe Text
-> Maybe Natural
-> Text
-> GetTransitGatewayRegistrations
GetTransitGatewayRegistrations'
    { $sel:transitGatewayArns:GetTransitGatewayRegistrations' :: Maybe [Text]
transitGatewayArns =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetTransitGatewayRegistrations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetTransitGatewayRegistrations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GetTransitGatewayRegistrations' :: Text
globalNetworkId = Text
pGlobalNetworkId_
    }

-- | The Amazon Resource Names (ARNs) of one or more transit gateways. The
-- maximum is 10.
getTransitGatewayRegistrations_transitGatewayArns :: Lens.Lens' GetTransitGatewayRegistrations (Prelude.Maybe [Prelude.Text])
getTransitGatewayRegistrations_transitGatewayArns :: (Maybe [Text] -> f (Maybe [Text]))
-> GetTransitGatewayRegistrations
-> f GetTransitGatewayRegistrations
getTransitGatewayRegistrations_transitGatewayArns = (GetTransitGatewayRegistrations -> Maybe [Text])
-> (GetTransitGatewayRegistrations
    -> Maybe [Text] -> GetTransitGatewayRegistrations)
-> Lens
     GetTransitGatewayRegistrations
     GetTransitGatewayRegistrations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTransitGatewayRegistrations' {Maybe [Text]
transitGatewayArns :: Maybe [Text]
$sel:transitGatewayArns:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe [Text]
transitGatewayArns} -> Maybe [Text]
transitGatewayArns) (\s :: GetTransitGatewayRegistrations
s@GetTransitGatewayRegistrations' {} Maybe [Text]
a -> GetTransitGatewayRegistrations
s {$sel:transitGatewayArns:GetTransitGatewayRegistrations' :: Maybe [Text]
transitGatewayArns = Maybe [Text]
a} :: GetTransitGatewayRegistrations) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetTransitGatewayRegistrations
 -> f GetTransitGatewayRegistrations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetTransitGatewayRegistrations
-> f GetTransitGatewayRegistrations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The maximum number of results to return.
getTransitGatewayRegistrations_maxResults :: Lens.Lens' GetTransitGatewayRegistrations (Prelude.Maybe Prelude.Natural)
getTransitGatewayRegistrations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetTransitGatewayRegistrations
-> f GetTransitGatewayRegistrations
getTransitGatewayRegistrations_maxResults = (GetTransitGatewayRegistrations -> Maybe Natural)
-> (GetTransitGatewayRegistrations
    -> Maybe Natural -> GetTransitGatewayRegistrations)
-> Lens
     GetTransitGatewayRegistrations
     GetTransitGatewayRegistrations
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTransitGatewayRegistrations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetTransitGatewayRegistrations
s@GetTransitGatewayRegistrations' {} Maybe Natural
a -> GetTransitGatewayRegistrations
s {$sel:maxResults:GetTransitGatewayRegistrations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetTransitGatewayRegistrations)

-- | The ID of the global network.
getTransitGatewayRegistrations_globalNetworkId :: Lens.Lens' GetTransitGatewayRegistrations Prelude.Text
getTransitGatewayRegistrations_globalNetworkId :: (Text -> f Text)
-> GetTransitGatewayRegistrations
-> f GetTransitGatewayRegistrations
getTransitGatewayRegistrations_globalNetworkId = (GetTransitGatewayRegistrations -> Text)
-> (GetTransitGatewayRegistrations
    -> Text -> GetTransitGatewayRegistrations)
-> Lens
     GetTransitGatewayRegistrations
     GetTransitGatewayRegistrations
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTransitGatewayRegistrations' {Text
globalNetworkId :: Text
$sel:globalNetworkId:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: GetTransitGatewayRegistrations
s@GetTransitGatewayRegistrations' {} Text
a -> GetTransitGatewayRegistrations
s {$sel:globalNetworkId:GetTransitGatewayRegistrations' :: Text
globalNetworkId = Text
a} :: GetTransitGatewayRegistrations)

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

instance
  Prelude.NFData
    GetTransitGatewayRegistrations

instance
  Core.ToHeaders
    GetTransitGatewayRegistrations
  where
  toHeaders :: GetTransitGatewayRegistrations -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetTransitGatewayRegistrations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetTransitGatewayRegistrations where
  toPath :: GetTransitGatewayRegistrations -> ByteString
toPath GetTransitGatewayRegistrations' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
transitGatewayArns :: Maybe [Text]
$sel:globalNetworkId:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Text
$sel:maxResults:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe Natural
$sel:nextToken:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe Text
$sel:transitGatewayArns:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe [Text]
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/global-networks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
globalNetworkId,
        ByteString
"/transit-gateway-registrations"
      ]

instance Core.ToQuery GetTransitGatewayRegistrations where
  toQuery :: GetTransitGatewayRegistrations -> QueryString
toQuery GetTransitGatewayRegistrations' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
transitGatewayArns :: Maybe [Text]
$sel:globalNetworkId:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Text
$sel:maxResults:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe Natural
$sel:nextToken:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe Text
$sel:transitGatewayArns:GetTransitGatewayRegistrations' :: GetTransitGatewayRegistrations -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"transitGatewayArns"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
transitGatewayArns
            ),
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newGetTransitGatewayRegistrationsResponse' smart constructor.
data GetTransitGatewayRegistrationsResponse = GetTransitGatewayRegistrationsResponse'
  { -- | The transit gateway registrations.
    GetTransitGatewayRegistrationsResponse
-> Maybe [TransitGatewayRegistration]
transitGatewayRegistrations :: Prelude.Maybe [TransitGatewayRegistration],
    -- | The token for the next page of results.
    GetTransitGatewayRegistrationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetTransitGatewayRegistrationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetTransitGatewayRegistrationsResponse
-> GetTransitGatewayRegistrationsResponse -> Bool
(GetTransitGatewayRegistrationsResponse
 -> GetTransitGatewayRegistrationsResponse -> Bool)
-> (GetTransitGatewayRegistrationsResponse
    -> GetTransitGatewayRegistrationsResponse -> Bool)
-> Eq GetTransitGatewayRegistrationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTransitGatewayRegistrationsResponse
-> GetTransitGatewayRegistrationsResponse -> Bool
$c/= :: GetTransitGatewayRegistrationsResponse
-> GetTransitGatewayRegistrationsResponse -> Bool
== :: GetTransitGatewayRegistrationsResponse
-> GetTransitGatewayRegistrationsResponse -> Bool
$c== :: GetTransitGatewayRegistrationsResponse
-> GetTransitGatewayRegistrationsResponse -> Bool
Prelude.Eq, ReadPrec [GetTransitGatewayRegistrationsResponse]
ReadPrec GetTransitGatewayRegistrationsResponse
Int -> ReadS GetTransitGatewayRegistrationsResponse
ReadS [GetTransitGatewayRegistrationsResponse]
(Int -> ReadS GetTransitGatewayRegistrationsResponse)
-> ReadS [GetTransitGatewayRegistrationsResponse]
-> ReadPrec GetTransitGatewayRegistrationsResponse
-> ReadPrec [GetTransitGatewayRegistrationsResponse]
-> Read GetTransitGatewayRegistrationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTransitGatewayRegistrationsResponse]
$creadListPrec :: ReadPrec [GetTransitGatewayRegistrationsResponse]
readPrec :: ReadPrec GetTransitGatewayRegistrationsResponse
$creadPrec :: ReadPrec GetTransitGatewayRegistrationsResponse
readList :: ReadS [GetTransitGatewayRegistrationsResponse]
$creadList :: ReadS [GetTransitGatewayRegistrationsResponse]
readsPrec :: Int -> ReadS GetTransitGatewayRegistrationsResponse
$creadsPrec :: Int -> ReadS GetTransitGatewayRegistrationsResponse
Prelude.Read, Int -> GetTransitGatewayRegistrationsResponse -> ShowS
[GetTransitGatewayRegistrationsResponse] -> ShowS
GetTransitGatewayRegistrationsResponse -> String
(Int -> GetTransitGatewayRegistrationsResponse -> ShowS)
-> (GetTransitGatewayRegistrationsResponse -> String)
-> ([GetTransitGatewayRegistrationsResponse] -> ShowS)
-> Show GetTransitGatewayRegistrationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTransitGatewayRegistrationsResponse] -> ShowS
$cshowList :: [GetTransitGatewayRegistrationsResponse] -> ShowS
show :: GetTransitGatewayRegistrationsResponse -> String
$cshow :: GetTransitGatewayRegistrationsResponse -> String
showsPrec :: Int -> GetTransitGatewayRegistrationsResponse -> ShowS
$cshowsPrec :: Int -> GetTransitGatewayRegistrationsResponse -> ShowS
Prelude.Show, (forall x.
 GetTransitGatewayRegistrationsResponse
 -> Rep GetTransitGatewayRegistrationsResponse x)
-> (forall x.
    Rep GetTransitGatewayRegistrationsResponse x
    -> GetTransitGatewayRegistrationsResponse)
-> Generic GetTransitGatewayRegistrationsResponse
forall x.
Rep GetTransitGatewayRegistrationsResponse x
-> GetTransitGatewayRegistrationsResponse
forall x.
GetTransitGatewayRegistrationsResponse
-> Rep GetTransitGatewayRegistrationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetTransitGatewayRegistrationsResponse x
-> GetTransitGatewayRegistrationsResponse
$cfrom :: forall x.
GetTransitGatewayRegistrationsResponse
-> Rep GetTransitGatewayRegistrationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetTransitGatewayRegistrationsResponse' 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:
--
-- 'transitGatewayRegistrations', 'getTransitGatewayRegistrationsResponse_transitGatewayRegistrations' - The transit gateway registrations.
--
-- 'nextToken', 'getTransitGatewayRegistrationsResponse_nextToken' - The token for the next page of results.
--
-- 'httpStatus', 'getTransitGatewayRegistrationsResponse_httpStatus' - The response's http status code.
newGetTransitGatewayRegistrationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetTransitGatewayRegistrationsResponse
newGetTransitGatewayRegistrationsResponse :: Int -> GetTransitGatewayRegistrationsResponse
newGetTransitGatewayRegistrationsResponse
  Int
pHttpStatus_ =
    GetTransitGatewayRegistrationsResponse' :: Maybe [TransitGatewayRegistration]
-> Maybe Text -> Int -> GetTransitGatewayRegistrationsResponse
GetTransitGatewayRegistrationsResponse'
      { $sel:transitGatewayRegistrations:GetTransitGatewayRegistrationsResponse' :: Maybe [TransitGatewayRegistration]
transitGatewayRegistrations =
          Maybe [TransitGatewayRegistration]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetTransitGatewayRegistrationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetTransitGatewayRegistrationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The transit gateway registrations.
getTransitGatewayRegistrationsResponse_transitGatewayRegistrations :: Lens.Lens' GetTransitGatewayRegistrationsResponse (Prelude.Maybe [TransitGatewayRegistration])
getTransitGatewayRegistrationsResponse_transitGatewayRegistrations :: (Maybe [TransitGatewayRegistration]
 -> f (Maybe [TransitGatewayRegistration]))
-> GetTransitGatewayRegistrationsResponse
-> f GetTransitGatewayRegistrationsResponse
getTransitGatewayRegistrationsResponse_transitGatewayRegistrations = (GetTransitGatewayRegistrationsResponse
 -> Maybe [TransitGatewayRegistration])
-> (GetTransitGatewayRegistrationsResponse
    -> Maybe [TransitGatewayRegistration]
    -> GetTransitGatewayRegistrationsResponse)
-> Lens'
     GetTransitGatewayRegistrationsResponse
     (Maybe [TransitGatewayRegistration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTransitGatewayRegistrationsResponse' {Maybe [TransitGatewayRegistration]
transitGatewayRegistrations :: Maybe [TransitGatewayRegistration]
$sel:transitGatewayRegistrations:GetTransitGatewayRegistrationsResponse' :: GetTransitGatewayRegistrationsResponse
-> Maybe [TransitGatewayRegistration]
transitGatewayRegistrations} -> Maybe [TransitGatewayRegistration]
transitGatewayRegistrations) (\s :: GetTransitGatewayRegistrationsResponse
s@GetTransitGatewayRegistrationsResponse' {} Maybe [TransitGatewayRegistration]
a -> GetTransitGatewayRegistrationsResponse
s {$sel:transitGatewayRegistrations:GetTransitGatewayRegistrationsResponse' :: Maybe [TransitGatewayRegistration]
transitGatewayRegistrations = Maybe [TransitGatewayRegistration]
a} :: GetTransitGatewayRegistrationsResponse) ((Maybe [TransitGatewayRegistration]
  -> f (Maybe [TransitGatewayRegistration]))
 -> GetTransitGatewayRegistrationsResponse
 -> f GetTransitGatewayRegistrationsResponse)
-> ((Maybe [TransitGatewayRegistration]
     -> f (Maybe [TransitGatewayRegistration]))
    -> Maybe [TransitGatewayRegistration]
    -> f (Maybe [TransitGatewayRegistration]))
-> (Maybe [TransitGatewayRegistration]
    -> f (Maybe [TransitGatewayRegistration]))
-> GetTransitGatewayRegistrationsResponse
-> f GetTransitGatewayRegistrationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TransitGatewayRegistration]
  [TransitGatewayRegistration]
  [TransitGatewayRegistration]
  [TransitGatewayRegistration]
-> Iso
     (Maybe [TransitGatewayRegistration])
     (Maybe [TransitGatewayRegistration])
     (Maybe [TransitGatewayRegistration])
     (Maybe [TransitGatewayRegistration])
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
  [TransitGatewayRegistration]
  [TransitGatewayRegistration]
  [TransitGatewayRegistration]
  [TransitGatewayRegistration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    GetTransitGatewayRegistrationsResponse