{-# 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.SnowDeviceManagement.Types.PhysicalNetworkInterface
-- 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.SnowDeviceManagement.Types.PhysicalNetworkInterface where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SnowDeviceManagement.Types.IpAddressAssignment
import Amazonka.SnowDeviceManagement.Types.PhysicalConnectorType

-- | The details about the physical network interface for the device.
--
-- /See:/ 'newPhysicalNetworkInterface' smart constructor.
data PhysicalNetworkInterface = PhysicalNetworkInterface'
  { -- | The IP address of the device.
    PhysicalNetworkInterface -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | The MAC address of the device.
    PhysicalNetworkInterface -> Maybe Text
macAddress :: Prelude.Maybe Prelude.Text,
    -- | A value that describes whether the IP address is dynamic or persistent.
    PhysicalNetworkInterface -> Maybe IpAddressAssignment
ipAddressAssignment :: Prelude.Maybe IpAddressAssignment,
    -- | The default gateway of the device.
    PhysicalNetworkInterface -> Maybe Text
defaultGateway :: Prelude.Maybe Prelude.Text,
    -- | The physical network interface ID.
    PhysicalNetworkInterface -> Maybe Text
physicalNetworkInterfaceId :: Prelude.Maybe Prelude.Text,
    -- | The netmask used to divide the IP address into subnets.
    PhysicalNetworkInterface -> Maybe Text
netmask :: Prelude.Maybe Prelude.Text,
    -- | The physical connector type.
    PhysicalNetworkInterface -> Maybe PhysicalConnectorType
physicalConnectorType :: Prelude.Maybe PhysicalConnectorType
  }
  deriving (PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool
(PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool)
-> (PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool)
-> Eq PhysicalNetworkInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool
$c/= :: PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool
== :: PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool
$c== :: PhysicalNetworkInterface -> PhysicalNetworkInterface -> Bool
Prelude.Eq, ReadPrec [PhysicalNetworkInterface]
ReadPrec PhysicalNetworkInterface
Int -> ReadS PhysicalNetworkInterface
ReadS [PhysicalNetworkInterface]
(Int -> ReadS PhysicalNetworkInterface)
-> ReadS [PhysicalNetworkInterface]
-> ReadPrec PhysicalNetworkInterface
-> ReadPrec [PhysicalNetworkInterface]
-> Read PhysicalNetworkInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhysicalNetworkInterface]
$creadListPrec :: ReadPrec [PhysicalNetworkInterface]
readPrec :: ReadPrec PhysicalNetworkInterface
$creadPrec :: ReadPrec PhysicalNetworkInterface
readList :: ReadS [PhysicalNetworkInterface]
$creadList :: ReadS [PhysicalNetworkInterface]
readsPrec :: Int -> ReadS PhysicalNetworkInterface
$creadsPrec :: Int -> ReadS PhysicalNetworkInterface
Prelude.Read, Int -> PhysicalNetworkInterface -> ShowS
[PhysicalNetworkInterface] -> ShowS
PhysicalNetworkInterface -> String
(Int -> PhysicalNetworkInterface -> ShowS)
-> (PhysicalNetworkInterface -> String)
-> ([PhysicalNetworkInterface] -> ShowS)
-> Show PhysicalNetworkInterface
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhysicalNetworkInterface] -> ShowS
$cshowList :: [PhysicalNetworkInterface] -> ShowS
show :: PhysicalNetworkInterface -> String
$cshow :: PhysicalNetworkInterface -> String
showsPrec :: Int -> PhysicalNetworkInterface -> ShowS
$cshowsPrec :: Int -> PhysicalNetworkInterface -> ShowS
Prelude.Show, (forall x.
 PhysicalNetworkInterface -> Rep PhysicalNetworkInterface x)
-> (forall x.
    Rep PhysicalNetworkInterface x -> PhysicalNetworkInterface)
-> Generic PhysicalNetworkInterface
forall x.
Rep PhysicalNetworkInterface x -> PhysicalNetworkInterface
forall x.
PhysicalNetworkInterface -> Rep PhysicalNetworkInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PhysicalNetworkInterface x -> PhysicalNetworkInterface
$cfrom :: forall x.
PhysicalNetworkInterface -> Rep PhysicalNetworkInterface x
Prelude.Generic)

