{-# 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.NtpStatus
-- 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.NtpStatus 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.NetworkConnectionStatus
import qualified Amazonka.Prelude as Prelude

-- | Details about an NTP server connection.
--
-- /See:/ 'newNtpStatus' smart constructor.
data NtpStatus = NtpStatus'
  { -- | The connection\'s status.
    NtpStatus -> Maybe NetworkConnectionStatus
connectionStatus :: Prelude.Maybe NetworkConnectionStatus,
    -- | The IP address of the server.
    NtpStatus -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | The domain name of the server.
    NtpStatus -> Maybe Text
ntpServerName :: Prelude.Maybe Prelude.Text
  }
  deriving (NtpStatus -> NtpStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NtpStatus -> NtpStatus -> Bool
$c/= :: NtpStatus -> NtpStatus -> Bool
== :: NtpStatus -> NtpStatus -> Bool
$c== :: NtpStatus -> NtpStatus -> Bool
Prelude.Eq, ReadPrec [NtpStatus]
ReadPrec NtpStatus
Int -> ReadS NtpStatus
ReadS [NtpStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NtpStatus]
$creadListPrec :: ReadPrec [NtpStatus]
readPrec :: ReadPrec NtpStatus
$creadPrec :: ReadPrec NtpStatus
readList :: ReadS [NtpStatus]
$creadList :: ReadS [NtpStatus]
readsPrec :: Int -> ReadS NtpStatus
$creadsPrec :: Int -> ReadS NtpStatus
Prelude.Read, Int -> NtpStatus -> ShowS
[NtpStatus] -> ShowS
NtpStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NtpStatus] -> ShowS
$cshowList :: [NtpStatus] -> ShowS
show :: NtpStatus -> String
$cshow :: NtpStatus -> String
showsPrec :: Int -> NtpStatus -> ShowS
$cshowsPrec :: Int -> NtpStatus -> ShowS
Prelude.Show, forall x. Rep NtpStatus x -> NtpStatus
forall x. NtpStatus -> Rep NtpStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NtpStatus x -> NtpStatus
$cfrom :: forall x. NtpStatus -> Rep NtpStatus x
Prelude.Generic)

-- |
-- Create a value of 'NtpStatus' 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:
--
-- 'connectionStatus', 'ntpStatus_connectionStatus' - The connection\'s status.
--
-- 'ipAddress', 'ntpStatus_ipAddress' - The IP address of the server.
--
-- 'ntpServerName', 'ntpStatus_ntpServerName' - The domain name of the server.
newNtpStatus ::
  NtpStatus
newNtpStatus :: NtpStatus
newNtpStatus =
  NtpStatus'
    { $sel:connectionStatus:NtpStatus' :: Maybe NetworkConnectionStatus
connectionStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:NtpStatus' :: Maybe Text
ipAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:ntpServerName:NtpStatus' :: Maybe Text
ntpServerName = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The IP address of the server.
ntpStatus_ipAddress :: Lens.Lens' NtpStatus (Prelude.Maybe Prelude.Text)
ntpStatus_ipAddress :: Lens' NtpStatus (Maybe Text)
ntpStatus_ipAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NtpStatus' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:NtpStatus' :: NtpStatus -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: NtpStatus
s@NtpStatus' {} Maybe Text
a -> NtpStatus
s {$sel:ipAddress:NtpStatus' :: Maybe Text
ipAddress = Maybe Text
a} :: NtpStatus)

-- | The domain name of the server.
ntpStatus_ntpServerName :: Lens.Lens' NtpStatus (Prelude.Maybe Prelude.Text)
ntpStatus_ntpServerName :: Lens' NtpStatus (Maybe Text)
ntpStatus_ntpServerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NtpStatus' {Maybe Text
ntpServerName :: Maybe Text
$sel:ntpServerName:NtpStatus' :: NtpStatus -> Maybe Text
ntpServerName} -> Maybe Text
ntpServerName) (\s :: NtpStatus
s@NtpStatus' {} Maybe Text
a -> NtpStatus
s {$sel:ntpServerName:NtpStatus' :: Maybe Text
ntpServerName = Maybe Text
a} :: NtpStatus)

instance Data.FromJSON NtpStatus where
  parseJSON :: Value -> Parser NtpStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NtpStatus"
      ( \Object
x ->
          Maybe NetworkConnectionStatus
-> Maybe Text -> Maybe Text -> NtpStatus
NtpStatus'
            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
"ConnectionStatus")
            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
"IpAddress")
            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
"NtpServerName")
      )

instance Prelude.Hashable NtpStatus where
  hashWithSalt :: Int -> NtpStatus -> Int
hashWithSalt Int
_salt NtpStatus' {Maybe Text
Maybe NetworkConnectionStatus
ntpServerName :: Maybe Text
ipAddress :: Maybe Text
connectionStatus :: Maybe NetworkConnectionStatus
$sel:ntpServerName:NtpStatus' :: NtpStatus -> Maybe Text
$sel:ipAddress:NtpStatus' :: NtpStatus -> Maybe Text
$sel:connectionStatus:NtpStatus' :: NtpStatus -> Maybe NetworkConnectionStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NetworkConnectionStatus
connectionStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ntpServerName

instance Prelude.NFData NtpStatus where
  rnf :: NtpStatus -> ()
rnf NtpStatus' {Maybe Text
Maybe NetworkConnectionStatus
ntpServerName :: Maybe Text
ipAddress :: Maybe Text
connectionStatus :: Maybe NetworkConnectionStatus
$sel:ntpServerName:NtpStatus' :: NtpStatus -> Maybe Text
$sel:ipAddress:NtpStatus' :: NtpStatus -> Maybe Text
$sel:connectionStatus:NtpStatus' :: NtpStatus -> Maybe NetworkConnectionStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkConnectionStatus
connectionStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ntpServerName