{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.DestinationPortMapping
-- 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)
module Amazonka.GlobalAccelerator.Types.DestinationPortMapping where

import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.Types.CustomRoutingDestinationTrafficState
import Amazonka.GlobalAccelerator.Types.IpAddressType
import Amazonka.GlobalAccelerator.Types.SocketAddress
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The port mappings for a specified endpoint IP address (destination).
--
-- /See:/ 'newDestinationPortMapping' smart constructor.
data DestinationPortMapping = DestinationPortMapping'
  { -- | The endpoint IP address\/port combination for traffic received on the
    -- accelerator socket address.
    DestinationPortMapping -> Maybe SocketAddress
destinationSocketAddress :: Prelude.Maybe SocketAddress,
    -- | The Amazon Resource Name (ARN) of the custom routing accelerator that
    -- you have port mappings for.
    DestinationPortMapping -> Maybe Text
acceleratorArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the endpoint group.
    DestinationPortMapping -> Maybe Text
endpointGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The AWS Region for the endpoint group.
    DestinationPortMapping -> Maybe Text
endpointGroupRegion :: Prelude.Maybe Prelude.Text,
    -- | The IP address type, which must be IPv4.
    DestinationPortMapping -> Maybe IpAddressType
ipAddressType :: Prelude.Maybe IpAddressType,
    -- | The IP address\/port combinations (sockets) that map to a given
    -- destination socket address.
    DestinationPortMapping -> Maybe [SocketAddress]
acceleratorSocketAddresses :: Prelude.Maybe [SocketAddress],
    -- | The ID for the virtual private cloud (VPC) subnet.
    DestinationPortMapping -> Maybe Text
endpointId :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether or not a port mapping destination can receive traffic.
    -- The value is either ALLOW, if traffic is allowed to the destination, or
    -- DENY, if traffic is not allowed to the destination.
    DestinationPortMapping
-> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState :: Prelude.Maybe CustomRoutingDestinationTrafficState
  }
  deriving (DestinationPortMapping -> DestinationPortMapping -> Bool
(DestinationPortMapping -> DestinationPortMapping -> Bool)
-> (DestinationPortMapping -> DestinationPortMapping -> Bool)
-> Eq DestinationPortMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationPortMapping -> DestinationPortMapping -> Bool
$c/= :: DestinationPortMapping -> DestinationPortMapping -> Bool
== :: DestinationPortMapping -> DestinationPortMapping -> Bool
$c== :: DestinationPortMapping -> DestinationPortMapping -> Bool
Prelude.Eq, ReadPrec [DestinationPortMapping]
ReadPrec DestinationPortMapping
Int -> ReadS DestinationPortMapping
ReadS [DestinationPortMapping]
(Int -> ReadS DestinationPortMapping)
-> ReadS [DestinationPortMapping]
-> ReadPrec DestinationPortMapping
-> ReadPrec [DestinationPortMapping]
-> Read DestinationPortMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationPortMapping]
$creadListPrec :: ReadPrec [DestinationPortMapping]
readPrec :: ReadPrec DestinationPortMapping
$creadPrec :: ReadPrec DestinationPortMapping
readList :: ReadS [DestinationPortMapping]
$creadList :: ReadS [DestinationPortMapping]
readsPrec :: Int -> ReadS DestinationPortMapping
$creadsPrec :: Int -> ReadS DestinationPortMapping
Prelude.Read, Int -> DestinationPortMapping -> ShowS
[DestinationPortMapping] -> ShowS
DestinationPortMapping -> String
(Int -> DestinationPortMapping -> ShowS)
-> (DestinationPortMapping -> String)
-> ([DestinationPortMapping] -> ShowS)
-> Show DestinationPortMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationPortMapping] -> ShowS
$cshowList :: [DestinationPortMapping] -> ShowS
show :: DestinationPortMapping -> String
$cshow :: DestinationPortMapping -> String
showsPrec :: Int -> DestinationPortMapping -> ShowS
$cshowsPrec :: Int -> DestinationPortMapping -> ShowS
Prelude.Show, (forall x. DestinationPortMapping -> Rep DestinationPortMapping x)
-> (forall x.
    Rep DestinationPortMapping x -> DestinationPortMapping)
-> Generic DestinationPortMapping
forall x. Rep DestinationPortMapping x -> DestinationPortMapping
forall x. DestinationPortMapping -> Rep DestinationPortMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationPortMapping x -> DestinationPortMapping
$cfrom :: forall x. DestinationPortMapping -> Rep DestinationPortMapping x
Prelude.Generic)

