{-# 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.Discovery.Types.AgentNetworkInfo
-- 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.Discovery.Types.AgentNetworkInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Network details about the host where the agent\/connector resides.
--
-- /See:/ 'newAgentNetworkInfo' smart constructor.
data AgentNetworkInfo = AgentNetworkInfo'
  { -- | The IP address for the host where the agent\/connector resides.
    AgentNetworkInfo -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | The MAC address for the host where the agent\/connector resides.
    AgentNetworkInfo -> Maybe Text
macAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (AgentNetworkInfo -> AgentNetworkInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AgentNetworkInfo -> AgentNetworkInfo -> Bool
$c/= :: AgentNetworkInfo -> AgentNetworkInfo -> Bool
== :: AgentNetworkInfo -> AgentNetworkInfo -> Bool
$c== :: AgentNetworkInfo -> AgentNetworkInfo -> Bool
Prelude.Eq, ReadPrec [AgentNetworkInfo]
ReadPrec AgentNetworkInfo
Int -> ReadS AgentNetworkInfo
ReadS [AgentNetworkInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AgentNetworkInfo]
$creadListPrec :: ReadPrec [AgentNetworkInfo]
readPrec :: ReadPrec AgentNetworkInfo
$creadPrec :: ReadPrec AgentNetworkInfo
readList :: ReadS [AgentNetworkInfo]
$creadList :: ReadS [AgentNetworkInfo]
readsPrec :: Int -> ReadS AgentNetworkInfo
$creadsPrec :: Int -> ReadS AgentNetworkInfo
Prelude.Read, Int -> AgentNetworkInfo -> ShowS
[AgentNetworkInfo] -> ShowS
AgentNetworkInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AgentNetworkInfo] -> ShowS
$cshowList :: [AgentNetworkInfo] -> ShowS
show :: AgentNetworkInfo -> String
$cshow :: AgentNetworkInfo -> String
showsPrec :: Int -> AgentNetworkInfo -> ShowS
$cshowsPrec :: Int -> AgentNetworkInfo -> ShowS
Prelude.Show, forall x. Rep AgentNetworkInfo x -> AgentNetworkInfo
forall x. AgentNetworkInfo -> Rep AgentNetworkInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AgentNetworkInfo x -> AgentNetworkInfo
$cfrom :: forall x. AgentNetworkInfo -> Rep AgentNetworkInfo x
Prelude.Generic)

-- |
-- Create a value of 'AgentNetworkInfo' 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', 'agentNetworkInfo_ipAddress' - The IP address for the host where the agent\/connector resides.
--
-- 'macAddress', 'agentNetworkInfo_macAddress' - The MAC address for the host where the agent\/connector resides.
newAgentNetworkInfo ::
  AgentNetworkInfo
newAgentNetworkInfo :: AgentNetworkInfo
newAgentNetworkInfo =
  AgentNetworkInfo'
    { $sel:ipAddress:AgentNetworkInfo' :: Maybe Text
ipAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:macAddress:AgentNetworkInfo' :: Maybe Text
macAddress = forall a. Maybe a
Prelude.Nothing
    }

-- | The IP address for the host where the agent\/connector resides.
agentNetworkInfo_ipAddress :: Lens.Lens' AgentNetworkInfo (Prelude.Maybe Prelude.Text)
agentNetworkInfo_ipAddress :: Lens' AgentNetworkInfo (Maybe Text)
agentNetworkInfo_ipAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentNetworkInfo' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:AgentNetworkInfo' :: AgentNetworkInfo -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: AgentNetworkInfo
s@AgentNetworkInfo' {} Maybe Text
a -> AgentNetworkInfo
s {$sel:ipAddress:AgentNetworkInfo' :: Maybe Text
ipAddress = Maybe Text
a} :: AgentNetworkInfo)

-- | The MAC address for the host where the agent\/connector resides.
agentNetworkInfo_macAddress :: Lens.Lens' AgentNetworkInfo (Prelude.Maybe Prelude.Text)
agentNetworkInfo_macAddress :: Lens' AgentNetworkInfo (Maybe Text)
agentNetworkInfo_macAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentNetworkInfo' {Maybe Text
macAddress :: Maybe Text
$sel:macAddress:AgentNetworkInfo' :: AgentNetworkInfo -> Maybe Text
macAddress} -> Maybe Text
macAddress) (\s :: AgentNetworkInfo
s@AgentNetworkInfo' {} Maybe Text
a -> AgentNetworkInfo
s {$sel:macAddress:AgentNetworkInfo' :: Maybe Text
macAddress = Maybe Text
a} :: AgentNetworkInfo)

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

instance Prelude.Hashable AgentNetworkInfo where
  hashWithSalt :: Int -> AgentNetworkInfo -> Int
hashWithSalt Int
_salt AgentNetworkInfo' {Maybe Text
macAddress :: Maybe Text
ipAddress :: Maybe Text
$sel:macAddress:AgentNetworkInfo' :: AgentNetworkInfo -> Maybe Text
$sel:ipAddress:AgentNetworkInfo' :: AgentNetworkInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
macAddress

instance Prelude.NFData AgentNetworkInfo where
  rnf :: AgentNetworkInfo -> ()
rnf AgentNetworkInfo' {Maybe Text
macAddress :: Maybe Text
ipAddress :: Maybe Text
$sel:macAddress:AgentNetworkInfo' :: AgentNetworkInfo -> Maybe Text
$sel:ipAddress:AgentNetworkInfo' :: AgentNetworkInfo -> Maybe Text
..} =
    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
macAddress