{-# 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.NetworkInputSettings
-- 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.NetworkInputSettings 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.HlsInputSettings
import Amazonka.MediaLive.Types.NetworkInputServerValidation
import qualified Amazonka.Prelude as Prelude

-- | Network source to transcode. Must be accessible to the Elemental Live
-- node that is running the live event through a network connection.
--
-- /See:/ 'newNetworkInputSettings' smart constructor.
data NetworkInputSettings = NetworkInputSettings'
  { -- | Specifies HLS input settings when the uri is for a HLS manifest.
    NetworkInputSettings -> Maybe HlsInputSettings
hlsInputSettings :: Prelude.Maybe HlsInputSettings,
    -- | Check HTTPS server certificates. When set to checkCryptographyOnly,
    -- cryptography in the certificate will be checked, but not the server\'s
    -- name. Certain subdomains (notably S3 buckets that use dots in the bucket
    -- name) do not strictly match the corresponding certificate\'s wildcard
    -- pattern and would otherwise cause the event to error. This setting is
    -- ignored for protocols that do not use https.
    NetworkInputSettings -> Maybe NetworkInputServerValidation
serverValidation :: Prelude.Maybe NetworkInputServerValidation
  }
  deriving (NetworkInputSettings -> NetworkInputSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkInputSettings -> NetworkInputSettings -> Bool
$c/= :: NetworkInputSettings -> NetworkInputSettings -> Bool
== :: NetworkInputSettings -> NetworkInputSettings -> Bool
$c== :: NetworkInputSettings -> NetworkInputSettings -> Bool
Prelude.Eq, ReadPrec [NetworkInputSettings]
ReadPrec NetworkInputSettings
Int -> ReadS NetworkInputSettings
ReadS [NetworkInputSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkInputSettings]
$creadListPrec :: ReadPrec [NetworkInputSettings]
readPrec :: ReadPrec NetworkInputSettings
$creadPrec :: ReadPrec NetworkInputSettings
readList :: ReadS [NetworkInputSettings]
$creadList :: ReadS [NetworkInputSettings]
readsPrec :: Int -> ReadS NetworkInputSettings
$creadsPrec :: Int -> ReadS NetworkInputSettings
Prelude.Read, Int -> NetworkInputSettings -> ShowS
[NetworkInputSettings] -> ShowS
NetworkInputSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkInputSettings] -> ShowS
$cshowList :: [NetworkInputSettings] -> ShowS
show :: NetworkInputSettings -> String
$cshow :: NetworkInputSettings -> String
showsPrec :: Int -> NetworkInputSettings -> ShowS
$cshowsPrec :: Int -> NetworkInputSettings -> ShowS
Prelude.Show, forall x. Rep NetworkInputSettings x -> NetworkInputSettings
forall x. NetworkInputSettings -> Rep NetworkInputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkInputSettings x -> NetworkInputSettings
$cfrom :: forall x. NetworkInputSettings -> Rep NetworkInputSettings x
Prelude.Generic)

-- |
-- Create a value of 'NetworkInputSettings' 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:
--
-- 'hlsInputSettings', 'networkInputSettings_hlsInputSettings' - Specifies HLS input settings when the uri is for a HLS manifest.
--
-- 'serverValidation', 'networkInputSettings_serverValidation' - Check HTTPS server certificates. When set to checkCryptographyOnly,
-- cryptography in the certificate will be checked, but not the server\'s
-- name. Certain subdomains (notably S3 buckets that use dots in the bucket
-- name) do not strictly match the corresponding certificate\'s wildcard
-- pattern and would otherwise cause the event to error. This setting is
-- ignored for protocols that do not use https.
newNetworkInputSettings ::
  NetworkInputSettings
newNetworkInputSettings :: NetworkInputSettings
newNetworkInputSettings =
  NetworkInputSettings'
    { $sel:hlsInputSettings:NetworkInputSettings' :: Maybe HlsInputSettings
hlsInputSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:serverValidation:NetworkInputSettings' :: Maybe NetworkInputServerValidation
serverValidation = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies HLS input settings when the uri is for a HLS manifest.
networkInputSettings_hlsInputSettings :: Lens.Lens' NetworkInputSettings (Prelude.Maybe HlsInputSettings)
networkInputSettings_hlsInputSettings :: Lens' NetworkInputSettings (Maybe HlsInputSettings)
networkInputSettings_hlsInputSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInputSettings' {Maybe HlsInputSettings
hlsInputSettings :: Maybe HlsInputSettings
$sel:hlsInputSettings:NetworkInputSettings' :: NetworkInputSettings -> Maybe HlsInputSettings
hlsInputSettings} -> Maybe HlsInputSettings
hlsInputSettings) (\s :: NetworkInputSettings
s@NetworkInputSettings' {} Maybe HlsInputSettings
a -> NetworkInputSettings
s {$sel:hlsInputSettings:NetworkInputSettings' :: Maybe HlsInputSettings
hlsInputSettings = Maybe HlsInputSettings
a} :: NetworkInputSettings)

