{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GlobalAccelerator.Types.CustomRoutingDestinationTrafficState
import Amazonka.GlobalAccelerator.Types.CustomRoutingProtocol
import Amazonka.GlobalAccelerator.Types.SocketAddress
import qualified Amazonka.Prelude as Prelude
data PortMapping = PortMapping'
{
PortMapping -> Maybe Natural
acceleratorPort :: Prelude.Maybe Prelude.Natural,
PortMapping -> Maybe SocketAddress
destinationSocketAddress :: Prelude.Maybe SocketAddress,
PortMapping -> Maybe CustomRoutingDestinationTrafficState
destinationTrafficState :: Prelude.Maybe CustomRoutingDestinationTrafficState,
PortMapping -> Maybe Text
endpointGroupArn :: Prelude.Maybe Prelude.Text,
PortMapping -> Maybe Text
endpointId :: Prelude.Maybe Prelude.Text,
PortMapping -> Maybe (NonEmpty CustomRoutingProtocol)
protocols :: Prelude.Maybe (Prelude.NonEmpty CustomRoutingProtocol)
}
deriving (PortMapping -> PortMapping -> Bool
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]
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
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. 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'
{ $sel:acceleratorPort:PortMapping' :: Maybe Natural
acceleratorPort = forall a. Maybe a
Prelude.Nothing,
$sel:destinationSocketAddress:PortMapping' :: Maybe SocketAddress
destinationSocketAddress = forall a. Maybe a
Prelude.Nothing,
$sel:destinationTrafficState:PortMapping' :: Maybe CustomRoutingDestinationTrafficState
destinationTrafficState = forall a. Maybe a
Prelude.Nothing,
$sel:endpointGroupArn:PortMapping' :: Maybe Text
endpointGroupArn = forall a. Maybe a
Prelude.Nothing,
$sel:endpointId:PortMapping' :: Maybe Text
endpointId = forall a. Maybe a
Prelude.Nothing,
$sel:protocols:PortMapping' :: Maybe (NonEmpty CustomRoutingProtocol)
protocols = forall a. Maybe a
Prelude.Nothing
}
portMapping_acceleratorPort :: Lens.Lens' PortMapping (Prelude.Maybe Prelude.Natural)
portMapping_acceleratorPort :: Lens' PortMapping (Maybe Natural)
portMapping_acceleratorPort = 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)
portMapping_destinationSocketAddress :: Lens.Lens' PortMapping (Prelude.Maybe SocketAddress)
portMapping_destinationSocketAddress :: Lens' PortMapping (Maybe SocketAddress)
portMapping_destinationSocketAddress = 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_destinationTrafficState :: Lens.Lens' PortMapping (Prelude.Maybe CustomRoutingDestinationTrafficState)
portMapping_destinationTrafficState :: Lens' PortMapping (Maybe CustomRoutingDestinationTrafficState)
portMapping_destinationTrafficState = 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_endpointGroupArn :: Lens.Lens' PortMapping (Prelude.Maybe Prelude.Text)
portMapping_endpointGroupArn :: Lens' PortMapping (Maybe Text)
portMapping_endpointGroupArn = 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 :: Lens' PortMapping (Maybe Text)
portMapping_endpointId = 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_protocols :: Lens.Lens' PortMapping (Prelude.Maybe (Prelude.NonEmpty CustomRoutingProtocol))
portMapping_protocols :: Lens' PortMapping (Maybe (NonEmpty CustomRoutingProtocol))
portMapping_protocols = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON PortMapping where
parseJSON :: Value -> Parser PortMapping
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PortMapping"
( \Object
x ->
Maybe Natural
-> Maybe SocketAddress
-> Maybe CustomRoutingDestinationTrafficState
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty CustomRoutingProtocol)
-> PortMapping
PortMapping'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AcceleratorPort")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DestinationSocketAddress")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DestinationTrafficState")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EndpointGroupArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EndpointId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Protocols")
)
instance Prelude.Hashable PortMapping where
hashWithSalt :: Int -> PortMapping -> Int
hashWithSalt Int
_salt PortMapping' {Maybe Natural
Maybe (NonEmpty CustomRoutingProtocol)
Maybe Text
Maybe CustomRoutingDestinationTrafficState
Maybe SocketAddress
protocols :: Maybe (NonEmpty CustomRoutingProtocol)
endpointId :: Maybe Text
endpointGroupArn :: Maybe Text
destinationTrafficState :: Maybe CustomRoutingDestinationTrafficState
destinationSocketAddress :: Maybe SocketAddress
acceleratorPort :: Maybe Natural
$sel:protocols:PortMapping' :: PortMapping -> Maybe (NonEmpty CustomRoutingProtocol)
$sel:endpointId:PortMapping' :: PortMapping -> Maybe Text
$sel:endpointGroupArn:PortMapping' :: PortMapping -> Maybe Text
$sel:destinationTrafficState:PortMapping' :: PortMapping -> Maybe CustomRoutingDestinationTrafficState
$sel:destinationSocketAddress:PortMapping' :: PortMapping -> Maybe SocketAddress
$sel:acceleratorPort:PortMapping' :: PortMapping -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
acceleratorPort
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SocketAddress
destinationSocketAddress
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomRoutingDestinationTrafficState
destinationTrafficState
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpointGroupArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpointId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty CustomRoutingProtocol)
protocols
instance Prelude.NFData PortMapping where
rnf :: PortMapping -> ()
rnf PortMapping' {Maybe Natural
Maybe (NonEmpty CustomRoutingProtocol)
Maybe Text
Maybe CustomRoutingDestinationTrafficState
Maybe SocketAddress
protocols :: Maybe (NonEmpty CustomRoutingProtocol)
endpointId :: Maybe Text
endpointGroupArn :: Maybe Text
destinationTrafficState :: Maybe CustomRoutingDestinationTrafficState
destinationSocketAddress :: Maybe SocketAddress
acceleratorPort :: Maybe Natural
$sel:protocols:PortMapping' :: PortMapping -> Maybe (NonEmpty CustomRoutingProtocol)
$sel:endpointId:PortMapping' :: PortMapping -> Maybe Text
$sel:endpointGroupArn:PortMapping' :: PortMapping -> Maybe Text
$sel:destinationTrafficState:PortMapping' :: PortMapping -> Maybe CustomRoutingDestinationTrafficState
$sel:destinationSocketAddress:PortMapping' :: PortMapping -> Maybe SocketAddress
$sel:acceleratorPort:PortMapping' :: PortMapping -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
acceleratorPort
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SocketAddress
destinationSocketAddress
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomRoutingDestinationTrafficState
destinationTrafficState
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpointGroupArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpointId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty CustomRoutingProtocol)
protocols