{-# 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.GlobalAccelerator.ListCustomRoutingPortMappingsByDestination
-- 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)
--
-- List the port mappings for a specific EC2 instance (destination) in a
-- VPC subnet endpoint. The response is the mappings for one destination IP
-- address. This is useful when your subnet endpoint has mappings that span
-- multiple custom routing accelerators in your account, or for scenarios
-- where you only want to list the port mappings for a specific destination
-- instance.
--
-- This operation returns paginated results.
module Amazonka.GlobalAccelerator.ListCustomRoutingPortMappingsByDestination
  ( -- * Creating a Request
    ListCustomRoutingPortMappingsByDestination (..),
    newListCustomRoutingPortMappingsByDestination,

    -- * Request Lenses
    listCustomRoutingPortMappingsByDestination_nextToken,
    listCustomRoutingPortMappingsByDestination_maxResults,
    listCustomRoutingPortMappingsByDestination_endpointId,
    listCustomRoutingPortMappingsByDestination_destinationAddress,

    -- * Destructuring the Response
    ListCustomRoutingPortMappingsByDestinationResponse (..),
    newListCustomRoutingPortMappingsByDestinationResponse,

    -- * Response Lenses
    listCustomRoutingPortMappingsByDestinationResponse_nextToken,
    listCustomRoutingPortMappingsByDestinationResponse_destinationPortMappings,
    listCustomRoutingPortMappingsByDestinationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.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:/ 'newListCustomRoutingPortMappingsByDestination' smart constructor.
data ListCustomRoutingPortMappingsByDestination = ListCustomRoutingPortMappingsByDestination'
  { -- | The token for the next set of results. You receive this token from a
    -- previous call.
    ListCustomRoutingPortMappingsByDestination -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of destination port mappings that you want to return with
    -- this call. The default value is 10.
    ListCustomRoutingPortMappingsByDestination -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID for the virtual private cloud (VPC) subnet.
    ListCustomRoutingPortMappingsByDestination -> Text
endpointId :: Prelude.Text,
    -- | The endpoint IP address in a virtual private cloud (VPC) subnet for
    -- which you want to receive back port mappings.
    ListCustomRoutingPortMappingsByDestination -> Text
destinationAddress :: Prelude.Text
  }
  deriving (ListCustomRoutingPortMappingsByDestination
-> ListCustomRoutingPortMappingsByDestination -> Bool
(ListCustomRoutingPortMappingsByDestination
 -> ListCustomRoutingPortMappingsByDestination -> Bool)
-> (ListCustomRoutingPortMappingsByDestination
    -> ListCustomRoutingPortMappingsByDestination -> Bool)
-> Eq ListCustomRoutingPortMappingsByDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCustomRoutingPortMappingsByDestination
-> ListCustomRoutingPortMappingsByDestination -> Bool
$c/= :: ListCustomRoutingPortMappingsByDestination
-> ListCustomRoutingPortMappingsByDestination -> Bool
== :: ListCustomRoutingPortMappingsByDestination
-> ListCustomRoutingPortMappingsByDestination -> Bool
$c== :: ListCustomRoutingPortMappingsByDestination
-> ListCustomRoutingPortMappingsByDestination -> Bool
Prelude.Eq, ReadPrec [ListCustomRoutingPortMappingsByDestination]
ReadPrec ListCustomRoutingPortMappingsByDestination
Int -> ReadS ListCustomRoutingPortMappingsByDestination
ReadS [ListCustomRoutingPortMappingsByDestination]
(Int -> ReadS ListCustomRoutingPortMappingsByDestination)
-> ReadS [ListCustomRoutingPortMappingsByDestination]
-> ReadPrec ListCustomRoutingPortMappingsByDestination
-> ReadPrec [ListCustomRoutingPortMappingsByDestination]
-> Read ListCustomRoutingPortMappingsByDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCustomRoutingPortMappingsByDestination]
$creadListPrec :: ReadPrec [ListCustomRoutingPortMappingsByDestination]
readPrec :: ReadPrec ListCustomRoutingPortMappingsByDestination
$creadPrec :: ReadPrec ListCustomRoutingPortMappingsByDestination
readList :: ReadS [ListCustomRoutingPortMappingsByDestination]
$creadList :: ReadS [ListCustomRoutingPortMappingsByDestination]
readsPrec :: Int -> ReadS ListCustomRoutingPortMappingsByDestination
$creadsPrec :: Int -> ReadS ListCustomRoutingPortMappingsByDestination
Prelude.Read, Int -> ListCustomRoutingPortMappingsByDestination -> ShowS
[ListCustomRoutingPortMappingsByDestination] -> ShowS
ListCustomRoutingPortMappingsByDestination -> String
(Int -> ListCustomRoutingPortMappingsByDestination -> ShowS)
-> (ListCustomRoutingPortMappingsByDestination -> String)
-> ([ListCustomRoutingPortMappingsByDestination] -> ShowS)
-> Show ListCustomRoutingPortMappingsByDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCustomRoutingPortMappingsByDestination] -> ShowS
$cshowList :: [ListCustomRoutingPortMappingsByDestination] -> ShowS
show :: ListCustomRoutingPortMappingsByDestination -> String
$cshow :: ListCustomRoutingPortMappingsByDestination -> String
showsPrec :: Int -> ListCustomRoutingPortMappingsByDestination -> ShowS
$cshowsPrec :: Int -> ListCustomRoutingPortMappingsByDestination -> ShowS
Prelude.Show, (forall x.
 ListCustomRoutingPortMappingsByDestination
 -> Rep ListCustomRoutingPortMappingsByDestination x)
