{-# 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.GetCustomerGatewayAssociations
-- 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 the association information for customer gateways that are
-- associated with devices and links in your global network.
--
-- This operation returns paginated results.
module Amazonka.NetworkManager.GetCustomerGatewayAssociations
  ( -- * Creating a Request
    GetCustomerGatewayAssociations (..),
    newGetCustomerGatewayAssociations,

    -- * Request Lenses
    getCustomerGatewayAssociations_nextToken,
    getCustomerGatewayAssociations_customerGatewayArns,
    getCustomerGatewayAssociations_maxResults,
    getCustomerGatewayAssociations_globalNetworkId,

    -- * Destructuring the Response
    GetCustomerGatewayAssociationsResponse (..),
    newGetCustomerGatewayAssociationsResponse,

    -- * Response Lenses
    getCustomerGatewayAssociationsResponse_nextToken,
    getCustomerGatewayAssociationsResponse_customerGatewayAssociations,
    getCustomerGatewayAssociationsResponse_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:/ 'newGetCustomerGatewayAssociations' smart constructor.
data GetCustomerGatewayAssociations = GetCustomerGatewayAssociations'
  { -- | The token for the next page of results.
    GetCustomerGatewayAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | One or more customer gateway Amazon Resource Names (ARNs). For more
    -- information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonec2.html#amazonec2-resources-for-iam-policies Resources Defined by Amazon EC2>.
    -- The maximum is 10.
    GetCustomerGatewayAssociations -> Maybe [Text]
customerGatewayArns :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of results to return.
    GetCustomerGatewayAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the global network.
    GetCustomerGatewayAssociations -> Text
globalNetworkId :: Prelude.Text
  }
  deriving (GetCustomerGatewayAssociations
-> GetCustomerGatewayAssociations -> Bool
(GetCustomerGatewayAssociations
 -> GetCustomerGatewayAssociations -> Bool)
-> (GetCustomerGatewayAssociations
    -> GetCustomerGatewayAssociations -> Bool)
-> Eq GetCustomerGatewayAssociations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCustomerGatewayAssociations
-> GetCustomerGatewayAssociations -> Bool
$c/= :: GetCustomerGatewayAssociations
-> GetCustomerGatewayAssociations -> Bool
== :: GetCustomerGatewayAssociations
-> GetCustomerGatewayAssociations -> Bool
$c== :: GetCustomerGatewayAssociations
-> GetCustomerGatewayAssociations -> Bool
Prelude.Eq, ReadPrec [GetCustomerGatewayAssociations]
ReadPrec GetCustomerGatewayAssociations
Int -> ReadS GetCustomerGatewayAssociations
ReadS [GetCustomerGatewayAssociations]
(Int -> ReadS GetCustomerGatewayAssociations)
-> ReadS [GetCustomerGatewayAssociations]
-> ReadPrec GetCustomerGatewayAssociations
-> ReadPrec [GetCustomerGatewayAssociations]
-> Read GetCustomerGatewayAssociations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCustomerGatewayAssociations]
$creadListPrec :: ReadPrec [GetCustomerGatewayAssociations]
readPrec :: ReadPrec GetCustomerGatewayAssociations
$creadPrec :: ReadPrec GetCustomerGatewayAssociations
readList :: ReadS [GetCustomerGatewayAssociations]
$creadList :: ReadS [GetCustomerGatewayAssociations]
readsPrec :: Int -> ReadS GetCustomerGatewayAssociations
$creadsPrec :: Int -> ReadS GetCustomerGatewayAssociations
Prelude.Read, Int -> GetCustomerGatewayAssociations -> ShowS
[GetCustomerGatewayAssociations] -> ShowS
GetCustomerGatewayAssociations -> String
(Int -> GetCustomerGatewayAssociations -> ShowS)
-> (GetCustomerGatewayAssociations -> String)
-> ([GetCustomerGatewayAssociations] -> ShowS)
-> Show GetCustomerGatewayAssociations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCustomerGatewayAssociations] -> ShowS
$cshowList :: [GetCustomerGatewayAssociations] -> ShowS
show :: GetCustomerGatewayAssociations -> String
$cshow :: GetCustomerGatewayAssociations -> String
showsPrec :: Int -> GetCustomerGatewayAssociations -> ShowS
$cshowsPrec :: Int -> GetCustomerGatewayAssociations -> ShowS
Prelude.Show, (forall x.
 GetCustomerGatewayAssociations
 -> Rep GetCustomerGatewayAssociations x)
-> (forall x.
    Rep GetCustomerGatewayAssociations x
    -> GetCustomerGatewayAssociations)
-> Generic GetCustomerGatewayAssociations
forall x.
Rep GetCustomerGatewayAssociations x
-> GetCustomerGatewayAssociations
forall x.
GetCustomerGatewayAssociations
-> Rep GetCustomerGatewayAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCustomerGatewayAssociations x
-> GetCustomerGatewayAssociations
$cfrom :: forall x.
GetCustomerGatewayAssociations
-> Rep GetCustomerGatewayAssociations x
Prelude.Generic)

