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