-> (forall x.
    Rep ListCustomRoutingPortMappingsByDestination x
    -> ListCustomRoutingPortMappingsByDestination)
-> Generic ListCustomRoutingPortMappingsByDestination
forall x.
Rep ListCustomRoutingPortMappingsByDestination x
-> ListCustomRoutingPortMappingsByDestination
forall x.
ListCustomRoutingPortMappingsByDestination
-> Rep ListCustomRoutingPortMappingsByDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCustomRoutingPortMappingsByDestination x
-> ListCustomRoutingPortMappingsByDestination
$cfrom :: forall x.
ListCustomRoutingPortMappingsByDestination
-> Rep ListCustomRoutingPortMappingsByDestination x
Prelude.Generic)

-- |
-- Create a value of 'ListCustomRoutingPortMappingsByDestination' 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', 'listCustomRoutingPortMappingsByDestination_nextToken' - The token for the next set of results. You receive this token from a
-- previous call.
--
-- 'maxResults', 'listCustomRoutingPortMappingsByDestination_maxResults' - The number of destination port mappings that you want to return with
-- this call. The default value is 10.
--
-- 'endpointId', 'listCustomRoutingPortMappingsByDestination_endpointId' - The ID for the virtual private cloud (VPC) subnet.
--
-- 'destinationAddress', 'listCustomRoutingPortMappingsByDestination_destinationAddress' - The endpoint IP address in a virtual private cloud (VPC) subnet for
-- which you want to receive back port mappings.
newListCustomRoutingPortMappingsByDestination ::
  -- | 'endpointId'
  Prelude.Text ->
  -- | 'destinationAddress'
  Prelude.Text ->
  ListCustomRoutingPortMappingsByDestination
newListCustomRoutingPortMappingsByDestination :: Text -> Text -> ListCustomRoutingPortMappingsByDestination
newListCustomRoutingPortMappingsByDestination
  Text
pEndpointId_
  Text
pDestinationAddress_ =
    ListCustomRoutingPortMappingsByDestination' :: Maybe Text
-> Maybe Natural
-> Text
-> Text
-> ListCustomRoutingPortMappingsByDestination
ListCustomRoutingPortMappingsByDestination'
      { $sel:nextToken:ListCustomRoutingPortMappingsByDestination' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListCustomRoutingPortMappingsByDestination' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:endpointId:ListCustomRoutingPortMappingsByDestination' :: Text
endpointId = Text
pEndpointId_,
        $sel:destinationAddress:ListCustomRoutingPortMappingsByDestination' :: Text
destinationAddress =
          Text
pDestinationAddress_
      }

-- | The token for the next set of results. You receive this token from a
-- previous call.
listCustomRoutingPortMappingsByDestination_nextToken :: Lens.Lens' ListCustomRoutingPortMappingsByDestination (Prelude.Maybe Prelude.Text)
listCustomRoutingPortMappingsByDestination_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCustomRoutingPortMappingsByDestination
-> f ListCustomRoutingPortMappingsByDestination
listCustomRoutingPortMappingsByDestination_nextToken = (ListCustomRoutingPortMappingsByDestination -> Maybe Text)
-> (ListCustomRoutingPortMappingsByDestination
    -> Maybe Text -> ListCustomRoutingPortMappingsByDestination)
