{-# 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.HlsWebdavSettings
-- 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.HlsWebdavSettings 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.HlsWebdavHttpTransferMode
import qualified Amazonka.Prelude as Prelude

-- | Hls Webdav Settings
--
-- /See:/ 'newHlsWebdavSettings' smart constructor.
data HlsWebdavSettings = HlsWebdavSettings'
  { -- | Number of seconds to wait before retrying connection to the CDN if the
    -- connection is lost.
    HlsWebdavSettings -> Maybe Natural
connectionRetryInterval :: Prelude.Maybe Prelude.Natural,
    -- | Size in seconds of file cache for streaming outputs.
    HlsWebdavSettings -> Maybe Natural
filecacheDuration :: Prelude.Maybe Prelude.Natural,
    -- | Specify whether or not to use chunked transfer encoding to WebDAV.
    HlsWebdavSettings -> Maybe HlsWebdavHttpTransferMode
httpTransferMode :: Prelude.Maybe HlsWebdavHttpTransferMode,
    -- | Number of retry attempts that will be made before the Live Event is put
    -- into an error state.
    HlsWebdavSettings -> 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.
    HlsWebdavSettings -> Maybe Natural
restartDelay :: Prelude.Maybe Prelude.Natural
  }
  deriving (HlsWebdavSettings -> HlsWebdavSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsWebdavSettings -> HlsWebdavSettings -> Bool
$c/= :: HlsWebdavSettings -> HlsWebdavSettings -> Bool
== :: HlsWebdavSettings -> HlsWebdavSettings -> Bool
$c== :: HlsWebdavSettings -> HlsWebdavSettings -> Bool
Prelude.Eq, ReadPrec [HlsWebdavSettings]
ReadPrec HlsWebdavSettings
Int -> ReadS HlsWebdavSettings
ReadS [HlsWebdavSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsWebdavSettings]
$creadListPrec :: ReadPrec [HlsWebdavSettings]
readPrec :: ReadPrec HlsWebdavSettings
$creadPrec :: ReadPrec HlsWebdavSettings
readList :: ReadS [HlsWebdavSettings]
$creadList :: ReadS [HlsWebdavSettings]
readsPrec :: Int -> ReadS HlsWebdavSettings
$creadsPrec :: Int -> ReadS HlsWebdavSettings
Prelude.Read, Int -> HlsWebdavSettings -> ShowS
[HlsWebdavSettings] -> ShowS
HlsWebdavSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsWebdavSettings] -> ShowS
$cshowList :: [HlsWebdavSettings] -> ShowS
show :: HlsWebdavSettings -> String
$cshow :: HlsWebdavSettings -> String
showsPrec :: Int -> HlsWebdavSettings -> ShowS
$cshowsPrec :: Int -> HlsWebdavSettings -> ShowS
Prelude.Show, forall x. Rep HlsWebdavSettings x -> HlsWebdavSettings
forall x. HlsWebdavSettings -> Rep HlsWebdavSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsWebdavSettings x -> HlsWebdavSettings
$cfrom :: forall x. HlsWebdavSettings -> Rep HlsWebdavSettings x
Prelude.Generic)

-- |
-- Create a value of 'HlsWebdavSettings' 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', 'hlsWebdavSettings_connectionRetryInterval' - Number of seconds to wait before retrying connection to the CDN if the
-- connection is lost.
--
-- 'filecacheDuration', 'hlsWebdavSettings_filecacheDuration' - Size in seconds of file cache for streaming outputs.
--
-- 'httpTransferMode', 'hlsWebdavSettings_httpTransferMode' - Specify whether or not to use chunked transfer encoding to WebDAV.
--
-- 'numRetries', 'hlsWebdavSettings_numRetries' - Number of retry attempts that will be made before the Live Event is put
-- into an error state.
--
-- 'restartDelay', 'hlsWebdavSettings_restartDelay' - If a streaming output fails, number of seconds to wait until a restart
-- is initiated. A value of 0 means never restart.
newHlsWebdavSettings ::
  HlsWebdavSettings