-- |
-- Create a value of 'DestinationPortMapping' 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:
--
-- 'destinationSocketAddress', 'destinationPortMapping_destinationSocketAddress' - The endpoint IP address\/port combination for traffic received on the
-- accelerator socket address.
--
-- 'acceleratorArn', 'destinationPortMapping_acceleratorArn' - The Amazon Resource Name (ARN) of the custom routing accelerator that
-- you have port mappings for.
--
-- 'endpointGroupArn', 'destinationPortMapping_endpointGroupArn' - The Amazon Resource Name (ARN) of the endpoint group.
--
-- 'endpointGroupRegion', 'destinationPortMapping_endpointGroupRegion' - The AWS Region for the endpoint group.
--
-- 'ipAddressType', 'destinationPortMapping_ipAddressType' - The IP address type, which must be IPv4.
--
-- 'acceleratorSocketAddresses', 'destinationPortMapping_acceleratorSocketAddresses' - The IP address\/port combinations (sockets) that map to a given
-- destination socket address.
--
-- 'endpointId', 'destinationPortMapping_endpointId' - The ID for the virtual private cloud (VPC) subnet.
--
-- 'destinationTrafficState', 'destinationPortMapping_destinationTrafficState' - Indicates whether or not a port mapping destination can receive traffic.
-- The value is either ALLOW, if traffic is allowed to the destination, or
-- DENY, if traffic is not allowed to the destination.
newDestinationPortMapping ::
  DestinationPortMapping
newDestinationPortMapping :: DestinationPortMapping
newDestinationPortMapping =
  DestinationPortMapping' :: Maybe SocketAddress
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe IpAddressType
-> Maybe [SocketAddress]
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> DestinationPortMapping
DestinationPortMapping'
    { $sel:destinationSocketAddress:DestinationPortMapping' :: Maybe SocketAddress
destinationSocketAddress =
        Maybe SocketAddress
forall a. Maybe a
Prelude.Nothing,
      $sel:acceleratorArn:DestinationPortMapping' :: Maybe Text
acceleratorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointGroupArn:DestinationPortMapping' :: Maybe Text
endpointGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointGroupRegion:DestinationPortMapping' :: Maybe Text
endpointGroupRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddressType:DestinationPortMapping' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
forall a. Maybe a
Prelude.Nothing,
      $sel:acceleratorSocketAddresses:DestinationPortMapping' :: Maybe [SocketAddress]
acceleratorSocketAddresses = Maybe [SocketAddress]
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointId:DestinationPortMapping' :: Maybe Text
endpointId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationTrafficState:DestinationPortMapping' :: Maybe CustomRoutingDestinationTrafficState
destinationTrafficState = Maybe CustomRoutingDestinationTrafficState
forall a. Maybe a
Prelude.Nothing
    }

-- | The endpoint IP address\/port combination for traffic received on the
-- accelerator socket address.
destinationPortMapping_destinationSocketAddress :: Lens.Lens' DestinationPortMapping (Prelude.Maybe SocketAddress)
destinationPortMapping_destinationSocketAddress :: (Maybe SocketAddress -> f (Maybe SocketAddress))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_destinationSocketAddress = (DestinationPortMapping -> Maybe SocketAddress)
-> (DestinationPortMapping
    -> Maybe SocketAddress -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe SocketAddress)
     (Maybe SocketAddress)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe SocketAddress
destinationSocketAddress :: Maybe SocketAddress
$sel:destinationSocketAddress:DestinationPortMapping' :: DestinationPortMapping -> Maybe SocketAddress
destinationSocketAddress} -> Maybe SocketAddress
destinationSocketAddress) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe SocketAddress
a -> DestinationPortMapping
s {$sel:destinationSocketAddress:DestinationPortMapping' :: Maybe SocketAddress
destinationSocketAddress = Maybe SocketAddress
a} :: DestinationPortMapping)

-- | The Amazon Resource Name (ARN) of the custom routing accelerator that
-- you have port mappings for.
destinationPortMapping_acceleratorArn :: Lens.Lens' DestinationPortMapping (Prelude.Maybe Prelude.Text)
destinationPortMapping_acceleratorArn :: (Maybe Text -> f (Maybe Text))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_acceleratorArn = (DestinationPortMapping -> Maybe Text)
-> (DestinationPortMapping -> Maybe Text -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe Text
acceleratorArn :: Maybe Text
$sel:acceleratorArn:DestinationPortMapping' :: DestinationPortMapping -> Maybe Text
acceleratorArn} -> Maybe Text
acceleratorArn) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe Text
a -> DestinationPortMapping
s {$sel:acceleratorArn:DestinationPortMapping' :: Maybe Text
acceleratorArn = Maybe Text
a} :: DestinationPortMapping)

