{-# 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.MediaLive.Types.InputDeviceNetworkSettings
-- 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.MediaLive.Types.InputDeviceNetworkSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.InputDeviceIpScheme
import qualified Amazonka.Prelude as Prelude

-- | The network settings for the input device.
--
-- /See:/ 'newInputDeviceNetworkSettings' smart constructor.
data InputDeviceNetworkSettings = InputDeviceNetworkSettings'
  { -- | The DNS addresses of the input device.
    InputDeviceNetworkSettings -> Maybe [Text]
dnsAddresses :: Prelude.Maybe [Prelude.Text],
    -- | The network gateway IP address.
    InputDeviceNetworkSettings -> Maybe Text
gateway :: Prelude.Maybe Prelude.Text,
    -- | The IP address of the input device.
    InputDeviceNetworkSettings -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the input device has been configured (outside of
    -- MediaLive) to use a dynamic IP address assignment (DHCP) or a static IP
    -- address.
    InputDeviceNetworkSettings -> Maybe InputDeviceIpScheme
ipScheme :: Prelude.Maybe InputDeviceIpScheme,
    -- | The subnet mask of the input device.
    InputDeviceNetworkSettings -> Maybe Text
subnetMask :: Prelude.Maybe Prelude.Text
  }
  deriving (InputDeviceNetworkSettings -> InputDeviceNetworkSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputDeviceNetworkSettings -> InputDeviceNetworkSettings -> Bool
$c/= :: InputDeviceNetworkSettings -> InputDeviceNetworkSettings -> Bool
== :: InputDeviceNetworkSettings -> InputDeviceNetworkSettings -> Bool
$c== :: InputDeviceNetworkSettings -> InputDeviceNetworkSettings -> Bool
Prelude.Eq, ReadPrec [InputDeviceNetworkSettings]
ReadPrec InputDeviceNetworkSettings
Int -> ReadS InputDeviceNetworkSettings
ReadS [InputDeviceNetworkSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputDeviceNetworkSettings]
$creadListPrec :: ReadPrec [InputDeviceNetworkSettings]
readPrec :: ReadPrec InputDeviceNetworkSettings
$creadPrec :: ReadPrec InputDeviceNetworkSettings
readList :: ReadS [InputDeviceNetworkSettings]
$creadList :: ReadS [InputDeviceNetworkSettings]
readsPrec :: Int -> ReadS InputDeviceNetworkSettings
$creadsPrec :: Int -> ReadS InputDeviceNetworkSettings
Prelude.Read, Int -> InputDeviceNetworkSettings -> ShowS
[InputDeviceNetworkSettings] -> ShowS
InputDeviceNetworkSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputDeviceNetworkSettings] -> ShowS
$cshowList :: [InputDeviceNetworkSettings] -> ShowS
show :: InputDeviceNetworkSettings -> String
$cshow :: InputDeviceNetworkSettings -> String
showsPrec :: Int -> InputDeviceNetworkSettings -> ShowS
$cshowsPrec :: Int -> InputDeviceNetworkSettings -> ShowS
Prelude.Show, forall x.
Rep InputDeviceNetworkSettings x -> InputDeviceNetworkSettings
forall x.
InputDeviceNetworkSettings -> Rep InputDeviceNetworkSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InputDeviceNetworkSettings x -> InputDeviceNetworkSettings
$cfrom :: forall x.
InputDeviceNetworkSettings -> Rep InputDeviceNetworkSettings x
Prelude.Generic)

-- |
-- Create a value of 'InputDeviceNetworkSettings' 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:
--
-- 'dnsAddresses', 'inputDeviceNetworkSettings_dnsAddresses' - The DNS addresses of the input device.
--
-- 'gateway', 'inputDeviceNetworkSettings_gateway' - The network gateway IP address.
--
-- 'ipAddress', 'inputDeviceNetworkSettings_ipAddress' - The IP address of the input device.
--
-- 'ipScheme', 'inputDeviceNetworkSettings_ipScheme' - Specifies whether the input device has been configured (outside of
-- MediaLive) to use a dynamic IP address assignment (DHCP) or a static IP
-- address.
--
-- 'subnetMask', 'inputDeviceNetworkSettings_subnetMask' - The subnet mask of the input device.
newInputDeviceNetworkSettings ::
  InputDeviceNetworkSettings
newInputDeviceNetworkSettings :: InputDeviceNetworkSettings
newInputDeviceNetworkSettings =
  InputDeviceNetworkSettings'
    { $sel:dnsAddresses:InputDeviceNetworkSettings' :: Maybe [Text]
dnsAddresses =
        forall a. Maybe a
Prelude.Nothing,
      $sel:gateway:InputDeviceNetworkSettings' :: Maybe Text
gateway = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:InputDeviceNetworkSettings' :: Maybe Text
ipAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:ipScheme:InputDeviceNetworkSettings' :: Maybe InputDeviceIpScheme
ipScheme = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetMask:InputDeviceNetworkSettings' :: Maybe Text
subnetMask = forall a. Maybe a
Prelude.Nothing
    }