-- |
-- Create a value of 'PhysicalNetworkInterface' 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', 'physicalNetworkInterface_ipAddress' - The IP address of the device.
--
-- 'macAddress', 'physicalNetworkInterface_macAddress' - The MAC address of the device.
--
-- 'ipAddressAssignment', 'physicalNetworkInterface_ipAddressAssignment' - A value that describes whether the IP address is dynamic or persistent.
--
-- 'defaultGateway', 'physicalNetworkInterface_defaultGateway' - The default gateway of the device.
--
-- 'physicalNetworkInterfaceId', 'physicalNetworkInterface_physicalNetworkInterfaceId' - The physical network interface ID.
--
-- 'netmask', 'physicalNetworkInterface_netmask' - The netmask used to divide the IP address into subnets.
--
-- 'physicalConnectorType', 'physicalNetworkInterface_physicalConnectorType' - The physical connector type.
newPhysicalNetworkInterface ::
  PhysicalNetworkInterface
newPhysicalNetworkInterface :: PhysicalNetworkInterface
newPhysicalNetworkInterface =
  PhysicalNetworkInterface' :: Maybe Text
-> Maybe Text
-> Maybe IpAddressAssignment
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PhysicalConnectorType
-> PhysicalNetworkInterface
PhysicalNetworkInterface'
    { $sel:ipAddress:PhysicalNetworkInterface' :: Maybe Text
ipAddress =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:macAddress:PhysicalNetworkInterface' :: Maybe Text
macAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddressAssignment:PhysicalNetworkInterface' :: Maybe IpAddressAssignment
ipAddressAssignment = Maybe IpAddressAssignment
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultGateway:PhysicalNetworkInterface' :: Maybe Text
defaultGateway = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:physicalNetworkInterfaceId:PhysicalNetworkInterface' :: Maybe Text
physicalNetworkInterfaceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:netmask:PhysicalNetworkInterface' :: Maybe Text
netmask = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:physicalConnectorType:PhysicalNetworkInterface' :: Maybe PhysicalConnectorType
physicalConnectorType = Maybe PhysicalConnectorType
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The MAC address of the device.
physicalNetworkInterface_macAddress :: Lens.Lens' PhysicalNetworkInterface (Prelude.Maybe Prelude.Text)
physicalNetworkInterface_macAddress :: (Maybe Text -> f (Maybe Text))
-> PhysicalNetworkInterface -> f PhysicalNetworkInterface
physicalNetworkInterface_macAddress = (PhysicalNetworkInterface -> Maybe Text)
-> (PhysicalNetworkInterface
    -> Maybe Text -> PhysicalNetworkInterface)
-> Lens
     PhysicalNetworkInterface
     PhysicalNetworkInterface
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalNetworkInterface' {Maybe Text
macAddress :: Maybe Text
$sel:macAddress:PhysicalNetworkInterface' :: PhysicalNetworkInterface -> Maybe Text
macAddress} -> Maybe Text
macAddress) (\s :: PhysicalNetworkInterface
s@PhysicalNetworkInterface' {} Maybe Text
a -> PhysicalNetworkInterface
s {$sel:macAddress:PhysicalNetworkInterface' :: Maybe Text
macAddress = Maybe Text
a} :: PhysicalNetworkInterface)

-- | A value that describes whether the IP address is dynamic or persistent.
physicalNetworkInterface_ipAddressAssignment :: Lens.Lens' PhysicalNetworkInterface (Prelude.Maybe IpAddressAssignment)
physicalNetworkInterface_ipAddressAssignment :: (Maybe IpAddressAssignment -> f (Maybe IpAddressAssignment))
-> PhysicalNetworkInterface -> f PhysicalNetworkInterface
physicalNetworkInterface_ipAddressAssignment = (PhysicalNetworkInterface -> Maybe IpAddressAssignment)
-> (PhysicalNetworkInterface
    -> Maybe IpAddressAssignment -> PhysicalNetworkInterface)
