{-# 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 #-}
module Amazonka.GlobalAccelerator.Types.PortMapping where
import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.Types.CustomRoutingDestinationTrafficState
import Amazonka.GlobalAccelerator.Types.CustomRoutingProtocol
import Amazonka.GlobalAccelerator.Types.SocketAddress
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PortMapping = PortMapping'
{
PortMapping -> Maybe SocketAddress
destinationSocketAddress :: Prelude.Maybe SocketAddress,
PortMapping -> Maybe (NonEmpty CustomRoutingProtocol)
protocols :: Prelude.Maybe (Prelude.NonEmpty CustomRoutingProtocol),
PortMapping -> Maybe Text
endpointGroupArn :: Prelude.Maybe Prelude.Text,
PortMapping -> Maybe Text
endpointId :: Prelude.Maybe Prelude.Text,
PortMapping -> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState :: Prelude.Maybe CustomRoutingDestinationTrafficState,
PortMapping -> Maybe Natural
acceleratorPort :: Prelude.Maybe Prelude.Natural
}
deriving (PortMapping -> PortMapping -> Bool
(PortMapping -> PortMapping -> Bool)
-> (PortMapping -> PortMapping -> Bool) -> Eq PortMapping
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortMapping -> PortMapping -> Bool
$c/= :: PortMapping -> PortMapping -> Bool
== :: PortMapping -> PortMapping -> Bool
$c== :: PortMapping -> PortMapping -> Bool
Prelude.Eq, ReadPrec [PortMapping]
ReadPrec PortMapping
Int -> ReadS PortMapping
ReadS [PortMapping]
(Int -> ReadS PortMapping)
-> ReadS [PortMapping]
-> ReadPrec PortMapping
-> ReadPrec [PortMapping]
-> Read PortMapping
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PortMapping]
$creadListPrec :: ReadPrec [PortMapping]
readPrec :: ReadPrec PortMapping
$creadPrec :: ReadPrec PortMapping
readList :: ReadS [PortMapping]
$creadList :: ReadS [PortMapping]
readsPrec :: Int -> ReadS PortMapping
$creadsPrec :: Int -> ReadS PortMapping
Prelude.Read, Int -> PortMapping -> ShowS
[PortMapping] -> ShowS
PortMapping -> String
(Int -> PortMapping -> ShowS)
-> (PortMapping -> String)
-> ([PortMapping] -> ShowS)
-> Show PortMapping
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortMapping] -> ShowS
$cshowList :: [PortMapping] -> ShowS
show :: PortMapping -> String
$cshow :: PortMapping -> String
showsPrec :: Int -> PortMapping -> ShowS
$cshowsPrec :: Int -> PortMapping -> ShowS
Prelude.Show, (forall x. PortMapping -> Rep PortMapping x)
-> (forall x. Rep PortMapping x -> PortMapping)
-> Generic PortMapping
forall x. Rep PortMapping x -> PortMapping
forall x. PortMapping -> Rep PortMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortMapping x -> PortMapping
$cfrom :: forall x. PortMapping -> Rep PortMapping x
Prelude.Generic)
newPortMapping ::
PortMapping
newPortMapping :: PortMapping
newPortMapping =
PortMapping' :: Maybe SocketAddress
-> Maybe (NonEmpty CustomRoutingProtocol)
-> Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping
PortMapping'
{ $sel:destinationSocketAddress:PortMapping' :: Maybe SocketAddress
destinationSocketAddress =
Maybe SocketAddress
forall a. Maybe a
Prelude.Nothing,
$sel:protocols:PortMapping' :: Maybe (NonEmpty CustomRoutingProtocol)
protocols = Maybe (NonEmpty CustomRoutingProtocol)
forall a. Maybe a
Prelude.Nothing,
$sel:endpointGroupArn:PortMapping' :: Maybe Text
endpointGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:endpointId:PortMapping' :: Maybe Text
endpointId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:destinationTrafficState:PortMapping' :: Maybe CustomRoutingDestinationTrafficState
destinationTrafficState = Maybe CustomRoutingDestinationTrafficState
forall a. Maybe a
Prelude.Nothing,
$sel:acceleratorPort:PortMapping' :: Maybe Natural
acceleratorPort = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
portMapping_destinationSocketAddress :: Lens.Lens' PortMapping (Prelude.Maybe SocketAddress)
portMapping_destinationSocketAddress :: (Maybe SocketAddress -> f (Maybe SocketAddress))
-> PortMapping -> f PortMapping
portMapping_destinationSocketAddress = (PortMapping -> Maybe SocketAddress)
-> (PortMapping -> Maybe SocketAddress -> PortMapping)
-> Lens
PortMapping PortMapping (Maybe SocketAddress) (Maybe SocketAddress)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe SocketAddress
destinationSocketAddress :: Maybe SocketAddress
$sel:destinationSocketAddress:PortMapping' :: PortMapping -> Maybe SocketAddress
destinationSocketAddress} -> Maybe SocketAddress
destinationSocketAddress) (\s :: PortMapping
s@PortMapping' {} Maybe SocketAddress
a -> PortMapping
s {$sel:destinationSocketAddress:PortMapping' :: Maybe SocketAddress
destinationSocketAddress = Maybe SocketAddress
a} :: PortMapping)
portMapping_protocols :: Lens.Lens' PortMapping (Prelude.Maybe (Prelude.NonEmpty CustomRoutingProtocol))
portMapping_protocols :: (Maybe (NonEmpty CustomRoutingProtocol)
-> f (Maybe (NonEmpty CustomRoutingProtocol)))
-> PortMapping -> f PortMapping
portMapping_protocols = (PortMapping -> Maybe (NonEmpty CustomRoutingProtocol))
-> (PortMapping
-> Maybe (NonEmpty CustomRoutingProtocol) -> PortMapping)
-> Lens
PortMapping
PortMapping
(Maybe (NonEmpty CustomRoutingProtocol))
(Maybe (NonEmpty CustomRoutingProtocol))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe (NonEmpty CustomRoutingProtocol)
protocols :: Maybe (NonEmpty CustomRoutingProtocol)
$sel:protocols:PortMapping' :: PortMapping -> Maybe (NonEmpty CustomRoutingProtocol)
protocols} -> Maybe (NonEmpty CustomRoutingProtocol)
protocols) (\s :: PortMapping
s@PortMapping' {} Maybe (NonEmpty CustomRoutingProtocol)
a -> PortMapping
s {$sel:protocols:PortMapping' :: Maybe (NonEmpty CustomRoutingProtocol)
protocols = Maybe (NonEmpty CustomRoutingProtocol)
a} :: PortMapping) ((Maybe (NonEmpty CustomRoutingProtocol)
-> f (Maybe (NonEmpty CustomRoutingProtocol)))
-> PortMapping -> f PortMapping)
-> ((Maybe (NonEmpty CustomRoutingProtocol)
-> f (Maybe (NonEmpty CustomRoutingProtocol)))
-> Maybe (NonEmpty CustomRoutingProtocol)
-> f (Maybe (NonEmpty CustomRoutingProtocol)))
-> (Maybe (NonEmpty CustomRoutingProtocol)
-> f (Maybe (NonEmpty CustomRoutingProtocol)))
-> PortMapping
-> f PortMapping
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty CustomRoutingProtocol)
(NonEmpty CustomRoutingProtocol)
(NonEmpty CustomRoutingProtocol)
(NonEmpty CustomRoutingProtocol)
-> Iso
(Maybe (NonEmpty CustomRoutingProtocol))
(Maybe (NonEmpty CustomRoutingProtocol))
(Maybe (NonEmpty CustomRoutingProtocol))
(Maybe (NonEmpty CustomRoutingProtocol))
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
(NonEmpty CustomRoutingProtocol)
(NonEmpty CustomRoutingProtocol)
(NonEmpty CustomRoutingProtocol)
(NonEmpty CustomRoutingProtocol)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
portMapping_endpointGroupArn :: Lens.Lens' PortMapping (Prelude.Maybe Prelude.Text)
portMapping_endpointGroupArn :: (Maybe Text -> f (Maybe Text)) -> PortMapping -> f PortMapping
portMapping_endpointGroupArn = (PortMapping -> Maybe Text)
-> (PortMapping -> Maybe Text -> PortMapping)
-> Lens PortMapping PortMapping (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe Text
endpointGroupArn :: Maybe Text
$sel:endpointGroupArn:PortMapping' :: PortMapping -> Maybe Text
endpointGroupArn} -> Maybe Text
endpointGroupArn) (\s :: PortMapping
s@PortMapping' {} Maybe Text
a -> PortMapping
s {$sel:endpointGroupArn:PortMapping' :: Maybe Text
endpointGroupArn = Maybe Text
a} :: PortMapping)
portMapping_endpointId :: Lens.Lens' PortMapping (Prelude.Maybe Prelude.Text)
portMapping_endpointId :: (Maybe Text -> f (Maybe Text)) -> PortMapping -> f PortMapping
portMapping_endpointId = (PortMapping -> Maybe Text)
-> (PortMapping -> Maybe Text -> PortMapping)
-> Lens PortMapping PortMapping (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe Text
endpointId :: Maybe Text
$sel:endpointId:PortMapping' :: PortMapping -> Maybe Text
endpointId} -> Maybe Text
endpointId) (\s :: PortMapping
s@PortMapping' {} Maybe Text
a -> PortMapping
s {$sel:endpointId:PortMapping' :: Maybe Text
endpointId = Maybe Text
a} :: PortMapping)
portMapping_destinationTrafficState :: Lens.Lens' PortMapping (Prelude.Maybe CustomRoutingDestinationTrafficState)
portMapping_destinationTrafficState :: (Maybe CustomRoutingDestinationTrafficState
-> f (Maybe CustomRoutingDestinationTrafficState))
-> PortMapping -> f PortMapping
portMapping_destinationTrafficState = (PortMapping -> Maybe CustomRoutingDestinationTrafficState)
-> (PortMapping
-> Maybe CustomRoutingDestinationTrafficState -> PortMapping)
-> Lens
PortMapping
PortMapping
(Maybe CustomRoutingDestinationTrafficState)
(Maybe CustomRoutingDestinationTrafficState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe CustomRoutingDestinationTrafficState
destinationTrafficState :: Maybe CustomRoutingDestinationTrafficState
$sel:destinationTrafficState:PortMapping' :: PortMapping -> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState} -> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState) (\s :: PortMapping
s@PortMapping' {} Maybe CustomRoutingDestinationTrafficState
a -> PortMapping
s {$sel:destinationTrafficState:PortMapping' :: Maybe CustomRoutingDestinationTrafficState
destinationTrafficState = Maybe CustomRoutingDestinationTrafficState
a} :: PortMapping)
portMapping_acceleratorPort :: Lens.Lens' PortMapping (Prelude.Maybe Prelude.Natural)
portMapping_acceleratorPort :: (Maybe Natural -> f (Maybe Natural))
-> PortMapping -> f PortMapping
portMapping_acceleratorPort = (PortMapping -> Maybe Natural)
-> (PortMapping -> Maybe Natural -> PortMapping)
-> Lens PortMapping PortMapping (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe Natural
acceleratorPort :: Maybe Natural
$sel:acceleratorPort:PortMapping' :: PortMapping -> Maybe Natural
acceleratorPort} -> Maybe Natural
acceleratorPort) (\s :: PortMapping
s@PortMapping' {} Maybe Natural
a -> PortMapping
s {$sel:acceleratorPort:PortMapping' :: Maybe Natural
acceleratorPort = Maybe Natural
a} :: PortMapping)
instance Core.FromJSON PortMapping where
parseJSON :: Value -> Parser PortMapping
parseJSON =
String
-> (Object -> Parser PortMapping) -> Value -> Parser PortMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PortMapping"
( \Object
x ->
Maybe SocketAddress
-> Maybe (NonEmpty CustomRoutingProtocol)
-> Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping
PortMapping'
(Maybe SocketAddress
-> Maybe (NonEmpty CustomRoutingProtocol)
-> Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
-> Parser (Maybe SocketAddress)
-> Parser
(Maybe (NonEmpty CustomRoutingProtocol)
-> Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
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 (NonEmpty CustomRoutingProtocol)
-> Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
-> Parser (Maybe (NonEmpty CustomRoutingProtocol))
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty CustomRoutingProtocol))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Protocols")
Parser
(Maybe Text
-> Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
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 CustomRoutingDestinationTrafficState
-> Maybe Natural
-> PortMapping)
-> Parser (Maybe Text)
-> Parser
(Maybe CustomRoutingDestinationTrafficState
-> Maybe Natural -> PortMapping)
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
-> Maybe Natural -> PortMapping)
-> Parser (Maybe CustomRoutingDestinationTrafficState)
-> Parser (Maybe Natural -> PortMapping)
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")
Parser (Maybe Natural -> PortMapping)
-> Parser (Maybe Natural) -> Parser PortMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AcceleratorPort")
)
instance Prelude.Hashable PortMapping
instance Prelude.NFData PortMapping