{-# 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.PortForwardingConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.PortMapping
data PortForwardingConfig = PortForwardingConfig'
{
PortForwardingConfig -> Maybe [PortMapping]
portMappings :: Prelude.Maybe [PortMapping]
}
deriving (PortForwardingConfig -> PortForwardingConfig -> Bool
(PortForwardingConfig -> PortForwardingConfig -> Bool)
-> (PortForwardingConfig -> PortForwardingConfig -> Bool)
-> Eq PortForwardingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortForwardingConfig -> PortForwardingConfig -> Bool
$c/= :: PortForwardingConfig -> PortForwardingConfig -> Bool
== :: PortForwardingConfig -> PortForwardingConfig -> Bool
$c== :: PortForwardingConfig -> PortForwardingConfig -> Bool
Prelude.Eq, ReadPrec [PortForwardingConfig]
ReadPrec PortForwardingConfig
Int -> ReadS PortForwardingConfig
ReadS [PortForwardingConfig]
(Int -> ReadS PortForwardingConfig)
-> ReadS [PortForwardingConfig]
-> ReadPrec PortForwardingConfig
-> ReadPrec [PortForwardingConfig]
-> Read PortForwardingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PortForwardingConfig]
$creadListPrec :: ReadPrec [PortForwardingConfig]
readPrec :: ReadPrec PortForwardingConfig
$creadPrec :: ReadPrec PortForwardingConfig
readList :: ReadS [PortForwardingConfig]
$creadList :: ReadS [PortForwardingConfig]
readsPrec :: Int -> ReadS PortForwardingConfig
$creadsPrec :: Int -> ReadS PortForwardingConfig
Prelude.Read, Int -> PortForwardingConfig -> ShowS
[PortForwardingConfig] -> ShowS
PortForwardingConfig -> String
(Int -> PortForwardingConfig -> ShowS)
-> (PortForwardingConfig -> String)
-> ([PortForwardingConfig] -> ShowS)
-> Show PortForwardingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortForwardingConfig] -> ShowS
$cshowList :: [PortForwardingConfig] -> ShowS
show :: PortForwardingConfig -> String
$cshow :: PortForwardingConfig -> String
showsPrec :: Int -> PortForwardingConfig -> ShowS
$cshowsPrec :: Int -> PortForwardingConfig -> ShowS
Prelude.Show, (forall x. PortForwardingConfig -> Rep PortForwardingConfig x)
-> (forall x. Rep PortForwardingConfig x -> PortForwardingConfig)
-> Generic PortForwardingConfig
forall x. Rep PortForwardingConfig x -> PortForwardingConfig
forall x. PortForwardingConfig -> Rep PortForwardingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortForwardingConfig x -> PortForwardingConfig
$cfrom :: forall x. PortForwardingConfig -> Rep PortForwardingConfig x
Prelude.Generic)
newPortForwardingConfig ::
PortForwardingConfig
newPortForwardingConfig :: PortForwardingConfig
newPortForwardingConfig =
PortForwardingConfig' :: Maybe [PortMapping] -> PortForwardingConfig
PortForwardingConfig'
{ $sel:portMappings:PortForwardingConfig' :: Maybe [PortMapping]
portMappings =
Maybe [PortMapping]
forall a. Maybe a
Prelude.Nothing
}
portForwardingConfig_portMappings :: Lens.Lens' PortForwardingConfig (Prelude.Maybe [PortMapping])
portForwardingConfig_portMappings :: (Maybe [PortMapping] -> f (Maybe [PortMapping]))
-> PortForwardingConfig -> f PortForwardingConfig
portForwardingConfig_portMappings = (PortForwardingConfig -> Maybe [PortMapping])
-> (PortForwardingConfig
-> Maybe [PortMapping] -> PortForwardingConfig)
-> Lens
PortForwardingConfig
PortForwardingConfig
(Maybe [PortMapping])
(Maybe [PortMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortForwardingConfig' {Maybe [PortMapping]
portMappings :: Maybe [PortMapping]
$sel:portMappings:PortForwardingConfig' :: PortForwardingConfig -> Maybe [PortMapping]
portMappings} -> Maybe [PortMapping]
portMappings) (\s :: PortForwardingConfig
s@PortForwardingConfig' {} Maybe [PortMapping]
a -> PortForwardingConfig
s {$sel:portMappings:PortForwardingConfig' :: Maybe [PortMapping]
portMappings = Maybe [PortMapping]
a} :: PortForwardingConfig) ((Maybe [PortMapping] -> f (Maybe [PortMapping]))
-> PortForwardingConfig -> f PortForwardingConfig)
-> ((Maybe [PortMapping] -> f (Maybe [PortMapping]))
-> Maybe [PortMapping] -> f (Maybe [PortMapping]))
-> (Maybe [PortMapping] -> f (Maybe [PortMapping]))
-> PortForwardingConfig
-> f PortForwardingConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PortMapping] [PortMapping] [PortMapping] [PortMapping]
-> Iso
(Maybe [PortMapping])
(Maybe [PortMapping])
(Maybe [PortMapping])
(Maybe [PortMapping])
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 AnIso [PortMapping] [PortMapping] [PortMapping] [PortMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PortForwardingConfig where
parseJSON :: Value -> Parser PortForwardingConfig
parseJSON =
String
-> (Object -> Parser PortForwardingConfig)
-> Value
-> Parser PortForwardingConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PortForwardingConfig"
( \Object
x ->
Maybe [PortMapping] -> PortForwardingConfig
PortForwardingConfig'
(Maybe [PortMapping] -> PortForwardingConfig)
-> Parser (Maybe [PortMapping]) -> Parser PortForwardingConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [PortMapping]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"portMappings" Parser (Maybe (Maybe [PortMapping]))
-> Maybe [PortMapping] -> Parser (Maybe [PortMapping])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PortMapping]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PortForwardingConfig
instance Prelude.NFData PortForwardingConfig
instance Core.ToJSON PortForwardingConfig where
toJSON :: PortForwardingConfig -> Value
toJSON PortForwardingConfig' {Maybe [PortMapping]
portMappings :: Maybe [PortMapping]
$sel:portMappings:PortForwardingConfig' :: PortForwardingConfig -> Maybe [PortMapping]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"portMappings" Text -> [PortMapping] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PortMapping] -> Pair) -> Maybe [PortMapping] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PortMapping]
portMappings]
)