-- | Check HTTPS server certificates. When set to checkCryptographyOnly,
-- cryptography in the certificate will be checked, but not the server\'s
-- name. Certain subdomains (notably S3 buckets that use dots in the bucket
-- name) do not strictly match the corresponding certificate\'s wildcard
-- pattern and would otherwise cause the event to error. This setting is
-- ignored for protocols that do not use https.
networkInputSettings_serverValidation :: Lens.Lens' NetworkInputSettings (Prelude.Maybe NetworkInputServerValidation)
networkInputSettings_serverValidation :: Lens' NetworkInputSettings (Maybe NetworkInputServerValidation)
networkInputSettings_serverValidation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInputSettings' {Maybe NetworkInputServerValidation
serverValidation :: Maybe NetworkInputServerValidation
$sel:serverValidation:NetworkInputSettings' :: NetworkInputSettings -> Maybe NetworkInputServerValidation
serverValidation} -> Maybe NetworkInputServerValidation
serverValidation) (\s :: NetworkInputSettings
s@NetworkInputSettings' {} Maybe NetworkInputServerValidation
a -> NetworkInputSettings
s {$sel:serverValidation:NetworkInputSettings' :: Maybe NetworkInputServerValidation
serverValidation = Maybe NetworkInputServerValidation
a} :: NetworkInputSettings)

instance Data.FromJSON NetworkInputSettings where
  parseJSON :: Value -> Parser NetworkInputSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkInputSettings"
      ( \Object
x ->
          Maybe HlsInputSettings
-> Maybe NetworkInputServerValidation -> NetworkInputSettings
NetworkInputSettings'
            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
"hlsInputSettings")
            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
"serverValidation")
      )

instance Prelude.Hashable NetworkInputSettings where
  hashWithSalt :: Int -> NetworkInputSettings -> Int
hashWithSalt Int
_salt NetworkInputSettings' {Maybe HlsInputSettings
Maybe NetworkInputServerValidation
serverValidation :: Maybe NetworkInputServerValidation
hlsInputSettings :: Maybe HlsInputSettings
$sel:serverValidation:NetworkInputSettings' :: NetworkInputSettings -> Maybe NetworkInputServerValidation
$sel:hlsInputSettings:NetworkInputSettings' :: NetworkInputSettings -> Maybe HlsInputSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HlsInputSettings
hlsInputSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NetworkInputServerValidation
serverValidation

instance Prelude.NFData NetworkInputSettings where
  rnf :: NetworkInputSettings -> ()
rnf NetworkInputSettings' {Maybe HlsInputSettings
Maybe NetworkInputServerValidation
serverValidation :: Maybe NetworkInputServerValidation
hlsInputSettings :: Maybe HlsInputSettings
$sel:serverValidation:NetworkInputSettings' :: NetworkInputSettings -> Maybe NetworkInputServerValidation
$sel:hlsInputSettings:NetworkInputSettings' :: NetworkInputSettings -> Maybe HlsInputSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HlsInputSettings
hlsInputSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkInputServerValidation
serverValidation

instance Data.ToJSON NetworkInputSettings where
  toJSON :: NetworkInputSettings -> Value
toJSON NetworkInputSettings' {Maybe HlsInputSettings
Maybe NetworkInputServerValidation
serverValidation :: Maybe NetworkInputServerValidation
hlsInputSettings :: Maybe HlsInputSettings
$sel:serverValidation:NetworkInputSettings' :: NetworkInputSettings -> Maybe NetworkInputServerValidation
$sel:hlsInputSettings:NetworkInputSettings' :: NetworkInputSettings -> Maybe HlsInputSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"hlsInputSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsInputSettings
hlsInputSettings,
            (Key
"serverValidation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkInputServerValidation
serverValidation
          ]
      )