{-# 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.NetworkStatus
-- 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.NetworkStatus where

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

-- | The network status of a device.
--
-- /See:/ 'newNetworkStatus' smart constructor.
data NetworkStatus = NetworkStatus'
  { -- | The status of Ethernet port 1.
    NetworkStatus -> Maybe EthernetStatus
ethernet1Status :: Prelude.Maybe EthernetStatus,
    -- | The status of Ethernet port 0.
    NetworkStatus -> Maybe EthernetStatus
ethernet0Status :: Prelude.Maybe EthernetStatus
  }
  deriving (NetworkStatus -> NetworkStatus -> Bool
(NetworkStatus -> NetworkStatus -> Bool)
-> (NetworkStatus -> NetworkStatus -> Bool) -> Eq NetworkStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkStatus -> NetworkStatus -> Bool
$c/= :: NetworkStatus -> NetworkStatus -> Bool
== :: NetworkStatus -> NetworkStatus -> Bool
$c== :: NetworkStatus -> NetworkStatus -> Bool
Prelude.Eq, ReadPrec [NetworkStatus]
ReadPrec NetworkStatus
Int -> ReadS NetworkStatus
ReadS [NetworkStatus]
(Int -> ReadS NetworkStatus)
-> ReadS [NetworkStatus]
-> ReadPrec NetworkStatus
-> ReadPrec [NetworkStatus]
-> Read NetworkStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkStatus]
$creadListPrec :: ReadPrec [NetworkStatus]
readPrec :: ReadPrec NetworkStatus
$creadPrec :: ReadPrec NetworkStatus
readList :: ReadS [NetworkStatus]
$creadList :: ReadS [NetworkStatus]
readsPrec :: Int -> ReadS NetworkStatus
$creadsPrec :: Int -> ReadS NetworkStatus
Prelude.Read, Int -> NetworkStatus -> ShowS
[NetworkStatus] -> ShowS
NetworkStatus -> String
(Int -> NetworkStatus -> ShowS)
-> (NetworkStatus -> String)
-> ([NetworkStatus] -> ShowS)
-> Show NetworkStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkStatus] -> ShowS
$cshowList :: [NetworkStatus] -> ShowS
show :: NetworkStatus -> String
$cshow :: NetworkStatus -> String
showsPrec :: Int -> NetworkStatus -> ShowS
$cshowsPrec :: Int -> NetworkStatus -> ShowS
Prelude.Show, (forall x. NetworkStatus -> Rep NetworkStatus x)
-> (forall x. Rep NetworkStatus x -> NetworkStatus)
-> Generic NetworkStatus
forall x. Rep NetworkStatus x -> NetworkStatus
forall x. NetworkStatus -> Rep NetworkStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkStatus x -> NetworkStatus
$cfrom :: forall x. NetworkStatus -> Rep NetworkStatus x
Prelude.Generic)

-- |
-- Create a value of 'NetworkStatus' 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:
--
-- 'ethernet1Status', 'networkStatus_ethernet1Status' - The status of Ethernet port 1.
--
-- 'ethernet0Status', 'networkStatus_ethernet0Status' - The status of Ethernet port 0.
newNetworkStatus ::
  NetworkStatus
newNetworkStatus :: NetworkStatus
newNetworkStatus =
  NetworkStatus' :: Maybe EthernetStatus -> Maybe EthernetStatus -> NetworkStatus
NetworkStatus'
    { $sel:ethernet1Status:NetworkStatus' :: Maybe EthernetStatus
ethernet1Status = Maybe EthernetStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:ethernet0Status:NetworkStatus' :: Maybe EthernetStatus
ethernet0Status = Maybe EthernetStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of Ethernet port 1.
networkStatus_ethernet1Status :: Lens.Lens' NetworkStatus (Prelude.Maybe EthernetStatus)
networkStatus_ethernet1Status :: (Maybe EthernetStatus -> f (Maybe EthernetStatus))
-> NetworkStatus -> f NetworkStatus
networkStatus_ethernet1Status = (NetworkStatus -> Maybe EthernetStatus)
-> (NetworkStatus -> Maybe EthernetStatus -> NetworkStatus)
-> Lens
     NetworkStatus
     NetworkStatus
     (Maybe EthernetStatus)
     (Maybe EthernetStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkStatus' {Maybe EthernetStatus
ethernet1Status :: Maybe EthernetStatus
$sel:ethernet1Status:NetworkStatus' :: NetworkStatus -> Maybe EthernetStatus
ethernet1Status} -> Maybe EthernetStatus
ethernet1Status) (\s :: NetworkStatus
s@NetworkStatus' {} Maybe EthernetStatus
a -> NetworkStatus
s {$sel:ethernet1Status:NetworkStatus' :: Maybe EthernetStatus
ethernet1Status = Maybe EthernetStatus
a} :: NetworkStatus)

-- | The status of Ethernet port 0.
networkStatus_ethernet0Status :: Lens.Lens' NetworkStatus (Prelude.Maybe EthernetStatus)
networkStatus_ethernet0Status :: (Maybe EthernetStatus -> f (Maybe EthernetStatus))
-> NetworkStatus -> f NetworkStatus
networkStatus_ethernet0Status = (NetworkStatus -> Maybe EthernetStatus)
-> (NetworkStatus -> Maybe EthernetStatus -> NetworkStatus)
-> Lens
     NetworkStatus
     NetworkStatus
     (Maybe EthernetStatus)
     (Maybe EthernetStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkStatus' {Maybe EthernetStatus
ethernet0Status :: Maybe EthernetStatus
$sel:ethernet0Status:NetworkStatus' :: NetworkStatus -> Maybe EthernetStatus
ethernet0Status} -> Maybe EthernetStatus
ethernet0Status) (\s :: NetworkStatus
s@NetworkStatus' {} Maybe EthernetStatus
a -> NetworkStatus
s {$sel:ethernet0Status:NetworkStatus' :: Maybe EthernetStatus
ethernet0Status = Maybe EthernetStatus
a} :: NetworkStatus)

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

instance Prelude.Hashable NetworkStatus

instance Prelude.NFData NetworkStatus