-> Lens
     PhysicalNetworkInterface
     PhysicalNetworkInterface
     (Maybe IpAddressAssignment)
     (Maybe IpAddressAssignment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalNetworkInterface' {Maybe IpAddressAssignment
ipAddressAssignment :: Maybe IpAddressAssignment
$sel:ipAddressAssignment:PhysicalNetworkInterface' :: PhysicalNetworkInterface -> Maybe IpAddressAssignment
ipAddressAssignment} -> Maybe IpAddressAssignment
ipAddressAssignment) (\s :: PhysicalNetworkInterface
s@PhysicalNetworkInterface' {} Maybe IpAddressAssignment
a -> PhysicalNetworkInterface
s {$sel:ipAddressAssignment:PhysicalNetworkInterface' :: Maybe IpAddressAssignment
ipAddressAssignment = Maybe IpAddressAssignment
a} :: PhysicalNetworkInterface)

-- | The default gateway of the device.
physicalNetworkInterface_defaultGateway :: Lens.Lens' PhysicalNetworkInterface (Prelude.Maybe Prelude.Text)
physicalNetworkInterface_defaultGateway :: (Maybe Text -> f (Maybe Text))
-> PhysicalNetworkInterface -> f PhysicalNetworkInterface
physicalNetworkInterface_defaultGateway = (PhysicalNetworkInterface -> Maybe Text)
-> (PhysicalNetworkInterface
    -> Maybe Text -> PhysicalNetworkInterface)
-> Lens
     PhysicalNetworkInterface
     PhysicalNetworkInterface
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalNetworkInterface' {Maybe Text
defaultGateway :: Maybe Text
$sel:defaultGateway:PhysicalNetworkInterface' :: PhysicalNetworkInterface -> Maybe Text
defaultGateway} -> Maybe Text
defaultGateway) (\s :: PhysicalNetworkInterface
s@PhysicalNetworkInterface' {} Maybe Text
a -> PhysicalNetworkInterface
s {$sel:defaultGateway:PhysicalNetworkInterface' :: Maybe Text
defaultGateway = Maybe Text
a} :: PhysicalNetworkInterface)

-- | The physical network interface ID.
physicalNetworkInterface_physicalNetworkInterfaceId :: Lens.Lens' PhysicalNetworkInterface (Prelude.Maybe Prelude.Text)
physicalNetworkInterface_physicalNetworkInterfaceId :: (Maybe Text -> f (Maybe Text))
-> PhysicalNetworkInterface -> f PhysicalNetworkInterface
physicalNetworkInterface_physicalNetworkInterfaceId = (PhysicalNetworkInterface -> Maybe Text)
-> (PhysicalNetworkInterface
    -> Maybe Text -> PhysicalNetworkInterface)
-> Lens
     PhysicalNetworkInterface
     PhysicalNetworkInterface
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalNetworkInterface' {Maybe Text
physicalNetworkInterfaceId :: Maybe Text
$sel:physicalNetworkInterfaceId:PhysicalNetworkInterface' :: PhysicalNetworkInterface -> Maybe Text
physicalNetworkInterfaceId} -> Maybe Text
physicalNetworkInterfaceId) (\s :: PhysicalNetworkInterface
s@PhysicalNetworkInterface' {} Maybe Text
a -> PhysicalNetworkInterface
s {$sel:physicalNetworkInterfaceId:PhysicalNetworkInterface' :: Maybe Text
physicalNetworkInterfaceId = Maybe Text
a} :: PhysicalNetworkInterface)

-- | The netmask used to divide the IP address into subnets.
physicalNetworkInterface_netmask :: Lens.Lens' PhysicalNetworkInterface (Prelude.Maybe Prelude.Text)
physicalNetworkInterface_netmask :: (Maybe Text -> f (Maybe Text))
-> PhysicalNetworkInterface -> f PhysicalNetworkInterface
physicalNetworkInterface_netmask = (PhysicalNetworkInterface -> Maybe Text)
-> (PhysicalNetworkInterface
    -> Maybe Text -> PhysicalNetworkInterface)
-> Lens
     PhysicalNetworkInterface
     PhysicalNetworkInterface
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalNetworkInterface' {Maybe Text
netmask :: Maybe Text
$sel:netmask:PhysicalNetworkInterface' :: PhysicalNetworkInterface -> Maybe Text
netmask} -> Maybe Text
netmask) (\s :: PhysicalNetworkInterface
s@PhysicalNetworkInterface' {} Maybe Text
a -> PhysicalNetworkInterface
s {$sel:netmask:PhysicalNetworkInterface' :: Maybe Text
netmask = Maybe Text
a} :: PhysicalNetworkInterface)