-- | The Amazon Resource Name (ARN) of the endpoint group.
destinationPortMapping_endpointGroupArn :: Lens.Lens' DestinationPortMapping (Prelude.Maybe Prelude.Text)
destinationPortMapping_endpointGroupArn :: (Maybe Text -> f (Maybe Text))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_endpointGroupArn = (DestinationPortMapping -> Maybe Text)
-> (DestinationPortMapping -> Maybe Text -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe Text
endpointGroupArn :: Maybe Text
$sel:endpointGroupArn:DestinationPortMapping' :: DestinationPortMapping -> Maybe Text
endpointGroupArn} -> Maybe Text
endpointGroupArn) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe Text
a -> DestinationPortMapping
s {$sel:endpointGroupArn:DestinationPortMapping' :: Maybe Text
endpointGroupArn = Maybe Text
a} :: DestinationPortMapping)

-- | The AWS Region for the endpoint group.
destinationPortMapping_endpointGroupRegion :: Lens.Lens' DestinationPortMapping (Prelude.Maybe Prelude.Text)
destinationPortMapping_endpointGroupRegion :: (Maybe Text -> f (Maybe Text))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_endpointGroupRegion = (DestinationPortMapping -> Maybe Text)
-> (DestinationPortMapping -> Maybe Text -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe Text
endpointGroupRegion :: Maybe Text
$sel:endpointGroupRegion:DestinationPortMapping' :: DestinationPortMapping -> Maybe Text
endpointGroupRegion} -> Maybe Text
endpointGroupRegion) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe Text
a -> DestinationPortMapping
s {$sel:endpointGroupRegion:DestinationPortMapping' :: Maybe Text
endpointGroupRegion = Maybe Text
a} :: DestinationPortMapping)

-- | The IP address type, which must be IPv4.
destinationPortMapping_ipAddressType :: Lens.Lens' DestinationPortMapping (Prelude.Maybe IpAddressType)
destinationPortMapping_ipAddressType :: (Maybe IpAddressType -> f (Maybe IpAddressType))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_ipAddressType = (DestinationPortMapping -> Maybe IpAddressType)
-> (DestinationPortMapping
    -> Maybe IpAddressType -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe IpAddressType)
     (Maybe IpAddressType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe IpAddressType
ipAddressType :: Maybe IpAddressType
$sel:ipAddressType:DestinationPortMapping' :: DestinationPortMapping -> Maybe IpAddressType
ipAddressType} -> Maybe IpAddressType
ipAddressType) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe IpAddressType
a -> DestinationPortMapping
s {$sel:ipAddressType:DestinationPortMapping' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
a} :: DestinationPortMapping)

-- | The IP address\/port combinations (sockets) that map to a given
-- destination socket address.
destinationPortMapping_acceleratorSocketAddresses :: Lens.Lens' DestinationPortMapping (Prelude.Maybe [SocketAddress])
destinationPortMapping_acceleratorSocketAddresses :: (Maybe [SocketAddress] -> f (Maybe [SocketAddress]))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_acceleratorSocketAddresses = (DestinationPortMapping -> Maybe [SocketAddress])
-> (DestinationPortMapping
    -> Maybe [SocketAddress] -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe [SocketAddress])
     (Maybe [SocketAddress])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe [SocketAddress]
acceleratorSocketAddresses :: Maybe [SocketAddress]
$sel:acceleratorSocketAddresses:DestinationPortMapping' :: DestinationPortMapping -> Maybe [SocketAddress]
acceleratorSocketAddresses} -> Maybe [SocketAddress]
acceleratorSocketAddresses) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe [SocketAddress]
a -> DestinationPortMapping
s {$sel:acceleratorSocketAddresses:DestinationPortMapping' :: Maybe [SocketAddress]
acceleratorSocketAddresses = Maybe [SocketAddress]
a} :: DestinationPortMapping) ((Maybe [SocketAddress] -> f (Maybe [SocketAddress]))
 -> DestinationPortMapping -> f DestinationPortMapping)
-> ((Maybe [SocketAddress] -> f (Maybe [SocketAddress]))
    -> Maybe [SocketAddress] -> f (Maybe [SocketAddress]))
-> (Maybe [SocketAddress] -> f (Maybe [SocketAddress]))
-> DestinationPortMapping
-> f DestinationPortMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SocketAddress] [SocketAddress] [SocketAddress] [SocketAddress]
-> Iso
     (Maybe [SocketAddress])
     (Maybe [SocketAddress])
     (Maybe [SocketAddress])
     (Maybe [SocketAddress])
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
  [SocketAddress] [SocketAddress] [SocketAddress] [SocketAddress]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | Indicates whether or not a port mapping destination can receive traffic.
