{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Panorama.Types.NetworkStatus 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.EthernetStatus
import Amazonka.Panorama.Types.NtpStatus
import qualified Amazonka.Prelude as Prelude

-- | The network status of a device.
--
-- /See:/ 'newNetworkStatus' smart constructor.
data NetworkStatus = NetworkStatus'
  { -- | The status of Ethernet port 0.
    NetworkStatus -> Maybe EthernetStatus
ethernet0Status :: Prelude.Maybe EthernetStatus,
    -- | The status of Ethernet port 1.
    NetworkStatus -> Maybe EthernetStatus
ethernet1Status :: Prelude.Maybe EthernetStatus,
    -- | When the network status changed.
    NetworkStatus -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Data.POSIX,
    -- | Details about a network time protocol (NTP) server connection.
    NetworkStatus -> Maybe NtpStatus
ntpStatus :: Prelude.Maybe NtpStatus
  }
  deriving (NetworkStatus -> NetworkStatus -> Bool
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]
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
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. 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:
--
-- 'ethernet0Status', 'networkStatus_ethernet0Status' - The status of Ethernet port 0.
--
-- 'ethernet1Status', 'networkStatus_ethernet1Status' - The status of Ethernet port 1.
--
-- 'lastUpdatedTime', 'networkStatus_lastUpdatedTime' - When the network status changed.
--
-- 'ntpStatus', 'networkStatus_ntpStatus' - Details about a network time protocol (NTP) server connection.
newNetworkStatus ::
  NetworkStatus
newNetworkStatus :: NetworkStatus
newNetworkStatus =
  NetworkStatus'
    { $sel:ethernet0Status:NetworkStatus' :: Maybe EthernetStatus
ethernet0Status = forall a. Maybe a
Prelude.Nothing,
      $sel:ethernet1Status:NetworkStatus' :: Maybe EthernetStatus
ethernet1Status = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:NetworkStatus' :: Maybe POSIX
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:ntpStatus:NetworkStatus' :: Maybe NtpStatus
ntpStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | The status of Ethernet port 0.
networkStatus_ethernet0Status :: Lens.Lens' NetworkStatus (Prelude.Maybe EthernetStatus)
networkStatus_ethernet0Status :: Lens' NetworkStatus (Maybe EthernetStatus)
networkStatus_ethernet0Status = 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)

-- | The status of Ethernet port 1.
networkStatus_ethernet1Status :: Lens.Lens' NetworkStatus (Prelude.Maybe EthernetStatus)
networkStatus_ethernet1Status :: Lens' NetworkStatus (Maybe EthernetStatus)
networkStatus_ethernet1Status = 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)

-- | When the network status changed.
networkStatus_lastUpdatedTime :: Lens.Lens' NetworkStatus (Prelude.Maybe Prelude.UTCTime)
networkStatus_lastUpdatedTime :: Lens' NetworkStatus (Maybe UTCTime)
networkStatus_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkStatus' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:NetworkStatus' :: NetworkStatus -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: NetworkStatus
s@NetworkStatus' {} Maybe POSIX
a -> NetworkStatus
s {$sel:lastUpdatedTime:NetworkStatus' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: NetworkStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Details about a network time protocol (NTP) server connection.
networkStatus_ntpStatus :: Lens.Lens' NetworkStatus (Prelude.Maybe NtpStatus)
networkStatus_ntpStatus :: Lens' NetworkStatus (Maybe NtpStatus)
networkStatus_ntpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkStatus' {Maybe NtpStatus
ntpStatus :: Maybe NtpStatus
$sel:ntpStatus:NetworkStatus' :: NetworkStatus -> Maybe NtpStatus
ntpStatus} -> Maybe NtpStatus
ntpStatus) (\s :: NetworkStatus
s@NetworkStatus' {} Maybe NtpStatus
a -> NetworkStatus
s {$sel:ntpStatus:NetworkStatus' :: Maybe NtpStatus
ntpStatus = Maybe NtpStatus
a} :: NetworkStatus)

instance Data.FromJSON NetworkStatus where
  parseJSON :: Value -> Parser NetworkStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkStatus"
      ( \Object
x ->
          Maybe EthernetStatus
-> Maybe EthernetStatus
-> Maybe POSIX
-> Maybe NtpStatus
-> NetworkStatus
NetworkStatus'
            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
"Ethernet0Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Ethernet1Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastUpdatedTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NtpStatus")
      )

instance Prelude.Hashable NetworkStatus where
  hashWithSalt :: Int -> NetworkStatus -> Int
hashWithSalt Int
_salt NetworkStatus' {Maybe POSIX
Maybe EthernetStatus
Maybe NtpStatus
ntpStatus :: Maybe NtpStatus
lastUpdatedTime :: Maybe POSIX
ethernet1Status :: Maybe EthernetStatus
ethernet0Status :: Maybe EthernetStatus
$sel:ntpStatus:NetworkStatus' :: NetworkStatus -> Maybe NtpStatus
$sel:lastUpdatedTime:NetworkStatus' :: NetworkStatus -> Maybe POSIX
$sel:ethernet1Status:NetworkStatus' :: NetworkStatus -> Maybe EthernetStatus
$sel:ethernet0Status:NetworkStatus' :: NetworkStatus -> Maybe EthernetStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EthernetStatus
ethernet0Status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EthernetStatus
ethernet1Status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NtpStatus
ntpStatus

instance Prelude.NFData NetworkStatus where
  rnf :: NetworkStatus -> ()
rnf NetworkStatus' {Maybe POSIX
Maybe EthernetStatus
Maybe NtpStatus
ntpStatus :: Maybe NtpStatus
lastUpdatedTime :: Maybe POSIX
ethernet1Status :: Maybe EthernetStatus
ethernet0Status :: Maybe EthernetStatus
$sel:ntpStatus:NetworkStatus' :: NetworkStatus -> Maybe NtpStatus
$sel:lastUpdatedTime:NetworkStatus' :: NetworkStatus -> Maybe POSIX
$sel:ethernet1Status:NetworkStatus' :: NetworkStatus -> Maybe EthernetStatus
$sel:ethernet0Status:NetworkStatus' :: NetworkStatus -> Maybe EthernetStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EthernetStatus
ethernet0Status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EthernetStatus
ethernet1Status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NtpStatus
ntpStatus