-- | The physical connector type.
physicalNetworkInterface_physicalConnectorType :: Lens.Lens' PhysicalNetworkInterface (Prelude.Maybe PhysicalConnectorType)
physicalNetworkInterface_physicalConnectorType :: (Maybe PhysicalConnectorType -> f (Maybe PhysicalConnectorType))
-> PhysicalNetworkInterface -> f PhysicalNetworkInterface
physicalNetworkInterface_physicalConnectorType = (PhysicalNetworkInterface -> Maybe PhysicalConnectorType)
-> (PhysicalNetworkInterface
    -> Maybe PhysicalConnectorType -> PhysicalNetworkInterface)
-> Lens
     PhysicalNetworkInterface
     PhysicalNetworkInterface
     (Maybe PhysicalConnectorType)
     (Maybe PhysicalConnectorType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalNetworkInterface' {Maybe PhysicalConnectorType
physicalConnectorType :: Maybe PhysicalConnectorType
$sel:physicalConnectorType:PhysicalNetworkInterface' :: PhysicalNetworkInterface -> Maybe PhysicalConnectorType
physicalConnectorType} -> Maybe PhysicalConnectorType
physicalConnectorType) (\s :: PhysicalNetworkInterface
s@PhysicalNetworkInterface' {} Maybe PhysicalConnectorType
a -> PhysicalNetworkInterface
s {$sel:physicalConnectorType:PhysicalNetworkInterface' :: Maybe PhysicalConnectorType
physicalConnectorType = Maybe PhysicalConnectorType
a} :: PhysicalNetworkInterface)

instance Core.FromJSON PhysicalNetworkInterface where
  parseJSON :: Value -> Parser PhysicalNetworkInterface
parseJSON =
    String
-> (Object -> Parser PhysicalNetworkInterface)
-> Value
-> Parser PhysicalNetworkInterface
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PhysicalNetworkInterface"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe IpAddressAssignment
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PhysicalConnectorType
-> PhysicalNetworkInterface
PhysicalNetworkInterface'
            (Maybe Text
 -> Maybe Text
 -> Maybe IpAddressAssignment
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe PhysicalConnectorType
 -> PhysicalNetworkInterface)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe IpAddressAssignment
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PhysicalConnectorType
      -> PhysicalNetworkInterface)
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 Text
   -> Maybe IpAddressAssignment
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PhysicalConnectorType
   -> PhysicalNetworkInterface)
-> Parser (Maybe Text)
-> Parser
     (Maybe IpAddressAssignment
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PhysicalConnectorType
      -> PhysicalNetworkInterface)
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
"macAddress")
            Parser
  (Maybe IpAddressAssignment
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PhysicalConnectorType
   -> PhysicalNetworkInterface)
-> Parser (Maybe IpAddressAssignment)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe PhysicalConnectorType
      -> PhysicalNetworkInterface)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IpAddressAssignment)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ipAddressAssignment")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe PhysicalConnectorType
   -> PhysicalNetworkInterface)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe PhysicalConnectorType
      -> PhysicalNetworkInterface)
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
"defaultGateway")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe PhysicalConnectorType
   -> PhysicalNetworkInterface)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe PhysicalConnectorType -> PhysicalNetworkInterface)
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
"physicalNetworkInterfaceId")
            Parser
  (Maybe Text
   -> Maybe PhysicalConnectorType -> PhysicalNetworkInterface)
-> Parser (Maybe Text)
-> Parser (Maybe PhysicalConnectorType -> PhysicalNetworkInterface)
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
"netmask")
            Parser (Maybe PhysicalConnectorType -> PhysicalNetworkInterface)
-> Parser (Maybe PhysicalConnectorType)
-> Parser PhysicalNetworkInterface
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PhysicalConnectorType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"physicalConnectorType")
      )

instance Prelude.Hashable PhysicalNetworkInterface

instance Prelude.NFData PhysicalNetworkInterface