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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Hls Basic Put Settings
--
-- /See:/ 'newHlsBasicPutSettings' smart constructor.
data HlsBasicPutSettings = HlsBasicPutSettings'
  { -- | Number of retry attempts that will be made before the Live Event is put
    -- into an error state.
    HlsBasicPutSettings -> Maybe Natural
numRetries :: Prelude.Maybe Prelude.Natural,
    -- | Number of seconds to wait before retrying connection to the CDN if the
    -- connection is lost.
    HlsBasicPutSettings -> Maybe Natural
connectionRetryInterval :: Prelude.Maybe Prelude.Natural,
    -- | Size in seconds of file cache for streaming outputs.
    HlsBasicPutSettings -> Maybe Natural
filecacheDuration :: Prelude.Maybe Prelude.Natural,
    -- | If a streaming output fails, number of seconds to wait until a restart
    -- is initiated. A value of 0 means never restart.
    HlsBasicPutSettings -> Maybe Natural
restartDelay :: Prelude.Maybe Prelude.Natural
  }
  deriving (HlsBasicPutSettings -> HlsBasicPutSettings -> Bool
(HlsBasicPutSettings -> HlsBasicPutSettings -> Bool)
-> (HlsBasicPutSettings -> HlsBasicPutSettings -> Bool)
-> Eq HlsBasicPutSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsBasicPutSettings -> HlsBasicPutSettings -> Bool
$c/= :: HlsBasicPutSettings -> HlsBasicPutSettings -> Bool
== :: HlsBasicPutSettings -> HlsBasicPutSettings -> Bool
$c== :: HlsBasicPutSettings -> HlsBasicPutSettings -> Bool
Prelude.Eq, ReadPrec [HlsBasicPutSettings]
ReadPrec HlsBasicPutSettings
Int -> ReadS HlsBasicPutSettings
ReadS [HlsBasicPutSettings]
(Int -> ReadS HlsBasicPutSettings)
-> ReadS [HlsBasicPutSettings]
-> ReadPrec HlsBasicPutSettings
-> ReadPrec [HlsBasicPutSettings]
-> Read HlsBasicPutSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsBasicPutSettings]
$creadListPrec :: ReadPrec [HlsBasicPutSettings]
readPrec :: ReadPrec HlsBasicPutSettings
$creadPrec :: ReadPrec HlsBasicPutSettings
readList :: ReadS [HlsBasicPutSettings]
$creadList :: ReadS [HlsBasicPutSettings]
readsPrec :: Int -> ReadS HlsBasicPutSettings
$creadsPrec :: Int -> ReadS HlsBasicPutSettings
Prelude.Read, Int -> HlsBasicPutSettings -> ShowS
[HlsBasicPutSettings] -> ShowS
HlsBasicPutSettings -> String
(Int -> HlsBasicPutSettings -> ShowS)
-> (HlsBasicPutSettings -> String)
-> ([HlsBasicPutSettings] -> ShowS)
-> Show HlsBasicPutSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsBasicPutSettings] -> ShowS
$cshowList :: [HlsBasicPutSettings] -> ShowS
show :: HlsBasicPutSettings -> String
$cshow :: HlsBasicPutSettings -> String
showsPrec :: Int -> HlsBasicPutSettings -> ShowS
$cshowsPrec :: Int -> HlsBasicPutSettings -> ShowS
Prelude.Show, (forall x. HlsBasicPutSettings -> Rep HlsBasicPutSettings x)
-> (forall x. Rep HlsBasicPutSettings x -> HlsBasicPutSettings)
-> Generic HlsBasicPutSettings
forall x. Rep HlsBasicPutSettings x -> HlsBasicPutSettings
forall x. HlsBasicPutSettings -> Rep HlsBasicPutSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsBasicPutSettings x -> HlsBasicPutSettings
$cfrom :: forall x. HlsBasicPutSettings -> Rep HlsBasicPutSettings x
Prelude.Generic)