-> Lens
     ListCustomRoutingPortMappingsByDestination
     ListCustomRoutingPortMappingsByDestination
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomRoutingPortMappingsByDestination' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCustomRoutingPortMappingsByDestination
s@ListCustomRoutingPortMappingsByDestination' {} Maybe Text
a -> ListCustomRoutingPortMappingsByDestination
s {$sel:nextToken:ListCustomRoutingPortMappingsByDestination' :: Maybe Text
nextToken = Maybe Text
a} :: ListCustomRoutingPortMappingsByDestination)

-- | The number of destination port mappings that you want to return with
-- this call. The default value is 10.
listCustomRoutingPortMappingsByDestination_maxResults :: Lens.Lens' ListCustomRoutingPortMappingsByDestination (Prelude.Maybe Prelude.Natural)
listCustomRoutingPortMappingsByDestination_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListCustomRoutingPortMappingsByDestination
-> f ListCustomRoutingPortMappingsByDestination
listCustomRoutingPortMappingsByDestination_maxResults = (ListCustomRoutingPortMappingsByDestination -> Maybe Natural)
-> (ListCustomRoutingPortMappingsByDestination
    -> Maybe Natural -> ListCustomRoutingPortMappingsByDestination)
-> Lens
     ListCustomRoutingPortMappingsByDestination
     ListCustomRoutingPortMappingsByDestination
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomRoutingPortMappingsByDestination' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCustomRoutingPortMappingsByDestination
s@ListCustomRoutingPortMappingsByDestination' {} Maybe Natural
a -> ListCustomRoutingPortMappingsByDestination
s {$sel:maxResults:ListCustomRoutingPortMappingsByDestination' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCustomRoutingPortMappingsByDestination)

-- | The ID for the virtual private cloud (VPC) subnet.
listCustomRoutingPortMappingsByDestination_endpointId :: Lens.Lens' ListCustomRoutingPortMappingsByDestination Prelude.Text
listCustomRoutingPortMappingsByDestination_endpointId :: (Text -> f Text)
-> ListCustomRoutingPortMappingsByDestination
-> f ListCustomRoutingPortMappingsByDestination
listCustomRoutingPortMappingsByDestination_endpointId = (ListCustomRoutingPortMappingsByDestination -> Text)
-> (ListCustomRoutingPortMappingsByDestination
    -> Text -> ListCustomRoutingPortMappingsByDestination)
-> Lens
     ListCustomRoutingPortMappingsByDestination
     ListCustomRoutingPortMappingsByDestination
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomRoutingPortMappingsByDestination' {Text
endpointId :: Text
$sel:endpointId:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Text
endpointId} -> Text
endpointId) (\s :: ListCustomRoutingPortMappingsByDestination
s@ListCustomRoutingPortMappingsByDestination' {} Text
a -> ListCustomRoutingPortMappingsByDestination
s {$sel:endpointId:ListCustomRoutingPortMappingsByDestination' :: Text
endpointId = Text
a} :: ListCustomRoutingPortMappingsByDestination)

-- | The endpoint IP address in a virtual private cloud (VPC) subnet for
-- which you want to receive back port mappings.
listCustomRoutingPortMappingsByDestination_destinationAddress :: Lens.Lens' ListCustomRoutingPortMappingsByDestination Prelude.Text
listCustomRoutingPortMappingsByDestination_destinationAddress :: (Text -> f Text)
-> ListCustomRoutingPortMappingsByDestination
-> f ListCustomRoutingPortMappingsByDestination
listCustomRoutingPortMappingsByDestination_destinationAddress = (ListCustomRoutingPortMappingsByDestination -> Text)
-> (ListCustomRoutingPortMappingsByDestination
    -> Text -> ListCustomRoutingPortMappingsByDestination)