newHlsWebdavSettings :: HlsWebdavSettings
newHlsWebdavSettings =
  HlsWebdavSettings'
    { $sel:connectionRetryInterval:HlsWebdavSettings' :: Maybe Natural
connectionRetryInterval =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filecacheDuration:HlsWebdavSettings' :: Maybe Natural
filecacheDuration = forall a. Maybe a
Prelude.Nothing,
      $sel:httpTransferMode:HlsWebdavSettings' :: Maybe HlsWebdavHttpTransferMode
httpTransferMode = forall a. Maybe a
Prelude.Nothing,
      $sel:numRetries:HlsWebdavSettings' :: Maybe Natural
numRetries = forall a. Maybe a
Prelude.Nothing,
      $sel:restartDelay:HlsWebdavSettings' :: 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.
hlsWebdavSettings_connectionRetryInterval :: Lens.Lens' HlsWebdavSettings (Prelude.Maybe Prelude.Natural)
hlsWebdavSettings_connectionRetryInterval :: Lens' HlsWebdavSettings (Maybe Natural)
hlsWebdavSettings_connectionRetryInterval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsWebdavSettings' {Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:connectionRetryInterval:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
connectionRetryInterval} -> Maybe Natural
connectionRetryInterval) (\s :: HlsWebdavSettings
s@HlsWebdavSettings' {} Maybe Natural
a -> HlsWebdavSettings
s {$sel:connectionRetryInterval:HlsWebdavSettings' :: Maybe Natural
connectionRetryInterval = Maybe Natural
a} :: HlsWebdavSettings)

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

-- | Specify whether or not to use chunked transfer encoding to WebDAV.
hlsWebdavSettings_httpTransferMode :: Lens.Lens' HlsWebdavSettings (Prelude.Maybe HlsWebdavHttpTransferMode)
hlsWebdavSettings_httpTransferMode :: Lens' HlsWebdavSettings (Maybe HlsWebdavHttpTransferMode)
hlsWebdavSettings_httpTransferMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsWebdavSettings' {Maybe HlsWebdavHttpTransferMode
httpTransferMode :: Maybe HlsWebdavHttpTransferMode
$sel:httpTransferMode:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe HlsWebdavHttpTransferMode
httpTransferMode} -> Maybe HlsWebdavHttpTransferMode
httpTransferMode) (\s :: HlsWebdavSettings
s@HlsWebdavSettings' {} Maybe HlsWebdavHttpTransferMode
a -> HlsWebdavSettings
s {$sel:httpTransferMode:HlsWebdavSettings' :: Maybe HlsWebdavHttpTransferMode
httpTransferMode = Maybe HlsWebdavHttpTransferMode
a} :: HlsWebdavSettings)

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

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

instance Data.FromJSON HlsWebdavSettings where
  parseJSON :: Value -> Parser HlsWebdavSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HlsWebdavSettings"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Maybe HlsWebdavHttpTransferMode
-> Maybe Natural
-> Maybe Natural
-> HlsWebdavSettings
HlsWebdavSettings'
            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
"httpTransferMode")
            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 HlsWebdavSettings where
  hashWithSalt :: Int -> HlsWebdavSettings -> Int
hashWithSalt Int
_salt HlsWebdavSettings' {Maybe Natural
Maybe HlsWebdavHttpTransferMode
restartDelay :: Maybe Natural
numRetries :: Maybe Natural
httpTransferMode :: Maybe HlsWebdavHttpTransferMode
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:restartDelay:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:numRetries:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:httpTransferMode:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe HlsWebdavHttpTransferMode
$sel:filecacheDuration:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsWebdavSettings' :: HlsWebdavSettings -> 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 HlsWebdavHttpTransferMode
httpTransferMode
      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 HlsWebdavSettings where
  rnf :: HlsWebdavSettings -> ()
rnf HlsWebdavSettings' {Maybe Natural
Maybe HlsWebdavHttpTransferMode
restartDelay :: Maybe Natural
numRetries :: Maybe Natural
httpTransferMode :: Maybe HlsWebdavHttpTransferMode
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:restartDelay:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:numRetries:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:httpTransferMode:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe HlsWebdavHttpTransferMode
$sel:filecacheDuration:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsWebdavSettings' :: HlsWebdavSettings -> 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 HlsWebdavHttpTransferMode
httpTransferMode
      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 HlsWebdavSettings where
  toJSON :: HlsWebdavSettings -> Value
toJSON HlsWebdavSettings' {Maybe Natural
Maybe HlsWebdavHttpTransferMode
restartDelay :: Maybe Natural
numRetries :: Maybe Natural
httpTransferMode :: Maybe HlsWebdavHttpTransferMode
filecacheDuration :: Maybe Natural
connectionRetryInterval :: Maybe Natural
$sel:restartDelay:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:numRetries:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:httpTransferMode:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe HlsWebdavHttpTransferMode
$sel:filecacheDuration:HlsWebdavSettings' :: HlsWebdavSettings -> Maybe Natural
$sel:connectionRetryInterval:HlsWebdavSettings' :: HlsWebdavSettings -> 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
"httpTransferMode" 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 HlsWebdavHttpTransferMode
httpTransferMode,
            (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
          ]
      )