{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Panorama.Types.EthernetStatus
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Panorama.Types.EthernetStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types.NetworkConnectionStatus
import qualified Amazonka.Prelude as Prelude

-- | A device\'s Ethernet status.
--
-- /See:/ 'newEthernetStatus' smart constructor.
data EthernetStatus = EthernetStatus'
  { -- | The device\'s IP address.
    EthernetStatus -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | The device\'s connection status.
    EthernetStatus -> Maybe NetworkConnectionStatus
connectionStatus :: Prelude.Maybe NetworkConnectionStatus,
    -- | The device\'s physical address.
    EthernetStatus -> Maybe Text
hwAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (EthernetStatus -> EthernetStatus -> Bool
(EthernetStatus -> EthernetStatus -> Bool)
-> (EthernetStatus -> EthernetStatus -> Bool) -> Eq EthernetStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EthernetStatus -> EthernetStatus -> Bool
$c/= :: EthernetStatus -> EthernetStatus -> Bool
== :: EthernetStatus -> EthernetStatus -> Bool
$c== :: EthernetStatus -> EthernetStatus -> Bool
Prelude.Eq, ReadPrec [EthernetStatus]
ReadPrec EthernetStatus
Int -> ReadS EthernetStatus
ReadS [EthernetStatus]
(Int -> ReadS EthernetStatus)
-> ReadS [EthernetStatus]
-> ReadPrec EthernetStatus
-> ReadPrec [EthernetStatus]
-> Read EthernetStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EthernetStatus]
$creadListPrec :: ReadPrec [EthernetStatus]
readPrec :: ReadPrec EthernetStatus
$creadPrec :: ReadPrec EthernetStatus
readList :: ReadS [EthernetStatus]
$creadList :: ReadS [EthernetStatus]
readsPrec :: Int -> ReadS EthernetStatus
$creadsPrec :: Int -> ReadS EthernetStatus
Prelude.Read, Int -> EthernetStatus -> ShowS
[EthernetStatus] -> ShowS
EthernetStatus -> String
(Int -> EthernetStatus -> ShowS)
-> (EthernetStatus -> String)
-> ([EthernetStatus] -> ShowS)
-> Show EthernetStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EthernetStatus] -> ShowS
$cshowList :: [EthernetStatus] -> ShowS
show :: EthernetStatus -> String
$cshow :: EthernetStatus -> String
showsPrec :: Int -> EthernetStatus -> ShowS
$cshowsPrec :: Int -> EthernetStatus -> ShowS
Prelude.Show, (forall x. EthernetStatus -> Rep EthernetStatus x)
-> (forall x. Rep EthernetStatus x -> EthernetStatus)
-> Generic EthernetStatus
forall x. Rep EthernetStatus x -> EthernetStatus
forall x. EthernetStatus -> Rep EthernetStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EthernetStatus x -> EthernetStatus
$cfrom :: forall x. EthernetStatus -> Rep EthernetStatus x
Prelude.Generic)

-- |
-- Create a value of 'EthernetStatus' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'ipAddress', 'ethernetStatus_ipAddress' - The device\'s IP address.
--
-- 'connectionStatus', 'ethernetStatus_connectionStatus' - The device\'s connection status.
--
-- 'hwAddress', 'ethernetStatus_hwAddress' - The device\'s physical address.
newEthernetStatus ::
  EthernetStatus
newEthernetStatus :: EthernetStatus
newEthernetStatus =
  EthernetStatus' :: Maybe Text