-> Lens
     ListCustomRoutingPortMappingsByDestination
     ListCustomRoutingPortMappingsByDestination
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomRoutingPortMappingsByDestination' {Text
destinationAddress :: Text
$sel:destinationAddress:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Text
destinationAddress} -> Text
destinationAddress) (\s :: ListCustomRoutingPortMappingsByDestination
s@ListCustomRoutingPortMappingsByDestination' {} Text
a -> ListCustomRoutingPortMappingsByDestination
s {$sel:destinationAddress:ListCustomRoutingPortMappingsByDestination' :: Text
destinationAddress = Text
a} :: ListCustomRoutingPortMappingsByDestination)

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

instance
  Prelude.NFData
    ListCustomRoutingPortMappingsByDestination

instance
  Core.ToHeaders
    ListCustomRoutingPortMappingsByDestination
  where
  toHeaders :: ListCustomRoutingPortMappingsByDestination -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListCustomRoutingPortMappingsByDestination -> 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
"GlobalAccelerator_V20180706.ListCustomRoutingPortMappingsByDestination" ::
                          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
    ListCustomRoutingPortMappingsByDestination
  where
  toJSON :: ListCustomRoutingPortMappingsByDestination -> Value
toJSON
    ListCustomRoutingPortMappingsByDestination' {Maybe Natural
Maybe Text
Text
destinationAddress :: Text
endpointId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:destinationAddress:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Text
$sel:endpointId:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Text
$sel:maxResults:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Maybe Natural
$sel:nextToken:ListCustomRoutingPortMappingsByDestination' :: ListCustomRoutingPortMappingsByDestination -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (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 -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointId),
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
                (Text
"DestinationAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationAddress)
            ]
        )

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

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

-- | /See:/ 'newListCustomRoutingPortMappingsByDestinationResponse' smart constructor.
data ListCustomRoutingPortMappingsByDestinationResponse = ListCustomRoutingPortMappingsByDestinationResponse'
  { -- | The token for the next set of results. You receive this token from a
    -- previous call.
    ListCustomRoutingPortMappingsByDestinationResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The port mappings for the endpoint IP address that you specified in the
    -- request.
    ListCustomRoutingPortMappingsByDestinationResponse
-> Maybe [DestinationPortMapping]
destinationPortMappings :: Prelude.Maybe [DestinationPortMapping],
    -- | The response's http status code.
    ListCustomRoutingPortMappingsByDestinationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListCustomRoutingPortMappingsByDestinationResponse
-> ListCustomRoutingPortMappingsByDestinationResponse -> Bool
(ListCustomRoutingPortMappingsByDestinationResponse
 -> ListCustomRoutingPortMappingsByDestinationResponse -> Bool)
-> (ListCustomRoutingPortMappingsByDestinationResponse
    -> ListCustomRoutingPortMappingsByDestinationResponse -> Bool)
-> Eq ListCustomRoutingPortMappingsByDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCustomRoutingPortMappingsByDestinationResponse
-> ListCustomRoutingPortMappingsByDestinationResponse -> Bool
$c/= :: ListCustomRoutingPortMappingsByDestinationResponse
-> ListCustomRoutingPortMappingsByDestinationResponse -> Bool
== :: ListCustomRoutingPortMappingsByDestinationResponse
-> ListCustomRoutingPortMappingsByDestinationResponse -> Bool
$c== :: ListCustomRoutingPortMappingsByDestinationResponse
-> ListCustomRoutingPortMappingsByDestinationResponse -> Bool
Prelude.Eq, ReadPrec [ListCustomRoutingPortMappingsByDestinationResponse]
ReadPrec ListCustomRoutingPortMappingsByDestinationResponse
Int -> ReadS ListCustomRoutingPortMappingsByDestinationResponse
ReadS [ListCustomRoutingPortMappingsByDestinationResponse]
(Int -> ReadS ListCustomRoutingPortMappingsByDestinationResponse)
-> ReadS [ListCustomRoutingPortMappingsByDestinationResponse]
-> ReadPrec ListCustomRoutingPortMappingsByDestinationResponse
-> ReadPrec [ListCustomRoutingPortMappingsByDestinationResponse]
-> Read ListCustomRoutingPortMappingsByDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCustomRoutingPortMappingsByDestinationResponse]
$creadListPrec :: ReadPrec [ListCustomRoutingPortMappingsByDestinationResponse]
readPrec :: ReadPrec ListCustomRoutingPortMappingsByDestinationResponse
$creadPrec :: ReadPrec ListCustomRoutingPortMappingsByDestinationResponse
readList :: ReadS [ListCustomRoutingPortMappingsByDestinationResponse]
$creadList :: ReadS [ListCustomRoutingPortMappingsByDestinationResponse]
readsPrec :: Int -> ReadS ListCustomRoutingPortMappingsByDestinationResponse
$creadsPrec :: Int -> ReadS ListCustomRoutingPortMappingsByDestinationResponse
Prelude.Read, Int -> ListCustomRoutingPortMappingsByDestinationResponse -> ShowS
[ListCustomRoutingPortMappingsByDestinationResponse] -> ShowS
ListCustomRoutingPortMappingsByDestinationResponse -> String
(Int
 -> ListCustomRoutingPortMappingsByDestinationResponse -> ShowS)