-- |
-- Create a value of 'HlsBasicPutSettings' 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:
--
-- 'numRetries', 'hlsBasicPutSettings_numRetries' - Number of retry attempts that will be made before the Live Event is put
-- into an error state.
--
-- 'connectionRetryInterval', 'hlsBasicPutSettings_connectionRetryInterval' - Number of seconds to wait before retrying connection to the CDN if the
-- connection is lost.
--
-- 'filecacheDuration', 'hlsBasicPutSettings_filecacheDuration' - Size in seconds of file cache for streaming outputs.
--
-- 'restartDelay', 'hlsBasicPutSettings_restartDelay' - If a streaming output fails, number of seconds to wait until a restart
-- is initiated. A value of 0 means never restart.
newHlsBasicPutSettings ::
  HlsBasicPutSettings
newHlsBasicPutSettings :: HlsBasicPutSettings
newHlsBasicPutSettings =
  HlsBasicPutSettings' :: Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> HlsBasicPutSettings
HlsBasicPutSettings'
    { $sel:numRetries:HlsBasicPutSettings' :: Maybe Natural
numRetries = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionRetryInterval:HlsBasicPutSettings' :: Maybe Natural
connectionRetryInterval = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:filecacheDuration:HlsBasicPutSettings' :: Maybe Natural
filecacheDuration = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:restartDelay:HlsBasicPutSettings' :: Maybe Natural
restartDelay = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Number of retry attempts that will be made before the Live Event is put
-- into an error state.
hlsBasicPutSettings_numRetries :: Lens.Lens' HlsBasicPutSettings (Prelude.Maybe Prelude.Natural)
hlsBasicPutSettings_numRetries :: (Maybe Natural -> f (Maybe Natural))
-> HlsBasicPutSettings -> f HlsBasicPutSettings
hlsBasicPutSettings_numRetries = (HlsBasicPutSettings -> Maybe Natural)
-> (HlsBasicPutSettings -> Maybe Natural -> HlsBasicPutSettings)
-> Lens
     HlsBasicPutSettings
     HlsBasicPutSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsBasicPutSettings' {Maybe Natural
numRetries :: Maybe Natural
$sel:numRetries:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
numRetries} -> Maybe Natural
numRetries) (\s :: HlsBasicPutSettings
s@HlsBasicPutSettings' {} Maybe Natural
a -> HlsBasicPutSettings
s {$sel:numRetries:HlsBasicPutSettings' :: Maybe Natural
numRetries = Maybe Natural
a} :: HlsBasicPutSettings)

-- | Number of seconds to wait before retrying connection to the CDN if the
-- connection is lost.
hlsBasicPutSettings_connectionRetryInterval :: Lens.Lens' HlsBasicPutSettings (Prelude.Maybe Prelude.Natural)
hlsBasicPutSettings_connectionRetryInterval :: (Maybe Natural -> f (Maybe Natural))
-> HlsBasicPutSettings -> f HlsBasicPutSettings
hlsBasicPutSettings_connectionRetryInterval = (HlsBasicPutSettings -> Maybe Natural)
-> (HlsBasicPutSettings -> Maybe Natural -> HlsBasicPutSettings)
-> Lens
     HlsBasicPutSettings
     HlsBasicPutSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsBasicPutSettings' {Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:connectionRetryInterval:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
connectionRetryInterval} -> Maybe Natural
connectionRetryInterval) (\s :: HlsBasicPutSettings
s@HlsBasicPutSettings' {} Maybe Natural
a -> HlsBasicPutSettings
s {$sel:connectionRetryInterval:HlsBasicPutSettings' :: Maybe Natural
connectionRetryInterval = Maybe Natural
a} :: HlsBasicPutSettings)