-- | The DNS addresses of the input device.
inputDeviceNetworkSettings_dnsAddresses :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe [Prelude.Text])
inputDeviceNetworkSettings_dnsAddresses :: Lens' InputDeviceNetworkSettings (Maybe [Text])
inputDeviceNetworkSettings_dnsAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDeviceNetworkSettings' {Maybe [Text]
dnsAddresses :: Maybe [Text]
$sel:dnsAddresses:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe [Text]
dnsAddresses} -> Maybe [Text]
dnsAddresses) (\s :: InputDeviceNetworkSettings
s@InputDeviceNetworkSettings' {} Maybe [Text]
a -> InputDeviceNetworkSettings
s {$sel:dnsAddresses:InputDeviceNetworkSettings' :: Maybe [Text]
dnsAddresses = Maybe [Text]
a} :: InputDeviceNetworkSettings) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The network gateway IP address.
inputDeviceNetworkSettings_gateway :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe Prelude.Text)
inputDeviceNetworkSettings_gateway :: Lens' InputDeviceNetworkSettings (Maybe Text)
inputDeviceNetworkSettings_gateway = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDeviceNetworkSettings' {Maybe Text
gateway :: Maybe Text
$sel:gateway:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
gateway} -> Maybe Text
gateway) (\s :: InputDeviceNetworkSettings
s@InputDeviceNetworkSettings' {} Maybe Text
a -> InputDeviceNetworkSettings
s {$sel:gateway:InputDeviceNetworkSettings' :: Maybe Text
gateway = Maybe Text
a} :: InputDeviceNetworkSettings)

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

-- | Specifies whether the input device has been configured (outside of
-- MediaLive) to use a dynamic IP address assignment (DHCP) or a static IP
-- address.
inputDeviceNetworkSettings_ipScheme :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe InputDeviceIpScheme)
inputDeviceNetworkSettings_ipScheme :: Lens' InputDeviceNetworkSettings (Maybe InputDeviceIpScheme)
inputDeviceNetworkSettings_ipScheme = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDeviceNetworkSettings' {Maybe InputDeviceIpScheme
ipScheme :: Maybe InputDeviceIpScheme
$sel:ipScheme:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe InputDeviceIpScheme
ipScheme} -> Maybe InputDeviceIpScheme
ipScheme) (\s :: InputDeviceNetworkSettings
s@InputDeviceNetworkSettings' {} Maybe InputDeviceIpScheme
a -> InputDeviceNetworkSettings
s {$sel:ipScheme:InputDeviceNetworkSettings' :: Maybe InputDeviceIpScheme
ipScheme = Maybe InputDeviceIpScheme
a} :: InputDeviceNetworkSettings)

-- | The subnet mask of the input device.
inputDeviceNetworkSettings_subnetMask :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe Prelude.Text)
inputDeviceNetworkSettings_subnetMask :: Lens' InputDeviceNetworkSettings (Maybe Text)
inputDeviceNetworkSettings_subnetMask = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputDeviceNetworkSettings' {Maybe Text
subnetMask :: Maybe Text
$sel:subnetMask:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
subnetMask} -> Maybe Text
subnetMask) (\s :: InputDeviceNetworkSettings
s@InputDeviceNetworkSettings' {} Maybe Text
a -> InputDeviceNetworkSettings
s {$sel:subnetMask:InputDeviceNetworkSettings' :: Maybe Text
subnetMask = Maybe Text
a} :: InputDeviceNetworkSettings)

instance Data.FromJSON InputDeviceNetworkSettings where
  parseJSON :: Value -> Parser InputDeviceNetworkSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputDeviceNetworkSettings"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe InputDeviceIpScheme
-> Maybe Text
-> InputDeviceNetworkSettings
InputDeviceNetworkSettings'
            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
"dnsAddresses" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"gateway")
            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
"ipScheme")
            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
"subnetMask")
      )

instance Prelude.Hashable InputDeviceNetworkSettings where
  hashWithSalt :: Int -> InputDeviceNetworkSettings -> Int
hashWithSalt Int
_salt InputDeviceNetworkSettings' {Maybe [Text]
Maybe Text
Maybe InputDeviceIpScheme
subnetMask :: Maybe Text
ipScheme :: Maybe InputDeviceIpScheme
ipAddress :: Maybe Text
gateway :: Maybe Text
dnsAddresses :: Maybe [Text]
$sel:subnetMask:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
$sel:ipScheme:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe InputDeviceIpScheme
$sel:ipAddress:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
$sel:gateway:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
$sel:dnsAddresses:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
dnsAddresses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gateway
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputDeviceIpScheme
ipScheme
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetMask

instance Prelude.NFData InputDeviceNetworkSettings where
  rnf :: InputDeviceNetworkSettings -> ()
rnf InputDeviceNetworkSettings' {Maybe [Text]
Maybe Text
Maybe InputDeviceIpScheme
subnetMask :: Maybe Text
ipScheme :: Maybe InputDeviceIpScheme
ipAddress :: Maybe Text
gateway :: Maybe Text
dnsAddresses :: Maybe [Text]
$sel:subnetMask:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
$sel:ipScheme:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe InputDeviceIpScheme
$sel:ipAddress:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
$sel:gateway:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe Text
$sel:dnsAddresses:InputDeviceNetworkSettings' :: InputDeviceNetworkSettings -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
dnsAddresses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gateway
      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 InputDeviceIpScheme
ipScheme
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetMask