{-# 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.AppMesh.Types.VirtualGatewayPortMapping where
import Amazonka.AppMesh.Types.VirtualGatewayPortProtocol
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data VirtualGatewayPortMapping = VirtualGatewayPortMapping'
{
VirtualGatewayPortMapping -> Natural
port :: Prelude.Natural,
VirtualGatewayPortMapping -> VirtualGatewayPortProtocol
protocol :: VirtualGatewayPortProtocol
}
deriving (VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool
$c/= :: VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool
== :: VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool
$c== :: VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayPortMapping]
ReadPrec VirtualGatewayPortMapping
Int -> ReadS VirtualGatewayPortMapping
ReadS [VirtualGatewayPortMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayPortMapping]
$creadListPrec :: ReadPrec [VirtualGatewayPortMapping]
readPrec :: ReadPrec VirtualGatewayPortMapping
$creadPrec :: ReadPrec VirtualGatewayPortMapping
readList :: ReadS [VirtualGatewayPortMapping]
$creadList :: ReadS [VirtualGatewayPortMapping]
readsPrec :: Int -> ReadS VirtualGatewayPortMapping
$creadsPrec :: Int -> ReadS VirtualGatewayPortMapping
Prelude.Read, Int -> VirtualGatewayPortMapping -> ShowS
[VirtualGatewayPortMapping] -> ShowS
VirtualGatewayPortMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayPortMapping] -> ShowS
$cshowList :: [VirtualGatewayPortMapping] -> ShowS
show :: VirtualGatewayPortMapping -> String
$cshow :: VirtualGatewayPortMapping -> String
showsPrec :: Int -> VirtualGatewayPortMapping -> ShowS
$cshowsPrec :: Int -> VirtualGatewayPortMapping -> ShowS
Prelude.Show, forall x.
Rep VirtualGatewayPortMapping x -> VirtualGatewayPortMapping
forall x.
VirtualGatewayPortMapping -> Rep VirtualGatewayPortMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayPortMapping x -> VirtualGatewayPortMapping
$cfrom :: forall x.
VirtualGatewayPortMapping -> Rep VirtualGatewayPortMapping x
Prelude.Generic)
newVirtualGatewayPortMapping ::
Prelude.Natural ->
VirtualGatewayPortProtocol ->
VirtualGatewayPortMapping
newVirtualGatewayPortMapping :: Natural -> VirtualGatewayPortProtocol -> VirtualGatewayPortMapping
newVirtualGatewayPortMapping Natural
pPort_ VirtualGatewayPortProtocol
pProtocol_ =
VirtualGatewayPortMapping'
{ $sel:port:VirtualGatewayPortMapping' :: Natural
port = Natural
pPort_,
$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortProtocol
protocol = VirtualGatewayPortProtocol
pProtocol_
}
virtualGatewayPortMapping_port :: Lens.Lens' VirtualGatewayPortMapping Prelude.Natural
virtualGatewayPortMapping_port :: Lens' VirtualGatewayPortMapping Natural
virtualGatewayPortMapping_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayPortMapping' {Natural
port :: Natural
$sel:port:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> Natural
port} -> Natural
port) (\s :: VirtualGatewayPortMapping
s@VirtualGatewayPortMapping' {} Natural
a -> VirtualGatewayPortMapping
s {$sel:port:VirtualGatewayPortMapping' :: Natural
port = Natural
a} :: VirtualGatewayPortMapping)
virtualGatewayPortMapping_protocol :: Lens.Lens' VirtualGatewayPortMapping VirtualGatewayPortProtocol
virtualGatewayPortMapping_protocol :: Lens' VirtualGatewayPortMapping VirtualGatewayPortProtocol
virtualGatewayPortMapping_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayPortMapping' {VirtualGatewayPortProtocol
protocol :: VirtualGatewayPortProtocol
$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> VirtualGatewayPortProtocol
protocol} -> VirtualGatewayPortProtocol
protocol) (\s :: VirtualGatewayPortMapping
s@VirtualGatewayPortMapping' {} VirtualGatewayPortProtocol
a -> VirtualGatewayPortMapping
s {$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortProtocol
protocol = VirtualGatewayPortProtocol
a} :: VirtualGatewayPortMapping)
instance Data.FromJSON VirtualGatewayPortMapping where
parseJSON :: Value -> Parser VirtualGatewayPortMapping
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"VirtualGatewayPortMapping"
( \Object
x ->
Natural -> VirtualGatewayPortProtocol -> VirtualGatewayPortMapping
VirtualGatewayPortMapping'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"port")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"protocol")
)
instance Prelude.Hashable VirtualGatewayPortMapping where
hashWithSalt :: Int -> VirtualGatewayPortMapping -> Int
hashWithSalt Int
_salt VirtualGatewayPortMapping' {Natural
VirtualGatewayPortProtocol
protocol :: VirtualGatewayPortProtocol
port :: Natural
$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> VirtualGatewayPortProtocol
$sel:port:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
port
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VirtualGatewayPortProtocol
protocol
instance Prelude.NFData VirtualGatewayPortMapping where
rnf :: VirtualGatewayPortMapping -> ()
rnf VirtualGatewayPortMapping' {Natural
VirtualGatewayPortProtocol
protocol :: VirtualGatewayPortProtocol
port :: Natural
$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> VirtualGatewayPortProtocol
$sel:port:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Natural
port seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VirtualGatewayPortProtocol
protocol
instance Data.ToJSON VirtualGatewayPortMapping where
toJSON :: VirtualGatewayPortMapping -> Value
toJSON VirtualGatewayPortMapping' {Natural
VirtualGatewayPortProtocol
protocol :: VirtualGatewayPortProtocol
port :: Natural
$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> VirtualGatewayPortProtocol
$sel:port:VirtualGatewayPortMapping' :: VirtualGatewayPortMapping -> Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"port" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
port),
forall a. a -> Maybe a
Prelude.Just (Key
"protocol" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= VirtualGatewayPortProtocol
protocol)
]
)