-- | Size in seconds of file cache for streaming outputs.
hlsBasicPutSettings_filecacheDuration :: Lens.Lens' HlsBasicPutSettings (Prelude.Maybe Prelude.Natural)
hlsBasicPutSettings_filecacheDuration :: (Maybe Natural -> f (Maybe Natural))
-> HlsBasicPutSettings -> f HlsBasicPutSettings
hlsBasicPutSettings_filecacheDuration = (HlsBasicPutSettings -> Maybe Natural)
-> (HlsBasicPutSettings -> Maybe Natural -> HlsBasicPutSettings)
-> Lens
     HlsBasicPutSettings
     HlsBasicPutSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsBasicPutSettings' {Maybe Natural
filecacheDuration :: Maybe Natural
$sel:filecacheDuration:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
filecacheDuration} -> Maybe Natural
filecacheDuration) (\s :: HlsBasicPutSettings
s@HlsBasicPutSettings' {} Maybe Natural
a -> HlsBasicPutSettings
s {$sel:filecacheDuration:HlsBasicPutSettings' :: Maybe Natural
filecacheDuration = Maybe Natural
a} :: HlsBasicPutSettings)

-- | If a streaming output fails, number of seconds to wait until a restart
-- is initiated. A value of 0 means never restart.
hlsBasicPutSettings_restartDelay :: Lens.Lens' HlsBasicPutSettings (Prelude.Maybe Prelude.Natural)
hlsBasicPutSettings_restartDelay :: (Maybe Natural -> f (Maybe Natural))
-> HlsBasicPutSettings -> f HlsBasicPutSettings
hlsBasicPutSettings_restartDelay = (HlsBasicPutSettings -> Maybe Natural)
-> (HlsBasicPutSettings -> Maybe Natural -> HlsBasicPutSettings)
-> Lens
     HlsBasicPutSettings
     HlsBasicPutSettings
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsBasicPutSettings' {Maybe Natural
restartDelay :: Maybe Natural
$sel:restartDelay:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
restartDelay} -> Maybe Natural
restartDelay) (\s :: HlsBasicPutSettings
s@HlsBasicPutSettings' {} Maybe Natural
a -> HlsBasicPutSettings
s {$sel:restartDelay:HlsBasicPutSettings' :: Maybe Natural
restartDelay = Maybe Natural
a} :: HlsBasicPutSettings)

instance Core.FromJSON HlsBasicPutSettings where
  parseJSON :: Value -> Parser HlsBasicPutSettings
parseJSON =
    String
-> (Object -> Parser HlsBasicPutSettings)
-> Value
-> Parser HlsBasicPutSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsBasicPutSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> HlsBasicPutSettings
HlsBasicPutSettings'
            (Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> HlsBasicPutSettings)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Natural -> Maybe Natural -> HlsBasicPutSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"numRetries")
            Parser
  (Maybe Natural
   -> Maybe Natural -> Maybe Natural -> HlsBasicPutSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> HlsBasicPutSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"connectionRetryInterval")
            Parser (Maybe Natural -> Maybe Natural -> HlsBasicPutSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> HlsBasicPutSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"filecacheDuration")
            Parser (Maybe Natural -> HlsBasicPutSettings)
-> Parser (Maybe Natural) -> Parser HlsBasicPutSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"restartDelay")
      )

instance Prelude.Hashable HlsBasicPutSettings

instance Prelude.NFData HlsBasicPutSettings

instance Core.ToJSON HlsBasicPutSettings where
  toJSON :: HlsBasicPutSettings -> Value
toJSON HlsBasicPutSettings' {Maybe Natural
restartDelay :: Maybe Natural
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
numRetries :: Maybe Natural
$sel:restartDelay:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:filecacheDuration:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:numRetries:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"numRetries" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
numRetries,
            (Text
"connectionRetryInterval" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
connectionRetryInterval,
            (Text
"filecacheDuration" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
filecacheDuration,
            (Text
"restartDelay" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
restartDelay
          ]
      )