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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 IP address of the input device.
    InputDeviceNetworkSettings -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
    -- | The network gateway IP address.
    InputDeviceNetworkSettings -> Maybe Text
gateway :: Prelude.Maybe Prelude.Text,
    -- | The DNS addresses of the input device.
    InputDeviceNetworkSettings -> Maybe [Text]
dnsAddresses :: 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
(InputDeviceNetworkSettings -> InputDeviceNetworkSettings -> Bool)
-> (InputDeviceNetworkSettings
    -> InputDeviceNetworkSettings -> Bool)
-> Eq InputDeviceNetworkSettings
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]
(Int -> ReadS InputDeviceNetworkSettings)
-> ReadS [InputDeviceNetworkSettings]
-> ReadPrec InputDeviceNetworkSettings
-> ReadPrec [InputDeviceNetworkSettings]
-> Read 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
(Int -> InputDeviceNetworkSettings -> ShowS)
-> (InputDeviceNetworkSettings -> String)
-> ([InputDeviceNetworkSettings] -> ShowS)
-> Show InputDeviceNetworkSettings
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.
 InputDeviceNetworkSettings -> Rep InputDeviceNetworkSettings x)
-> (forall x.
    Rep InputDeviceNetworkSettings x -> InputDeviceNetworkSettings)
-> Generic InputDeviceNetworkSettings
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:
--
-- 'ipAddress', 'inputDeviceNetworkSettings_ipAddress' - The IP address of the input device.
--
-- 'gateway', 'inputDeviceNetworkSettings_gateway' - The network gateway IP address.
--
-- 'dnsAddresses', 'inputDeviceNetworkSettings_dnsAddresses' - The DNS addresses 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' :: Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe InputDeviceIpScheme
-> Maybe Text
-> InputDeviceNetworkSettings
InputDeviceNetworkSettings'
    { $sel:ipAddress:InputDeviceNetworkSettings' :: Maybe Text
ipAddress =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gateway:InputDeviceNetworkSettings' :: Maybe Text
gateway = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dnsAddresses:InputDeviceNetworkSettings' :: Maybe [Text]
dnsAddresses = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:ipScheme:InputDeviceNetworkSettings' :: Maybe InputDeviceIpScheme
ipScheme = Maybe InputDeviceIpScheme
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetMask:InputDeviceNetworkSettings' :: Maybe Text
subnetMask = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The IP address of the input device.
inputDeviceNetworkSettings_ipAddress :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe Prelude.Text)
inputDeviceNetworkSettings_ipAddress :: (Maybe Text -> f (Maybe Text))
-> InputDeviceNetworkSettings -> f InputDeviceNetworkSettings
inputDeviceNetworkSettings_ipAddress = (InputDeviceNetworkSettings -> Maybe Text)
-> (InputDeviceNetworkSettings
    -> Maybe Text -> InputDeviceNetworkSettings)
-> Lens
     InputDeviceNetworkSettings
     InputDeviceNetworkSettings
     (Maybe Text)
     (Maybe Text)
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)

-- | The network gateway IP address.
inputDeviceNetworkSettings_gateway :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe Prelude.Text)
inputDeviceNetworkSettings_gateway :: (Maybe Text -> f (Maybe Text))
-> InputDeviceNetworkSettings -> f InputDeviceNetworkSettings
inputDeviceNetworkSettings_gateway = (InputDeviceNetworkSettings -> Maybe Text)
-> (InputDeviceNetworkSettings
    -> Maybe Text -> InputDeviceNetworkSettings)
-> Lens
     InputDeviceNetworkSettings
     InputDeviceNetworkSettings
     (Maybe Text)
     (Maybe Text)
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 DNS addresses of the input device.
inputDeviceNetworkSettings_dnsAddresses :: Lens.Lens' InputDeviceNetworkSettings (Prelude.Maybe [Prelude.Text])
inputDeviceNetworkSettings_dnsAddresses :: (Maybe [Text] -> f (Maybe [Text]))
-> InputDeviceNetworkSettings -> f InputDeviceNetworkSettings
inputDeviceNetworkSettings_dnsAddresses = (InputDeviceNetworkSettings -> Maybe [Text])
-> (InputDeviceNetworkSettings
    -> Maybe [Text] -> InputDeviceNetworkSettings)
-> Lens
     InputDeviceNetworkSettings
     InputDeviceNetworkSettings
     (Maybe [Text])
     (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> InputDeviceNetworkSettings -> f InputDeviceNetworkSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InputDeviceNetworkSettings
-> f InputDeviceNetworkSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe InputDeviceIpScheme -> f (Maybe InputDeviceIpScheme))
-> InputDeviceNetworkSettings -> f InputDeviceNetworkSettings
inputDeviceNetworkSettings_ipScheme = (InputDeviceNetworkSettings -> Maybe InputDeviceIpScheme)
-> (InputDeviceNetworkSettings
    -> Maybe InputDeviceIpScheme -> InputDeviceNetworkSettings)
-> Lens
     InputDeviceNetworkSettings
     InputDeviceNetworkSettings
     (Maybe InputDeviceIpScheme)
     (Maybe InputDeviceIpScheme)
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 :: (Maybe Text -> f (Maybe Text))
-> InputDeviceNetworkSettings -> f InputDeviceNetworkSettings
inputDeviceNetworkSettings_subnetMask = (InputDeviceNetworkSettings -> Maybe Text)
-> (InputDeviceNetworkSettings
    -> Maybe Text -> InputDeviceNetworkSettings)
-> Lens
     InputDeviceNetworkSettings
     InputDeviceNetworkSettings
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON InputDeviceNetworkSettings where
  parseJSON :: Value -> Parser InputDeviceNetworkSettings
parseJSON =
    String
-> (Object -> Parser InputDeviceNetworkSettings)
-> Value
-> Parser InputDeviceNetworkSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputDeviceNetworkSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe InputDeviceIpScheme
-> Maybe Text
-> InputDeviceNetworkSettings
InputDeviceNetworkSettings'
            (Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe InputDeviceIpScheme
 -> Maybe Text
 -> InputDeviceNetworkSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe InputDeviceIpScheme
      -> Maybe Text
      -> InputDeviceNetworkSettings)
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 [Text]
   -> Maybe InputDeviceIpScheme
   -> Maybe Text
   -> InputDeviceNetworkSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe InputDeviceIpScheme
      -> Maybe Text
      -> InputDeviceNetworkSettings)
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
"gateway")
            Parser
  (Maybe [Text]
   -> Maybe InputDeviceIpScheme
   -> Maybe Text
   -> InputDeviceNetworkSettings)
-> Parser (Maybe [Text])
-> Parser
     (Maybe InputDeviceIpScheme
      -> Maybe Text -> InputDeviceNetworkSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dnsAddresses" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe InputDeviceIpScheme
   -> Maybe Text -> InputDeviceNetworkSettings)
-> Parser (Maybe InputDeviceIpScheme)
-> Parser (Maybe Text -> InputDeviceNetworkSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputDeviceIpScheme)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ipScheme")
            Parser (Maybe Text -> InputDeviceNetworkSettings)
-> Parser (Maybe Text) -> Parser InputDeviceNetworkSettings
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
"subnetMask")
      )

instance Prelude.Hashable InputDeviceNetworkSettings

instance Prelude.NFData InputDeviceNetworkSettings