-> Maybe NetworkConnectionStatus -> Maybe Text -> EthernetStatus
EthernetStatus'
    { $sel:ipAddress:EthernetStatus' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionStatus:EthernetStatus' :: Maybe NetworkConnectionStatus
connectionStatus = Maybe NetworkConnectionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:hwAddress:EthernetStatus' :: Maybe Text
hwAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The device\'s IP address.
ethernetStatus_ipAddress :: Lens.Lens' EthernetStatus (Prelude.Maybe Prelude.Text)
ethernetStatus_ipAddress :: (Maybe Text -> f (Maybe Text))
-> EthernetStatus -> f EthernetStatus
ethernetStatus_ipAddress = (EthernetStatus -> Maybe Text)
-> (EthernetStatus -> Maybe Text -> EthernetStatus)
-> Lens EthernetStatus EthernetStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EthernetStatus' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:EthernetStatus' :: EthernetStatus -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: EthernetStatus
s@EthernetStatus' {} Maybe Text
a -> EthernetStatus
s {$sel:ipAddress:EthernetStatus' :: Maybe Text
ipAddress = Maybe Text
a} :: EthernetStatus)

-- | The device\'s connection status.
ethernetStatus_connectionStatus :: Lens.Lens' EthernetStatus (Prelude.Maybe NetworkConnectionStatus)
ethernetStatus_connectionStatus :: (Maybe NetworkConnectionStatus
 -> f (Maybe NetworkConnectionStatus))
-> EthernetStatus -> f EthernetStatus
ethernetStatus_connectionStatus = (EthernetStatus -> Maybe NetworkConnectionStatus)
-> (EthernetStatus
    -> Maybe NetworkConnectionStatus -> EthernetStatus)
-> Lens
     EthernetStatus
     EthernetStatus
     (Maybe NetworkConnectionStatus)
     (Maybe NetworkConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EthernetStatus' {Maybe NetworkConnectionStatus
connectionStatus :: Maybe NetworkConnectionStatus
$sel:connectionStatus:EthernetStatus' :: EthernetStatus -> Maybe NetworkConnectionStatus
connectionStatus} -> Maybe NetworkConnectionStatus
connectionStatus) (\s :: EthernetStatus
s@EthernetStatus' {} Maybe NetworkConnectionStatus
a -> EthernetStatus
s {$sel:connectionStatus:EthernetStatus' :: Maybe NetworkConnectionStatus
connectionStatus = Maybe NetworkConnectionStatus
a} :: EthernetStatus)

-- | The device\'s physical address.
ethernetStatus_hwAddress :: Lens.Lens' EthernetStatus (Prelude.Maybe Prelude.Text)
ethernetStatus_hwAddress :: (Maybe Text -> f (Maybe Text))
-> EthernetStatus -> f EthernetStatus
ethernetStatus_hwAddress = (EthernetStatus -> Maybe Text)
-> (EthernetStatus -> Maybe Text -> EthernetStatus)
-> Lens EthernetStatus EthernetStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EthernetStatus' {Maybe Text
hwAddress :: Maybe Text
$sel:hwAddress:EthernetStatus' :: EthernetStatus -> Maybe Text
hwAddress} -> Maybe Text
hwAddress) (\s :: EthernetStatus
s@EthernetStatus' {} Maybe Text
a -> EthernetStatus
s {$sel:hwAddress:EthernetStatus' :: Maybe Text
hwAddress = Maybe Text
a} :: EthernetStatus)

instance Core.FromJSON EthernetStatus where
  parseJSON :: Value -> Parser EthernetStatus
parseJSON =
    String
-> (Object -> Parser EthernetStatus)
-> Value
-> Parser EthernetStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EthernetStatus"
      ( \Object
x ->
          Maybe Text
-> Maybe NetworkConnectionStatus -> Maybe Text -> EthernetStatus
EthernetStatus'
            (Maybe Text
 -> Maybe NetworkConnectionStatus -> Maybe Text -> EthernetStatus)
-> Parser (Maybe Text)
-> Parser
     (Maybe NetworkConnectionStatus -> Maybe Text -> EthernetStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IpAddress")
            Parser
  (Maybe NetworkConnectionStatus -> Maybe Text -> EthernetStatus)
-> Parser (Maybe NetworkConnectionStatus)
-> Parser (Maybe Text -> EthernetStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NetworkConnectionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConnectionStatus")
            Parser (Maybe Text -> EthernetStatus)
-> Parser (Maybe Text) -> Parser EthernetStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HwAddress")
      )

instance Prelude.Hashable EthernetStatus

instance Prelude.NFData EthernetStatus