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

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

-- | Hls Basic Put Settings
--
-- /See:/ 'newHlsBasicPutSettings' smart constructor.
data HlsBasicPutSettings = HlsBasicPutSettings'
  { -- | 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,
    -- | 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,
    -- | 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
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]
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
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. 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:
--
-- '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.
--
-- 'numRetries', 'hlsBasicPutSettings_numRetries' - Number of retry attempts that will be made before the Live Event is put
-- into an error state.
--
-- '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'
    { $sel:connectionRetryInterval:HlsBasicPutSettings' :: Maybe Natural
connectionRetryInterval =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filecacheDuration:HlsBasicPutSettings' :: Maybe Natural
filecacheDuration = forall a. Maybe a
Prelude.Nothing,
      $sel:numRetries:HlsBasicPutSettings' :: Maybe Natural
numRetries = forall a. Maybe a
Prelude.Nothing,
      $sel:restartDelay:HlsBasicPutSettings' :: Maybe Natural
restartDelay = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' HlsBasicPutSettings (Maybe Natural)
hlsBasicPutSettings_connectionRetryInterval = 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 :: Lens' HlsBasicPutSettings (Maybe Natural)
hlsBasicPutSettings_filecacheDuration = 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)

-- | 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 :: Lens' HlsBasicPutSettings (Maybe Natural)
hlsBasicPutSettings_numRetries = 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)

-- | 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 :: Lens' HlsBasicPutSettings (Maybe Natural)
hlsBasicPutSettings_restartDelay = 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 Data.FromJSON HlsBasicPutSettings where
  parseJSON :: Value -> Parser HlsBasicPutSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HlsBasicPutSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> HlsBasicPutSettings
HlsBasicPutSettings'
            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
"connectionRetryInterval")
            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
"filecacheDuration")
            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
"numRetries")
            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
"restartDelay")
      )

instance Prelude.Hashable HlsBasicPutSettings where
  hashWithSalt :: Int -> HlsBasicPutSettings -> Int
hashWithSalt Int
_salt HlsBasicPutSettings' {Maybe Natural
restartDelay :: Maybe Natural
numRetries :: Maybe Natural
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:restartDelay:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:numRetries:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:filecacheDuration:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
connectionRetryInterval
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
filecacheDuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
numRetries
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
restartDelay

instance Prelude.NFData HlsBasicPutSettings where
  rnf :: HlsBasicPutSettings -> ()
rnf HlsBasicPutSettings' {Maybe Natural
restartDelay :: Maybe Natural
numRetries :: Maybe Natural
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:restartDelay:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:numRetries:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:filecacheDuration:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
connectionRetryInterval
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
filecacheDuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
numRetries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
restartDelay

instance Data.ToJSON HlsBasicPutSettings where
  toJSON :: HlsBasicPutSettings -> Value
toJSON HlsBasicPutSettings' {Maybe Natural
restartDelay :: Maybe Natural
numRetries :: Maybe Natural
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:restartDelay:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:numRetries:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:filecacheDuration:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsBasicPutSettings' :: HlsBasicPutSettings -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"connectionRetryInterval" 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 Natural
connectionRetryInterval,
            (Key
"filecacheDuration" 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 Natural
filecacheDuration,
            (Key
"numRetries" 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 Natural
numRetries,
            (Key
"restartDelay" 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 Natural
restartDelay
          ]
      )