{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:staticIpConnectionInfo:EthernetPayload' :: Maybe StaticIpConnectionInfo
staticIpConnectionInfo =
forall a. Maybe a
Prelude.Nothing,
$sel:connectionType:EthernetPayload' :: ConnectionType
connectionType = ConnectionType
pConnectionType_
}
ethernetPayload_staticIpConnectionInfo :: Lens.Lens' EthernetPayload (Prelude.Maybe StaticIpConnectionInfo)
ethernetPayload_staticIpConnectionInfo :: Lens' EthernetPayload (Maybe StaticIpConnectionInfo)
ethernetPayload_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 :: Lens' EthernetPayload ConnectionType
ethernetPayload_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 Data.FromJSON EthernetPayload where
parseJSON :: Value -> Parser EthernetPayload
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"EthernetPayload"
( \Object
x ->
Maybe StaticIpConnectionInfo -> ConnectionType -> EthernetPayload
EthernetPayload'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StaticIpConnectionInfo")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConnectionType")
)
instance Prelude.Hashable EthernetPayload where
hashWithSalt :: Int -> EthernetPayload -> Int
hashWithSalt Int
_salt EthernetPayload' {Maybe StaticIpConnectionInfo
ConnectionType
connectionType :: ConnectionType
staticIpConnectionInfo :: Maybe StaticIpConnectionInfo
$sel:connectionType:EthernetPayload' :: EthernetPayload -> ConnectionType
$sel:staticIpConnectionInfo:EthernetPayload' :: EthernetPayload -> Maybe StaticIpConnectionInfo
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StaticIpConnectionInfo
staticIpConnectionInfo
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConnectionType
connectionType
instance Prelude.NFData EthernetPayload where
rnf :: EthernetPayload -> ()
rnf EthernetPayload' {Maybe StaticIpConnectionInfo
ConnectionType
connectionType :: ConnectionType
staticIpConnectionInfo :: Maybe StaticIpConnectionInfo
$sel:connectionType:EthernetPayload' :: EthernetPayload -> ConnectionType
$sel:staticIpConnectionInfo:EthernetPayload' :: EthernetPayload -> Maybe StaticIpConnectionInfo
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe StaticIpConnectionInfo
staticIpConnectionInfo
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ConnectionType
connectionType
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"StaticIpConnectionInfo" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StaticIpConnectionInfo
staticIpConnectionInfo,
forall a. a -> Maybe a
Prelude.Just
(Key
"ConnectionType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ConnectionType
connectionType)
]
)