{-# 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.RobOMaker.Types.PortMapping where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PortMapping = PortMapping'
{
PortMapping -> Maybe Bool
enableOnPublicIp :: Prelude.Maybe Prelude.Bool,
PortMapping -> Natural
jobPort :: Prelude.Natural,
PortMapping -> Natural
applicationPort :: 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 ::
Prelude.Natural ->
Prelude.Natural ->
PortMapping
newPortMapping :: Natural -> Natural -> PortMapping
newPortMapping Natural
pJobPort_ Natural
pApplicationPort_ =
PortMapping' :: Maybe Bool -> Natural -> Natural -> PortMapping
PortMapping'
{ $sel:enableOnPublicIp:PortMapping' :: Maybe Bool
enableOnPublicIp = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:jobPort:PortMapping' :: Natural
jobPort = Natural
pJobPort_,
$sel:applicationPort:PortMapping' :: Natural
applicationPort = Natural
pApplicationPort_
}
portMapping_enableOnPublicIp :: Lens.Lens' PortMapping (Prelude.Maybe Prelude.Bool)
portMapping_enableOnPublicIp :: (Maybe Bool -> f (Maybe Bool)) -> PortMapping -> f PortMapping
portMapping_enableOnPublicIp = (PortMapping -> Maybe Bool)
-> (PortMapping -> Maybe Bool -> PortMapping)
-> Lens PortMapping PortMapping (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Maybe Bool
enableOnPublicIp :: Maybe Bool
$sel:enableOnPublicIp:PortMapping' :: PortMapping -> Maybe Bool
enableOnPublicIp} -> Maybe Bool
enableOnPublicIp) (\s :: PortMapping
s@PortMapping' {} Maybe Bool
a -> PortMapping
s {$sel:enableOnPublicIp:PortMapping' :: Maybe Bool
enableOnPublicIp = Maybe Bool
a} :: PortMapping)
portMapping_jobPort :: Lens.Lens' PortMapping Prelude.Natural
portMapping_jobPort :: (Natural -> f Natural) -> PortMapping -> f PortMapping
portMapping_jobPort = (PortMapping -> Natural)
-> (PortMapping -> Natural -> PortMapping)
-> Lens PortMapping PortMapping Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Natural
jobPort :: Natural
$sel:jobPort:PortMapping' :: PortMapping -> Natural
jobPort} -> Natural
jobPort) (\s :: PortMapping
s@PortMapping' {} Natural
a -> PortMapping
s {$sel:jobPort:PortMapping' :: Natural
jobPort = Natural
a} :: PortMapping)
portMapping_applicationPort :: Lens.Lens' PortMapping Prelude.Natural
portMapping_applicationPort :: (Natural -> f Natural) -> PortMapping -> f PortMapping
portMapping_applicationPort = (PortMapping -> Natural)
-> (PortMapping -> Natural -> PortMapping)
-> Lens PortMapping PortMapping Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortMapping' {Natural
applicationPort :: Natural
$sel:applicationPort:PortMapping' :: PortMapping -> Natural
applicationPort} -> Natural
applicationPort) (\s :: PortMapping
s@PortMapping' {} Natural
a -> PortMapping
s {$sel:applicationPort:PortMapping' :: Natural
applicationPort = 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 Bool -> Natural -> Natural -> PortMapping
PortMapping'
(Maybe Bool -> Natural -> Natural -> PortMapping)
-> Parser (Maybe Bool)
-> Parser (Natural -> Natural -> PortMapping)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"enableOnPublicIp")
Parser (Natural -> Natural -> PortMapping)
-> Parser Natural -> Parser (Natural -> PortMapping)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"jobPort")
Parser (Natural -> PortMapping)
-> Parser Natural -> Parser PortMapping
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"applicationPort")
)
instance Prelude.Hashable PortMapping
instance Prelude.NFData PortMapping
instance Core.ToJSON PortMapping where
toJSON :: PortMapping -> Value
toJSON PortMapping' {Natural
Maybe Bool
applicationPort :: Natural
jobPort :: Natural
enableOnPublicIp :: Maybe Bool
$sel:applicationPort:PortMapping' :: PortMapping -> Natural
$sel:jobPort:PortMapping' :: PortMapping -> Natural
$sel:enableOnPublicIp:PortMapping' :: PortMapping -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"enableOnPublicIp" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableOnPublicIp,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobPort" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
jobPort),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"applicationPort" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
applicationPort)
]
)