{-# 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-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.NetworkInputSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(NetworkInputSettings -> NetworkInputSettings -> Bool)
-> (NetworkInputSettings -> NetworkInputSettings -> Bool)
-> Eq NetworkInputSettings
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]
(Int -> ReadS NetworkInputSettings)
-> ReadS [NetworkInputSettings]
-> ReadPrec NetworkInputSettings
-> ReadPrec [NetworkInputSettings]
-> Read 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
(Int -> NetworkInputSettings -> ShowS)
-> (NetworkInputSettings -> String)
-> ([NetworkInputSettings] -> ShowS)
-> Show NetworkInputSettings
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. NetworkInputSettings -> Rep NetworkInputSettings x)
-> (forall x. Rep NetworkInputSettings x -> NetworkInputSettings)
-> Generic NetworkInputSettings
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' :: Maybe HlsInputSettings
-> Maybe NetworkInputServerValidation -> NetworkInputSettings
NetworkInputSettings'
    { $sel:hlsInputSettings:NetworkInputSettings' :: Maybe HlsInputSettings
hlsInputSettings =
        Maybe HlsInputSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:serverValidation:NetworkInputSettings' :: Maybe NetworkInputServerValidation
serverValidation = Maybe NetworkInputServerValidation
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 :: (Maybe HlsInputSettings -> f (Maybe HlsInputSettings))
-> NetworkInputSettings -> f NetworkInputSettings
networkInputSettings_hlsInputSettings = (NetworkInputSettings -> Maybe HlsInputSettings)
-> (NetworkInputSettings
    -> Maybe HlsInputSettings -> NetworkInputSettings)
-> Lens
     NetworkInputSettings
     NetworkInputSettings
     (Maybe HlsInputSettings)
     (Maybe 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 :: (Maybe NetworkInputServerValidation
 -> f (Maybe NetworkInputServerValidation))
-> NetworkInputSettings -> f NetworkInputSettings
networkInputSettings_serverValidation = (NetworkInputSettings -> Maybe NetworkInputServerValidation)
-> (NetworkInputSettings
    -> Maybe NetworkInputServerValidation -> NetworkInputSettings)
-> Lens
     NetworkInputSettings
     NetworkInputSettings
     (Maybe NetworkInputServerValidation)
     (Maybe NetworkInputServerValidation)
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 Core.FromJSON NetworkInputSettings where
  parseJSON :: Value -> Parser NetworkInputSettings
parseJSON =
    String
-> (Object -> Parser NetworkInputSettings)
-> Value
-> Parser NetworkInputSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NetworkInputSettings"
      ( \Object
x ->
          Maybe HlsInputSettings
-> Maybe NetworkInputServerValidation -> NetworkInputSettings
NetworkInputSettings'
            (Maybe HlsInputSettings
 -> Maybe NetworkInputServerValidation -> NetworkInputSettings)
-> Parser (Maybe HlsInputSettings)
-> Parser
     (Maybe NetworkInputServerValidation -> NetworkInputSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HlsInputSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hlsInputSettings")
            Parser (Maybe NetworkInputServerValidation -> NetworkInputSettings)
-> Parser (Maybe NetworkInputServerValidation)
-> Parser NetworkInputSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NetworkInputServerValidation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serverValidation")
      )

instance Prelude.Hashable NetworkInputSettings

instance Prelude.NFData NetworkInputSettings

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"hlsInputSettings" Text -> HlsInputSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HlsInputSettings -> Pair) -> Maybe HlsInputSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsInputSettings
hlsInputSettings,
            (Text
"serverValidation" Text -> NetworkInputServerValidation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NetworkInputServerValidation -> Pair)
-> Maybe NetworkInputServerValidation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkInputServerValidation
serverValidation
          ]
      )