-- |
-- Create a value of 'GetCustomerGatewayAssociations' 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', 'getCustomerGatewayAssociations_nextToken' - The token for the next page of results.
--
-- 'customerGatewayArns', 'getCustomerGatewayAssociations_customerGatewayArns' - One or more customer gateway Amazon Resource Names (ARNs). For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonec2.html#amazonec2-resources-for-iam-policies Resources Defined by Amazon EC2>.
-- The maximum is 10.
--
-- 'maxResults', 'getCustomerGatewayAssociations_maxResults' - The maximum number of results to return.
--
-- 'globalNetworkId', 'getCustomerGatewayAssociations_globalNetworkId' - The ID of the global network.
newGetCustomerGatewayAssociations ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  GetCustomerGatewayAssociations
newGetCustomerGatewayAssociations :: Text -> GetCustomerGatewayAssociations
newGetCustomerGatewayAssociations Text
pGlobalNetworkId_ =
  GetCustomerGatewayAssociations' :: Maybe Text
-> Maybe [Text]
-> Maybe Natural
-> Text
-> GetCustomerGatewayAssociations
GetCustomerGatewayAssociations'
    { $sel:nextToken:GetCustomerGatewayAssociations' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:customerGatewayArns:GetCustomerGatewayAssociations' :: Maybe [Text]
customerGatewayArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetCustomerGatewayAssociations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GetCustomerGatewayAssociations' :: Text
globalNetworkId = Text
pGlobalNetworkId_
    }

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

-- | One or more customer gateway Amazon Resource Names (ARNs). For more
-- information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonec2.html#amazonec2-resources-for-iam-policies Resources Defined by Amazon EC2>.
-- The maximum is 10.
getCustomerGatewayAssociations_customerGatewayArns :: Lens.Lens' GetCustomerGatewayAssociations (Prelude.Maybe [Prelude.Text])
getCustomerGatewayAssociations_customerGatewayArns :: (Maybe [Text] -> f (Maybe [Text]))
-> GetCustomerGatewayAssociations
-> f GetCustomerGatewayAssociations
getCustomerGatewayAssociations_customerGatewayArns = (GetCustomerGatewayAssociations -> Maybe [Text])
-> (GetCustomerGatewayAssociations
    -> Maybe [Text] -> GetCustomerGatewayAssociations)
-> Lens
     GetCustomerGatewayAssociations
     GetCustomerGatewayAssociations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCustomerGatewayAssociations' {Maybe [Text]
customerGatewayArns :: Maybe [Text]
$sel:customerGatewayArns:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe [Text]
customerGatewayArns} -> Maybe [Text]
customerGatewayArns) (\s :: GetCustomerGatewayAssociations
s@GetCustomerGatewayAssociations' {} Maybe [Text]
a -> GetCustomerGatewayAssociations
s {$sel:customerGatewayArns:GetCustomerGatewayAssociations' :: Maybe [Text]
customerGatewayArns = Maybe [Text]
a} :: GetCustomerGatewayAssociations) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetCustomerGatewayAssociations
 -> f GetCustomerGatewayAssociations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetCustomerGatewayAssociations
-> f GetCustomerGatewayAssociations
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 maximum number of results to return.
getCustomerGatewayAssociations_maxResults :: Lens.Lens' GetCustomerGatewayAssociations (Prelude.Maybe Prelude.Natural)
getCustomerGatewayAssociations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetCustomerGatewayAssociations
-> f GetCustomerGatewayAssociations
getCustomerGatewayAssociations_maxResults = (GetCustomerGatewayAssociations -> Maybe Natural)
-> (GetCustomerGatewayAssociations
    -> Maybe Natural -> GetCustomerGatewayAssociations)
-> Lens
     GetCustomerGatewayAssociations
     GetCustomerGatewayAssociations
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCustomerGatewayAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetCustomerGatewayAssociations
s@GetCustomerGatewayAssociations' {} Maybe Natural
a -> GetCustomerGatewayAssociations
s {$sel:maxResults:GetCustomerGatewayAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetCustomerGatewayAssociations)

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

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

instance
  Prelude.NFData
    GetCustomerGatewayAssociations

instance
  Core.ToHeaders
    GetCustomerGatewayAssociations
  where
  toHeaders :: GetCustomerGatewayAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetCustomerGatewayAssociations -> 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 GetCustomerGatewayAssociations where
  toPath :: GetCustomerGatewayAssociations -> ByteString
toPath GetCustomerGatewayAssociations' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
customerGatewayArns :: Maybe [Text]
nextToken :: Maybe Text
$sel:globalNetworkId:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Text
$sel:maxResults:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe Natural
$sel:customerGatewayArns:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe [Text]
$sel:nextToken:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> 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
"/customer-gateway-associations"
      ]

instance Core.ToQuery GetCustomerGatewayAssociations where
  toQuery :: GetCustomerGatewayAssociations -> QueryString