-- The value is either ALLOW, if traffic is allowed to the destination, or
-- DENY, if traffic is not allowed to the destination.
destinationPortMapping_destinationTrafficState :: Lens.Lens' DestinationPortMapping (Prelude.Maybe CustomRoutingDestinationTrafficState)
destinationPortMapping_destinationTrafficState :: (Maybe CustomRoutingDestinationTrafficState
 -> f (Maybe CustomRoutingDestinationTrafficState))
-> DestinationPortMapping -> f DestinationPortMapping
destinationPortMapping_destinationTrafficState = (DestinationPortMapping
 -> Maybe CustomRoutingDestinationTrafficState)
-> (DestinationPortMapping
    -> Maybe CustomRoutingDestinationTrafficState
    -> DestinationPortMapping)
-> Lens
     DestinationPortMapping
     DestinationPortMapping
     (Maybe CustomRoutingDestinationTrafficState)
     (Maybe CustomRoutingDestinationTrafficState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationPortMapping' {Maybe CustomRoutingDestinationTrafficState
destinationTrafficState :: Maybe CustomRoutingDestinationTrafficState
$sel:destinationTrafficState:DestinationPortMapping' :: DestinationPortMapping
-> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState} -> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState) (\s :: DestinationPortMapping
s@DestinationPortMapping' {} Maybe CustomRoutingDestinationTrafficState
a -> DestinationPortMapping
s {$sel:destinationTrafficState:DestinationPortMapping' :: Maybe CustomRoutingDestinationTrafficState
destinationTrafficState = Maybe CustomRoutingDestinationTrafficState
a} :: DestinationPortMapping)

instance Core.FromJSON DestinationPortMapping where
  parseJSON :: Value -> Parser DestinationPortMapping
parseJSON =
    String
-> (Object -> Parser DestinationPortMapping)
-> Value
-> Parser DestinationPortMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DestinationPortMapping"
      ( \Object
x ->
          Maybe SocketAddress
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe IpAddressType
-> Maybe [SocketAddress]
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> DestinationPortMapping
DestinationPortMapping'
            (Maybe SocketAddress
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe IpAddressType
 -> Maybe [SocketAddress]
 -> Maybe Text
 -> Maybe CustomRoutingDestinationTrafficState
 -> DestinationPortMapping)
-> Parser (Maybe SocketAddress)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe IpAddressType
      -> Maybe [SocketAddress]
      -> Maybe Text
      -> Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SocketAddress)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationSocketAddress")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe IpAddressType
   -> Maybe [SocketAddress]
   -> Maybe Text
   -> Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe IpAddressType
      -> Maybe [SocketAddress]
      -> Maybe Text
      -> Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AcceleratorArn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe IpAddressType
   -> Maybe [SocketAddress]
   -> Maybe Text
   -> Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe IpAddressType
      -> Maybe [SocketAddress]
      -> Maybe Text
      -> Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndpointGroupArn")
            Parser
  (Maybe Text
   -> Maybe IpAddressType
   -> Maybe [SocketAddress]
   -> Maybe Text
   -> Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe Text)
-> Parser
     (Maybe IpAddressType
      -> Maybe [SocketAddress]
      -> Maybe Text
      -> Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndpointGroupRegion")
            Parser
  (Maybe IpAddressType
   -> Maybe [SocketAddress]
   -> Maybe Text
   -> Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe IpAddressType)
-> Parser
     (Maybe [SocketAddress]
      -> Maybe Text
      -> Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpAddressType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IpAddressType")
            Parser
  (Maybe [SocketAddress]
   -> Maybe Text
   -> Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe [SocketAddress])
-> Parser
     (Maybe Text
      -> Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [SocketAddress]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AcceleratorSocketAddresses"
                            Parser (Maybe (Maybe [SocketAddress]))
-> Maybe [SocketAddress] -> Parser (Maybe [SocketAddress])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SocketAddress]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe Text)
-> Parser
     (Maybe CustomRoutingDestinationTrafficState
      -> DestinationPortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndpointId")
            Parser
  (Maybe CustomRoutingDestinationTrafficState
   -> DestinationPortMapping)
-> Parser (Maybe CustomRoutingDestinationTrafficState)
-> Parser DestinationPortMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe CustomRoutingDestinationTrafficState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationTrafficState")
      )

instance Prelude.Hashable DestinationPortMapping

instance Prelude.NFData DestinationPortMapping