{-# 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.PortOverride where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PortOverride = PortOverride'
{
PortOverride -> Maybe Natural
endpointPort :: Prelude.Maybe Prelude.Natural,
PortOverride -> Maybe Natural
listenerPort :: Prelude.Maybe Prelude.Natural
}
deriving (PortOverride -> PortOverride -> Bool
(PortOverride -> PortOverride -> Bool)
-> (PortOverride -> PortOverride -> Bool) -> Eq PortOverride
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortOverride -> PortOverride -> Bool
$c/= :: PortOverride -> PortOverride -> Bool
== :: PortOverride -> PortOverride -> Bool
$c== :: PortOverride -> PortOverride -> Bool
Prelude.Eq, ReadPrec [PortOverride]
ReadPrec PortOverride
Int -> ReadS PortOverride
ReadS [PortOverride]
(Int -> ReadS PortOverride)
-> ReadS [PortOverride]
-> ReadPrec PortOverride
-> ReadPrec [PortOverride]
-> Read PortOverride
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PortOverride]
$creadListPrec :: ReadPrec [PortOverride]
readPrec :: ReadPrec PortOverride
$creadPrec :: ReadPrec PortOverride
readList :: ReadS [PortOverride]
$creadList :: ReadS [PortOverride]
readsPrec :: Int -> ReadS PortOverride
$creadsPrec :: Int -> ReadS PortOverride
Prelude.Read, Int -> PortOverride -> ShowS
[PortOverride] -> ShowS
PortOverride -> String
(Int -> PortOverride -> ShowS)
-> (PortOverride -> String)
-> ([PortOverride] -> ShowS)
-> Show PortOverride
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortOverride] -> ShowS
$cshowList :: [PortOverride] -> ShowS
show :: PortOverride -> String
$cshow :: PortOverride -> String
showsPrec :: Int -> PortOverride -> ShowS
$cshowsPrec :: Int -> PortOverride -> ShowS
Prelude.Show, (forall x. PortOverride -> Rep PortOverride x)
-> (forall x. Rep PortOverride x -> PortOverride)
-> Generic PortOverride
forall x. Rep PortOverride x -> PortOverride
forall x. PortOverride -> Rep PortOverride x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortOverride x -> PortOverride
$cfrom :: forall x. PortOverride -> Rep PortOverride x
Prelude.Generic)
newPortOverride ::
PortOverride
newPortOverride :: PortOverride
newPortOverride =
PortOverride' :: Maybe Natural -> Maybe Natural -> PortOverride
PortOverride'
{ $sel:endpointPort:PortOverride' :: Maybe Natural
endpointPort = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:listenerPort:PortOverride' :: Maybe Natural
listenerPort = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
portOverride_endpointPort :: Lens.Lens' PortOverride (Prelude.Maybe Prelude.Natural)
portOverride_endpointPort :: (Maybe Natural -> f (Maybe Natural))
-> PortOverride -> f PortOverride
portOverride_endpointPort = (PortOverride -> Maybe Natural)
-> (PortOverride -> Maybe Natural -> PortOverride)
-> Lens PortOverride PortOverride (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortOverride' {Maybe Natural
endpointPort :: Maybe Natural
$sel:endpointPort:PortOverride' :: PortOverride -> Maybe Natural
endpointPort} -> Maybe Natural
endpointPort) (\s :: PortOverride
s@PortOverride' {} Maybe Natural
a -> PortOverride
s {$sel:endpointPort:PortOverride' :: Maybe Natural
endpointPort = Maybe Natural
a} :: PortOverride)
portOverride_listenerPort :: Lens.Lens' PortOverride (Prelude.Maybe Prelude.Natural)
portOverride_listenerPort :: (Maybe Natural -> f (Maybe Natural))
-> PortOverride -> f PortOverride
portOverride_listenerPort = (PortOverride -> Maybe Natural)
-> (PortOverride -> Maybe Natural -> PortOverride)
-> Lens PortOverride PortOverride (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortOverride' {Maybe Natural
listenerPort :: Maybe Natural
$sel:listenerPort:PortOverride' :: PortOverride -> Maybe Natural
listenerPort} -> Maybe Natural
listenerPort) (\s :: PortOverride
s@PortOverride' {} Maybe Natural
a -> PortOverride
s {$sel:listenerPort:PortOverride' :: Maybe Natural
listenerPort = Maybe Natural
a} :: PortOverride)
instance Core.FromJSON PortOverride where
parseJSON :: Value -> Parser PortOverride
parseJSON =
String
-> (Object -> Parser PortOverride) -> Value -> Parser PortOverride
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PortOverride"
( \Object
x ->
Maybe Natural -> Maybe Natural -> PortOverride
PortOverride'
(Maybe Natural -> Maybe Natural -> PortOverride)
-> Parser (Maybe Natural) -> Parser (Maybe Natural -> PortOverride)
forall (f :: * -> *) a b. Functor 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
"EndpointPort")
Parser (Maybe Natural -> PortOverride)
-> Parser (Maybe Natural) -> Parser PortOverride
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
"ListenerPort")
)
instance Prelude.Hashable PortOverride
instance Prelude.NFData PortOverride
instance Core.ToJSON PortOverride where
toJSON :: PortOverride -> Value
toJSON PortOverride' {Maybe Natural
listenerPort :: Maybe Natural
endpointPort :: Maybe Natural
$sel:listenerPort:PortOverride' :: PortOverride -> Maybe Natural
$sel:endpointPort:PortOverride' :: PortOverride -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EndpointPort" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
endpointPort,
(Text
"ListenerPort" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
listenerPort
]
)