toQuery GetCustomerGatewayAssociations' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
customerGatewayArns :: Maybe [Text]
nextToken :: Maybe Text
$sel:globalNetworkId:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Text
$sel:maxResults:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe Natural
$sel:customerGatewayArns:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe [Text]
$sel:nextToken:GetCustomerGatewayAssociations' :: GetCustomerGatewayAssociations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"customerGatewayArns"
          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]
customerGatewayArns
            ),
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

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

-- |
-- Create a value of 'GetCustomerGatewayAssociationsResponse' 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', 'getCustomerGatewayAssociationsResponse_nextToken' - The token for the next page of results.
--
-- 'customerGatewayAssociations', 'getCustomerGatewayAssociationsResponse_customerGatewayAssociations' - The customer gateway associations.
--
-- 'httpStatus', 'getCustomerGatewayAssociationsResponse_httpStatus' - The response's http status code.
newGetCustomerGatewayAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCustomerGatewayAssociationsResponse
newGetCustomerGatewayAssociationsResponse :: Int -> GetCustomerGatewayAssociationsResponse
newGetCustomerGatewayAssociationsResponse
  Int
pHttpStatus_ =
    GetCustomerGatewayAssociationsResponse' :: Maybe Text
-> Maybe [CustomerGatewayAssociation]
-> Int
-> GetCustomerGatewayAssociationsResponse
GetCustomerGatewayAssociationsResponse'
      { $sel:nextToken:GetCustomerGatewayAssociationsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:customerGatewayAssociations:GetCustomerGatewayAssociationsResponse' :: Maybe [CustomerGatewayAssociation]
customerGatewayAssociations =
          Maybe [CustomerGatewayAssociation]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetCustomerGatewayAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

-- | The customer gateway associations.
getCustomerGatewayAssociationsResponse_customerGatewayAssociations :: Lens.Lens' GetCustomerGatewayAssociationsResponse (Prelude.Maybe [CustomerGatewayAssociation])
getCustomerGatewayAssociationsResponse_customerGatewayAssociations :: (Maybe [CustomerGatewayAssociation]
 -> f (Maybe [CustomerGatewayAssociation]))
-> GetCustomerGatewayAssociationsResponse
-> f GetCustomerGatewayAssociationsResponse
getCustomerGatewayAssociationsResponse_customerGatewayAssociations = (GetCustomerGatewayAssociationsResponse
 -> Maybe [CustomerGatewayAssociation])
-> (GetCustomerGatewayAssociationsResponse
    -> Maybe [CustomerGatewayAssociation]
    -> GetCustomerGatewayAssociationsResponse)
-> Lens'
     GetCustomerGatewayAssociationsResponse
     (Maybe [CustomerGatewayAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCustomerGatewayAssociationsResponse' {Maybe [CustomerGatewayAssociation]
customerGatewayAssociations :: Maybe [CustomerGatewayAssociation]
$sel:customerGatewayAssociations:GetCustomerGatewayAssociationsResponse' :: GetCustomerGatewayAssociationsResponse
-> Maybe [CustomerGatewayAssociation]
customerGatewayAssociations} -> Maybe [CustomerGatewayAssociation]
customerGatewayAssociations) (\s :: GetCustomerGatewayAssociationsResponse
s@GetCustomerGatewayAssociationsResponse' {} Maybe [CustomerGatewayAssociation]
a -> GetCustomerGatewayAssociationsResponse
s {$sel:customerGatewayAssociations:GetCustomerGatewayAssociationsResponse' :: Maybe [CustomerGatewayAssociation]
customerGatewayAssociations = Maybe [CustomerGatewayAssociation]
a} :: GetCustomerGatewayAssociationsResponse) ((Maybe [CustomerGatewayAssociation]
  -> f (Maybe [CustomerGatewayAssociation]))
 -> GetCustomerGatewayAssociationsResponse
 -> f GetCustomerGatewayAssociationsResponse)
-> ((Maybe [CustomerGatewayAssociation]
     -> f (Maybe [CustomerGatewayAssociation]))
    -> Maybe [CustomerGatewayAssociation]
    -> f (Maybe [CustomerGatewayAssociation]))
-> (Maybe [CustomerGatewayAssociation]
    -> f (Maybe [CustomerGatewayAssociation]))
-> GetCustomerGatewayAssociationsResponse
-> f GetCustomerGatewayAssociationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CustomerGatewayAssociation]
  [CustomerGatewayAssociation]
  [CustomerGatewayAssociation]
  [CustomerGatewayAssociation]
-> Iso
     (Maybe [CustomerGatewayAssociation])
     (Maybe [CustomerGatewayAssociation])
     (Maybe [CustomerGatewayAssociation])
     (Maybe [CustomerGatewayAssociation])
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
  [CustomerGatewayAssociation]
  [CustomerGatewayAssociation]
  [CustomerGatewayAssociation]
  [CustomerGatewayAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetCustomerGatewayAssociationsResponse