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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.HlsWebdavHttpTransferMode
import qualified Amazonka.Prelude as Prelude

-- | Hls Webdav Settings
--
-- /See:/ 'newHlsWebdavSettings' smart constructor.
data HlsWebdavSettings = HlsWebdavSettings'
  { -- | 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,
    -- | 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,
    -- | 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
(HlsWebdavSettings -> HlsWebdavSettings -> Bool)
-> (HlsWebdavSettings -> HlsWebdavSettings -> Bool)
-> Eq HlsWebdavSettings
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]
(Int -> ReadS HlsWebdavSettings)
-> ReadS [HlsWebdavSettings]
-> ReadPrec HlsWebdavSettings
-> ReadPrec [HlsWebdavSettings]
-> Read 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
(Int -> HlsWebdavSettings -> ShowS)
-> (HlsWebdavSettings -> String)
-> ([HlsWebdavSettings] -> ShowS)
-> Show HlsWebdavSettings
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. HlsWebdavSettings -> Rep HlsWebdavSettings x)
-> (forall x. Rep HlsWebdavSettings x -> HlsWebdavSettings)
-> Generic HlsWebdavSettings
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:
--
-- '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.
--
-- '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.
--
-- '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' :: Maybe HlsWebdavHttpTransferMode
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> HlsWebdavSettings
HlsWebdavSettings'
    { $sel:httpTransferMode:HlsWebdavSettings' :: Maybe HlsWebdavHttpTransferMode
httpTransferMode =
        Maybe HlsWebdavHttpTransferMode
forall a. Maybe a
Prelude.Nothing,
      $sel:numRetries:HlsWebdavSettings' :: Maybe Natural
numRetries = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionRetryInterval:HlsWebdavSettings' :: Maybe Natural
connectionRetryInterval = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:filecacheDuration:HlsWebdavSettings' :: Maybe Natural
filecacheDuration = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:restartDelay:HlsWebdavSettings' :: Maybe Natural
restartDelay = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify whether or not to use chunked transfer encoding to WebDAV.
hlsWebdavSettings_httpTransferMode :: Lens.Lens' HlsWebdavSettings (Prelude.Maybe HlsWebdavHttpTransferMode)
hlsWebdavSettings_httpTransferMode :: (Maybe HlsWebdavHttpTransferMode
 -> f (Maybe HlsWebdavHttpTransferMode))
-> HlsWebdavSettings -> f HlsWebdavSettings
hlsWebdavSettings_httpTransferMode = (HlsWebdavSettings -> Maybe HlsWebdavHttpTransferMode)
-> (HlsWebdavSettings
    -> Maybe HlsWebdavHttpTransferMode -> HlsWebdavSettings)
-> Lens
     HlsWebdavSettings
     HlsWebdavSettings
     (Maybe HlsWebdavHttpTransferMode)
     (Maybe HlsWebdavHttpTransferMode)
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 :: (Maybe Natural -> f (Maybe Natural))
-> HlsWebdavSettings -> f HlsWebdavSettings
hlsWebdavSettings_numRetries = (HlsWebdavSettings -> Maybe Natural)
-> (HlsWebdavSettings -> Maybe Natural -> HlsWebdavSettings)
-> Lens
     HlsWebdavSettings HlsWebdavSettings (Maybe Natural) (Maybe Natural)
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)

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> HlsWebdavSettings -> f HlsWebdavSettings
hlsWebdavSettings_connectionRetryInterval = (HlsWebdavSettings -> Maybe Natural)
-> (HlsWebdavSettings -> Maybe Natural -> HlsWebdavSettings)
-> Lens
     HlsWebdavSettings HlsWebdavSettings (Maybe Natural) (Maybe Natural)
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 :: (Maybe Natural -> f (Maybe Natural))
-> HlsWebdavSettings -> f HlsWebdavSettings
hlsWebdavSettings_filecacheDuration = (HlsWebdavSettings -> Maybe Natural)
-> (HlsWebdavSettings -> Maybe Natural -> HlsWebdavSettings)
-> Lens
     HlsWebdavSettings HlsWebdavSettings (Maybe Natural) (Maybe Natural)
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)

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> HlsWebdavSettings -> f HlsWebdavSettings
hlsWebdavSettings_restartDelay = (HlsWebdavSettings -> Maybe Natural)
-> (HlsWebdavSettings -> Maybe Natural -> HlsWebdavSettings)
-> Lens
     HlsWebdavSettings HlsWebdavSettings (Maybe Natural) (Maybe Natural)
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 Core.FromJSON HlsWebdavSettings where
  parseJSON :: Value -> Parser HlsWebdavSettings
parseJSON =
    String
-> (Object -> Parser HlsWebdavSettings)
-> Value
-> Parser HlsWebdavSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsWebdavSettings"
      ( \Object
x ->
          Maybe HlsWebdavHttpTransferMode
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> HlsWebdavSettings
HlsWebdavSettings'
            (Maybe HlsWebdavHttpTransferMode
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> HlsWebdavSettings)
-> Parser (Maybe HlsWebdavHttpTransferMode)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> HlsWebdavSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HlsWebdavHttpTransferMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"httpTransferMode")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> HlsWebdavSettings)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Natural -> Maybe Natural -> HlsWebdavSettings)
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
"numRetries")
            Parser
  (Maybe Natural
   -> Maybe Natural -> Maybe Natural -> HlsWebdavSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Natural -> HlsWebdavSettings)
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 -> HlsWebdavSettings)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> HlsWebdavSettings)
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 -> HlsWebdavSettings)
-> Parser (Maybe Natural) -> Parser HlsWebdavSettings
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 HlsWebdavSettings

instance Prelude.NFData HlsWebdavSettings

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