-> (ListCustomRoutingPortMappingsByDestinationResponse -> String)
-> ([ListCustomRoutingPortMappingsByDestinationResponse] -> ShowS)
-> Show ListCustomRoutingPortMappingsByDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCustomRoutingPortMappingsByDestinationResponse] -> ShowS
$cshowList :: [ListCustomRoutingPortMappingsByDestinationResponse] -> ShowS
show :: ListCustomRoutingPortMappingsByDestinationResponse -> String
$cshow :: ListCustomRoutingPortMappingsByDestinationResponse -> String
showsPrec :: Int -> ListCustomRoutingPortMappingsByDestinationResponse -> ShowS
$cshowsPrec :: Int -> ListCustomRoutingPortMappingsByDestinationResponse -> ShowS
Prelude.Show, (forall x.
 ListCustomRoutingPortMappingsByDestinationResponse
 -> Rep ListCustomRoutingPortMappingsByDestinationResponse x)
-> (forall x.
    Rep ListCustomRoutingPortMappingsByDestinationResponse x
    -> ListCustomRoutingPortMappingsByDestinationResponse)
-> Generic ListCustomRoutingPortMappingsByDestinationResponse
forall x.
Rep ListCustomRoutingPortMappingsByDestinationResponse x
-> ListCustomRoutingPortMappingsByDestinationResponse
forall x.
ListCustomRoutingPortMappingsByDestinationResponse
-> Rep ListCustomRoutingPortMappingsByDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCustomRoutingPortMappingsByDestinationResponse x
-> ListCustomRoutingPortMappingsByDestinationResponse
$cfrom :: forall x.
ListCustomRoutingPortMappingsByDestinationResponse
-> Rep ListCustomRoutingPortMappingsByDestinationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListCustomRoutingPortMappingsByDestinationResponse' 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', 'listCustomRoutingPortMappingsByDestinationResponse_nextToken' - The token for the next set of results. You receive this token from a
-- previous call.
--
-- 'destinationPortMappings', 'listCustomRoutingPortMappingsByDestinationResponse_destinationPortMappings' - The port mappings for the endpoint IP address that you specified in the
-- request.
--
-- 'httpStatus', 'listCustomRoutingPortMappingsByDestinationResponse_httpStatus' - The response's http status code.
newListCustomRoutingPortMappingsByDestinationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCustomRoutingPortMappingsByDestinationResponse
newListCustomRoutingPortMappingsByDestinationResponse :: Int -> ListCustomRoutingPortMappingsByDestinationResponse
newListCustomRoutingPortMappingsByDestinationResponse
  Int
pHttpStatus_ =
    ListCustomRoutingPortMappingsByDestinationResponse' :: Maybe Text
