{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data VirtualGatewayPortMapping = VirtualGatewayPortMapping'
{
VirtualGatewayPortMapping -> Natural
port :: Prelude.Natural,
VirtualGatewayPortMapping -> VirtualGatewayPortProtocol
protocol :: VirtualGatewayPortProtocol
}
deriving (VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool
(VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool)
-> (VirtualGatewayPortMapping -> VirtualGatewayPortMapping -> Bool)
-> Eq VirtualGatewayPortMapping
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]
(Int -> ReadS VirtualGatewayPortMapping)
-> ReadS [VirtualGatewayPortMapping]
-> ReadPrec VirtualGatewayPortMapping
-> ReadPrec [VirtualGatewayPortMapping]
-> Read 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
(Int -> VirtualGatewayPortMapping -> ShowS)
-> (VirtualGatewayPortMapping -> String)
-> ([VirtualGatewayPortMapping] -> ShowS)
-> Show VirtualGatewayPortMapping
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.
VirtualGatewayPortMapping -> Rep VirtualGatewayPortMapping x)
-> (forall x.
Rep VirtualGatewayPortMapping x -> VirtualGatewayPortMapping)
-> Generic VirtualGatewayPortMapping
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' :: Natural -> VirtualGatewayPortProtocol -> VirtualGatewayPortMapping
VirtualGatewayPortMapping'
{ $sel:port:VirtualGatewayPortMapping' :: Natural
port = Natural
pPort_,
$sel:protocol:VirtualGatewayPortMapping' :: VirtualGatewayPortProtocol
protocol = VirtualGatewayPortProtocol
pProtocol_
}
virtualGatewayPortMapping_port :: Lens.Lens' VirtualGatewayPortMapping Prelude.Natural
virtualGatewayPortMapping_port :: (Natural -> f Natural)
-> VirtualGatewayPortMapping -> f VirtualGatewayPortMapping
virtualGatewayPortMapping_port = (VirtualGatewayPortMapping -> Natural)
-> (VirtualGatewayPortMapping
-> Natural -> VirtualGatewayPortMapping)
-> Lens
VirtualGatewayPortMapping VirtualGatewayPortMapping Natural Natural
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 :: (VirtualGatewayPortProtocol -> f VirtualGatewayPortProtocol)
-> VirtualGatewayPortMapping -> f VirtualGatewayPortMapping
virtualGatewayPortMapping_protocol = (VirtualGatewayPortMapping -> VirtualGatewayPortProtocol)
-> (VirtualGatewayPortMapping
-> VirtualGatewayPortProtocol -> VirtualGatewayPortMapping)
-> Lens
VirtualGatewayPortMapping
VirtualGatewayPortMapping
VirtualGatewayPortProtocol
VirtualGatewayPortProtocol
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 Core.FromJSON VirtualGatewayPortMapping where
parseJSON :: Value -> Parser VirtualGatewayPortMapping
parseJSON =
String
-> (Object -> Parser VirtualGatewayPortMapping)
-> Value
-> Parser VirtualGatewayPortMapping
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"VirtualGatewayPortMapping"
( \Object
x ->
Natural -> VirtualGatewayPortProtocol -> VirtualGatewayPortMapping
VirtualGatewayPortMapping'
(Natural
-> VirtualGatewayPortProtocol -> VirtualGatewayPortMapping)
-> Parser Natural
-> Parser (VirtualGatewayPortProtocol -> VirtualGatewayPortMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"port")
Parser (VirtualGatewayPortProtocol -> VirtualGatewayPortMapping)
-> Parser VirtualGatewayPortProtocol
-> Parser VirtualGatewayPortMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser VirtualGatewayPortProtocol
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"protocol")
)
instance Prelude.Hashable VirtualGatewayPortMapping
instance Prelude.NFData VirtualGatewayPortMapping
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"port" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
port),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"protocol" Text -> VirtualGatewayPortProtocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= VirtualGatewayPortProtocol
protocol)
]
)