-> Maybe [DestinationPortMapping]
-> Int
-> ListCustomRoutingPortMappingsByDestinationResponse
ListCustomRoutingPortMappingsByDestinationResponse'
      { $sel:nextToken:ListCustomRoutingPortMappingsByDestinationResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:destinationPortMappings:ListCustomRoutingPortMappingsByDestinationResponse' :: Maybe [DestinationPortMapping]
destinationPortMappings =
          Maybe [DestinationPortMapping]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListCustomRoutingPortMappingsByDestinationResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The token for the next set of results. You receive this token from a
-- previous call.
listCustomRoutingPortMappingsByDestinationResponse_nextToken :: Lens.Lens' ListCustomRoutingPortMappingsByDestinationResponse (Prelude.Maybe Prelude.Text)
listCustomRoutingPortMappingsByDestinationResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCustomRoutingPortMappingsByDestinationResponse
-> f ListCustomRoutingPortMappingsByDestinationResponse
listCustomRoutingPortMappingsByDestinationResponse_nextToken = (ListCustomRoutingPortMappingsByDestinationResponse -> Maybe Text)
-> (ListCustomRoutingPortMappingsByDestinationResponse
    -> Maybe Text
    -> ListCustomRoutingPortMappingsByDestinationResponse)
-> Lens'
     ListCustomRoutingPortMappingsByDestinationResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomRoutingPortMappingsByDestinationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCustomRoutingPortMappingsByDestinationResponse' :: ListCustomRoutingPortMappingsByDestinationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCustomRoutingPortMappingsByDestinationResponse
s@ListCustomRoutingPortMappingsByDestinationResponse' {} Maybe Text
a -> ListCustomRoutingPortMappingsByDestinationResponse
s {$sel:nextToken:ListCustomRoutingPortMappingsByDestinationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCustomRoutingPortMappingsByDestinationResponse)

-- | The port mappings for the endpoint IP address that you specified in the
-- request.
listCustomRoutingPortMappingsByDestinationResponse_destinationPortMappings :: Lens.Lens' ListCustomRoutingPortMappingsByDestinationResponse (Prelude.Maybe [DestinationPortMapping])
listCustomRoutingPortMappingsByDestinationResponse_destinationPortMappings :: (Maybe [DestinationPortMapping]
 -> f (Maybe [DestinationPortMapping]))
-> ListCustomRoutingPortMappingsByDestinationResponse
-> f ListCustomRoutingPortMappingsByDestinationResponse
listCustomRoutingPortMappingsByDestinationResponse_destinationPortMappings = (ListCustomRoutingPortMappingsByDestinationResponse
 -> Maybe [DestinationPortMapping])
-> (ListCustomRoutingPortMappingsByDestinationResponse
    -> Maybe [DestinationPortMapping]
    -> ListCustomRoutingPortMappingsByDestinationResponse)
-> Lens'
     ListCustomRoutingPortMappingsByDestinationResponse
     (Maybe [DestinationPortMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCustomRoutingPortMappingsByDestinationResponse' {Maybe [DestinationPortMapping]
destinationPortMappings :: Maybe [DestinationPortMapping]
$sel:destinationPortMappings:ListCustomRoutingPortMappingsByDestinationResponse' :: ListCustomRoutingPortMappingsByDestinationResponse
-> Maybe [DestinationPortMapping]
destinationPortMappings} -> Maybe [DestinationPortMapping]
destinationPortMappings) (\s :: ListCustomRoutingPortMappingsByDestinationResponse
s@ListCustomRoutingPortMappingsByDestinationResponse' {} Maybe [DestinationPortMapping]
a -> ListCustomRoutingPortMappingsByDestinationResponse
s {$sel:destinationPortMappings:ListCustomRoutingPortMappingsByDestinationResponse' :: Maybe [DestinationPortMapping]
destinationPortMappings = Maybe [DestinationPortMapping]
a} :: ListCustomRoutingPortMappingsByDestinationResponse) ((Maybe [DestinationPortMapping]
  -> f (Maybe [DestinationPortMapping]))
 -> ListCustomRoutingPortMappingsByDestinationResponse
 -> f ListCustomRoutingPortMappingsByDestinationResponse)
-> ((Maybe [DestinationPortMapping]
     -> f (Maybe [DestinationPortMapping]))
    -> Maybe [DestinationPortMapping]
    -> f (Maybe [DestinationPortMapping]))
-> (Maybe [DestinationPortMapping]
    -> f (Maybe [DestinationPortMapping]))
-> ListCustomRoutingPortMappingsByDestinationResponse
-> f ListCustomRoutingPortMappingsByDestinationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DestinationPortMapping]
  [DestinationPortMapping]
  [DestinationPortMapping]
  [DestinationPortMapping]
-> Iso
     (Maybe [DestinationPortMapping])
     (Maybe [DestinationPortMapping])
     (Maybe [DestinationPortMapping])
     (Maybe [DestinationPortMapping])
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
  [DestinationPortMapping]
  [DestinationPortMapping]
  [DestinationPortMapping]
  [DestinationPortMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListCustomRoutingPortMappingsByDestinationResponse