{-# 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.MediaPackageVOD.Types.HlsManifest
-- 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.MediaPackageVOD.Types.HlsManifest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackageVOD.Types.AdMarkers
import Amazonka.MediaPackageVOD.Types.StreamSelection
import qualified Amazonka.Prelude as Prelude

-- | An HTTP Live Streaming (HLS) manifest configuration.
--
-- /See:/ 'newHlsManifest' smart constructor.
data HlsManifest = HlsManifest'
  { -- | An optional string to include in the name of the manifest.
    HlsManifest -> Maybe Text
manifestName :: Prelude.Maybe Prelude.Text,
    -- | The interval (in seconds) between each EXT-X-PROGRAM-DATE-TIME tag
    -- inserted into manifests. Additionally, when an interval is specified
    -- ID3Timed Metadata messages will be generated every 5 seconds using the
    -- ingest time of the content. If the interval is not specified, or set to
    -- 0, then no EXT-X-PROGRAM-DATE-TIME tags will be inserted into manifests
    -- and no ID3Timed Metadata messages will be generated. Note that
    -- irrespective of this parameter, if any ID3 Timed Metadata is found in
    -- HTTP Live Streaming (HLS) input, it will be passed through to HLS
    -- output.
    HlsManifest -> Maybe Int
programDateTimeIntervalSeconds :: Prelude.Maybe Prelude.Int,
    HlsManifest -> Maybe StreamSelection
streamSelection :: Prelude.Maybe StreamSelection,
    -- | This setting controls how ad markers are included in the packaged
    -- OriginEndpoint. \"NONE\" will omit all SCTE-35 ad markers from the
    -- output. \"PASSTHROUGH\" causes the manifest to contain a copy of the
    -- SCTE-35 ad markers (comments) taken directly from the input HTTP Live
    -- Streaming (HLS) manifest. \"SCTE35_ENHANCED\" generates ad markers and
    -- blackout tags based on SCTE-35 messages in the input source.
    HlsManifest -> Maybe AdMarkers
adMarkers :: Prelude.Maybe AdMarkers,
    -- | When enabled, an I-Frame only stream will be included in the output.
    HlsManifest -> Maybe Bool
includeIframeOnlyStream :: Prelude.Maybe Prelude.Bool,
    -- | When enabled, the EXT-X-KEY tag will be repeated in output manifests.
    HlsManifest -> Maybe Bool
repeatExtXKey :: Prelude.Maybe Prelude.Bool
  }
  deriving (HlsManifest -> HlsManifest -> Bool
(HlsManifest -> HlsManifest -> Bool)
-> (HlsManifest -> HlsManifest -> Bool) -> Eq HlsManifest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsManifest -> HlsManifest -> Bool
$c/= :: HlsManifest -> HlsManifest -> Bool
== :: HlsManifest -> HlsManifest -> Bool
$c== :: HlsManifest -> HlsManifest -> Bool
Prelude.Eq, ReadPrec [HlsManifest]
ReadPrec HlsManifest
Int -> ReadS HlsManifest
ReadS [HlsManifest]
(Int -> ReadS HlsManifest)
-> ReadS [HlsManifest]
-> ReadPrec HlsManifest
-> ReadPrec [HlsManifest]
-> Read HlsManifest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsManifest]
$creadListPrec :: ReadPrec [HlsManifest]
readPrec :: ReadPrec HlsManifest
$creadPrec :: ReadPrec HlsManifest
readList :: ReadS [HlsManifest]
$creadList :: ReadS [HlsManifest]
readsPrec :: Int -> ReadS HlsManifest
$creadsPrec :: Int -> ReadS HlsManifest
Prelude.Read, Int -> HlsManifest -> ShowS
[HlsManifest] -> ShowS
HlsManifest -> String
(Int -> HlsManifest -> ShowS)
-> (HlsManifest -> String)
-> ([HlsManifest] -> ShowS)
-> Show HlsManifest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsManifest] -> ShowS
$cshowList :: [HlsManifest] -> ShowS
show :: HlsManifest -> String
$cshow :: HlsManifest -> String
showsPrec :: Int -> HlsManifest -> ShowS
$cshowsPrec :: Int -> HlsManifest -> ShowS
Prelude.Show, (forall x. HlsManifest -> Rep HlsManifest x)
-> (forall x. Rep HlsManifest x -> HlsManifest)
-> Generic HlsManifest
forall x. Rep HlsManifest x -> HlsManifest
forall x. HlsManifest -> Rep HlsManifest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsManifest x -> HlsManifest
$cfrom :: forall x. HlsManifest -> Rep HlsManifest x
Prelude.Generic)

-- |
-- Create a value of 'HlsManifest' 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:
--
-- 'manifestName', 'hlsManifest_manifestName' - An optional string to include in the name of the manifest.
--
-- 'programDateTimeIntervalSeconds', 'hlsManifest_programDateTimeIntervalSeconds' - The interval (in seconds) between each EXT-X-PROGRAM-DATE-TIME tag
-- inserted into manifests. Additionally, when an interval is specified
-- ID3Timed Metadata messages will be generated every 5 seconds using the
-- ingest time of the content. If the interval is not specified, or set to
-- 0, then no EXT-X-PROGRAM-DATE-TIME tags will be inserted into manifests
-- and no ID3Timed Metadata messages will be generated. Note that
-- irrespective of this parameter, if any ID3 Timed Metadata is found in
-- HTTP Live Streaming (HLS) input, it will be passed through to HLS
-- output.
--
-- 'streamSelection', 'hlsManifest_streamSelection' - Undocumented member.
--
-- 'adMarkers', 'hlsManifest_adMarkers' - This setting controls how ad markers are included in the packaged
-- OriginEndpoint. \"NONE\" will omit all SCTE-35 ad markers from the
-- output. \"PASSTHROUGH\" causes the manifest to contain a copy of the
-- SCTE-35 ad markers (comments) taken directly from the input HTTP Live
-- Streaming (HLS) manifest. \"SCTE35_ENHANCED\" generates ad markers and
-- blackout tags based on SCTE-35 messages in the input source.
--
-- 'includeIframeOnlyStream', 'hlsManifest_includeIframeOnlyStream' - When enabled, an I-Frame only stream will be included in the output.
--
-- 'repeatExtXKey', 'hlsManifest_repeatExtXKey' - When enabled, the EXT-X-KEY tag will be repeated in output manifests.
newHlsManifest ::
  HlsManifest
newHlsManifest :: HlsManifest
newHlsManifest =
  HlsManifest' :: Maybe Text
-> Maybe Int
-> Maybe StreamSelection
-> Maybe AdMarkers
-> Maybe Bool
-> Maybe Bool
-> HlsManifest
HlsManifest'
    { $sel:manifestName:HlsManifest' :: Maybe Text
manifestName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:programDateTimeIntervalSeconds:HlsManifest' :: Maybe Int
programDateTimeIntervalSeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:streamSelection:HlsManifest' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
forall a. Maybe a
Prelude.Nothing,
      $sel:adMarkers:HlsManifest' :: Maybe AdMarkers
adMarkers = Maybe AdMarkers
forall a. Maybe a
Prelude.Nothing,
      $sel:includeIframeOnlyStream:HlsManifest' :: Maybe Bool
includeIframeOnlyStream = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:repeatExtXKey:HlsManifest' :: Maybe Bool
repeatExtXKey = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | An optional string to include in the name of the manifest.
hlsManifest_manifestName :: Lens.Lens' HlsManifest (Prelude.Maybe Prelude.Text)
hlsManifest_manifestName :: (Maybe Text -> f (Maybe Text)) -> HlsManifest -> f HlsManifest
hlsManifest_manifestName = (HlsManifest -> Maybe Text)
-> (HlsManifest -> Maybe Text -> HlsManifest)
-> Lens HlsManifest HlsManifest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsManifest' {Maybe Text
manifestName :: Maybe Text
$sel:manifestName:HlsManifest' :: HlsManifest -> Maybe Text
manifestName} -> Maybe Text
manifestName) (\s :: HlsManifest
s@HlsManifest' {} Maybe Text
a -> HlsManifest
s {$sel:manifestName:HlsManifest' :: Maybe Text
manifestName = Maybe Text
a} :: HlsManifest)

-- | The interval (in seconds) between each EXT-X-PROGRAM-DATE-TIME tag
-- inserted into manifests. Additionally, when an interval is specified
-- ID3Timed Metadata messages will be generated every 5 seconds using the
-- ingest time of the content. If the interval is not specified, or set to
-- 0, then no EXT-X-PROGRAM-DATE-TIME tags will be inserted into manifests
-- and no ID3Timed Metadata messages will be generated. Note that
-- irrespective of this parameter, if any ID3 Timed Metadata is found in
-- HTTP Live Streaming (HLS) input, it will be passed through to HLS
-- output.
hlsManifest_programDateTimeIntervalSeconds :: Lens.Lens' HlsManifest (Prelude.Maybe Prelude.Int)
hlsManifest_programDateTimeIntervalSeconds :: (Maybe Int -> f (Maybe Int)) -> HlsManifest -> f HlsManifest
hlsManifest_programDateTimeIntervalSeconds = (HlsManifest -> Maybe Int)
-> (HlsManifest -> Maybe Int -> HlsManifest)
-> Lens HlsManifest HlsManifest (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsManifest' {Maybe Int
programDateTimeIntervalSeconds :: Maybe Int
$sel:programDateTimeIntervalSeconds:HlsManifest' :: HlsManifest -> Maybe Int
programDateTimeIntervalSeconds} -> Maybe Int
programDateTimeIntervalSeconds) (\s :: HlsManifest
s@HlsManifest' {} Maybe Int
a -> HlsManifest
s {$sel:programDateTimeIntervalSeconds:HlsManifest' :: Maybe Int
programDateTimeIntervalSeconds = Maybe Int
a} :: HlsManifest)

-- | Undocumented member.
hlsManifest_streamSelection :: Lens.Lens' HlsManifest (Prelude.Maybe StreamSelection)
hlsManifest_streamSelection :: (Maybe StreamSelection -> f (Maybe StreamSelection))
-> HlsManifest -> f HlsManifest
hlsManifest_streamSelection = (HlsManifest -> Maybe StreamSelection)
-> (HlsManifest -> Maybe StreamSelection -> HlsManifest)
-> Lens
     HlsManifest
     HlsManifest
     (Maybe StreamSelection)
     (Maybe StreamSelection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsManifest' {Maybe StreamSelection
streamSelection :: Maybe StreamSelection
$sel:streamSelection:HlsManifest' :: HlsManifest -> Maybe StreamSelection
streamSelection} -> Maybe StreamSelection
streamSelection) (\s :: HlsManifest
s@HlsManifest' {} Maybe StreamSelection
a -> HlsManifest
s {$sel:streamSelection:HlsManifest' :: Maybe StreamSelection
streamSelection = Maybe StreamSelection
a} :: HlsManifest)

-- | This setting controls how ad markers are included in the packaged
-- OriginEndpoint. \"NONE\" will omit all SCTE-35 ad markers from the
-- output. \"PASSTHROUGH\" causes the manifest to contain a copy of the
-- SCTE-35 ad markers (comments) taken directly from the input HTTP Live
-- Streaming (HLS) manifest. \"SCTE35_ENHANCED\" generates ad markers and
-- blackout tags based on SCTE-35 messages in the input source.
hlsManifest_adMarkers :: Lens.Lens' HlsManifest (Prelude.Maybe AdMarkers)
hlsManifest_adMarkers :: (Maybe AdMarkers -> f (Maybe AdMarkers))
-> HlsManifest -> f HlsManifest
hlsManifest_adMarkers = (HlsManifest -> Maybe AdMarkers)
-> (HlsManifest -> Maybe AdMarkers -> HlsManifest)
-> Lens HlsManifest HlsManifest (Maybe AdMarkers) (Maybe AdMarkers)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsManifest' {Maybe AdMarkers
adMarkers :: Maybe AdMarkers
$sel:adMarkers:HlsManifest' :: HlsManifest -> Maybe AdMarkers
adMarkers} -> Maybe AdMarkers
adMarkers) (\s :: HlsManifest
s@HlsManifest' {} Maybe AdMarkers
a -> HlsManifest
s {$sel:adMarkers:HlsManifest' :: Maybe AdMarkers
adMarkers = Maybe AdMarkers
a} :: HlsManifest)

-- | When enabled, an I-Frame only stream will be included in the output.
hlsManifest_includeIframeOnlyStream :: Lens.Lens' HlsManifest (Prelude.Maybe Prelude.Bool)
hlsManifest_includeIframeOnlyStream :: (Maybe Bool -> f (Maybe Bool)) -> HlsManifest -> f HlsManifest
hlsManifest_includeIframeOnlyStream = (HlsManifest -> Maybe Bool)
-> (HlsManifest -> Maybe Bool -> HlsManifest)
-> Lens HlsManifest HlsManifest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsManifest' {Maybe Bool
includeIframeOnlyStream :: Maybe Bool
$sel:includeIframeOnlyStream:HlsManifest' :: HlsManifest -> Maybe Bool
includeIframeOnlyStream} -> Maybe Bool
includeIframeOnlyStream) (\s :: HlsManifest
s@HlsManifest' {} Maybe Bool
a -> HlsManifest
s {$sel:includeIframeOnlyStream:HlsManifest' :: Maybe Bool
includeIframeOnlyStream = Maybe Bool
a} :: HlsManifest)

-- | When enabled, the EXT-X-KEY tag will be repeated in output manifests.
hlsManifest_repeatExtXKey :: Lens.Lens' HlsManifest (Prelude.Maybe Prelude.Bool)
hlsManifest_repeatExtXKey :: (Maybe Bool -> f (Maybe Bool)) -> HlsManifest -> f HlsManifest
hlsManifest_repeatExtXKey = (HlsManifest -> Maybe Bool)
-> (HlsManifest -> Maybe Bool -> HlsManifest)
-> Lens HlsManifest HlsManifest (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsManifest' {Maybe Bool
repeatExtXKey :: Maybe Bool
$sel:repeatExtXKey:HlsManifest' :: HlsManifest -> Maybe Bool
repeatExtXKey} -> Maybe Bool
repeatExtXKey) (\s :: HlsManifest
s@HlsManifest' {} Maybe Bool
a -> HlsManifest
s {$sel:repeatExtXKey:HlsManifest' :: Maybe Bool
repeatExtXKey = Maybe Bool
a} :: HlsManifest)

instance Core.FromJSON HlsManifest where
  parseJSON :: Value -> Parser HlsManifest
parseJSON =
    String
-> (Object -> Parser HlsManifest) -> Value -> Parser HlsManifest
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsManifest"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe StreamSelection
-> Maybe AdMarkers
-> Maybe Bool
-> Maybe Bool
-> HlsManifest
HlsManifest'
            (Maybe Text
 -> Maybe Int
 -> Maybe StreamSelection
 -> Maybe AdMarkers
 -> Maybe Bool
 -> Maybe Bool
 -> HlsManifest)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe StreamSelection
      -> Maybe AdMarkers
      -> Maybe Bool
      -> Maybe Bool
      -> HlsManifest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"manifestName")
            Parser
  (Maybe Int
   -> Maybe StreamSelection
   -> Maybe AdMarkers
   -> Maybe Bool
   -> Maybe Bool
   -> HlsManifest)
-> Parser (Maybe Int)
-> Parser
     (Maybe StreamSelection
      -> Maybe AdMarkers -> Maybe Bool -> Maybe Bool -> HlsManifest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"programDateTimeIntervalSeconds")
            Parser
  (Maybe StreamSelection
   -> Maybe AdMarkers -> Maybe Bool -> Maybe Bool -> HlsManifest)
-> Parser (Maybe StreamSelection)
-> Parser
     (Maybe AdMarkers -> Maybe Bool -> Maybe Bool -> HlsManifest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamSelection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"streamSelection")
            Parser (Maybe AdMarkers -> Maybe Bool -> Maybe Bool -> HlsManifest)
-> Parser (Maybe AdMarkers)
-> Parser (Maybe Bool -> Maybe Bool -> HlsManifest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AdMarkers)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"adMarkers")
            Parser (Maybe Bool -> Maybe Bool -> HlsManifest)
-> Parser (Maybe Bool) -> Parser (Maybe Bool -> HlsManifest)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"includeIframeOnlyStream")
            Parser (Maybe Bool -> HlsManifest)
-> Parser (Maybe Bool) -> Parser HlsManifest
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"repeatExtXKey")
      )

instance Prelude.Hashable HlsManifest

instance Prelude.NFData HlsManifest

instance Core.ToJSON HlsManifest where
  toJSON :: HlsManifest -> Value
toJSON HlsManifest' {Maybe Bool
Maybe Int
Maybe Text
Maybe AdMarkers
Maybe StreamSelection
repeatExtXKey :: Maybe Bool
includeIframeOnlyStream :: Maybe Bool
adMarkers :: Maybe AdMarkers
streamSelection :: Maybe StreamSelection
programDateTimeIntervalSeconds :: Maybe Int
manifestName :: Maybe Text
$sel:repeatExtXKey:HlsManifest' :: HlsManifest -> Maybe Bool
$sel:includeIframeOnlyStream:HlsManifest' :: HlsManifest -> Maybe Bool
$sel:adMarkers:HlsManifest' :: HlsManifest -> Maybe AdMarkers
$sel:streamSelection:HlsManifest' :: HlsManifest -> Maybe StreamSelection
$sel:programDateTimeIntervalSeconds:HlsManifest' :: HlsManifest -> Maybe Int
$sel:manifestName:HlsManifest' :: HlsManifest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"manifestName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
manifestName,
            (Text
"programDateTimeIntervalSeconds" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
programDateTimeIntervalSeconds,
            (Text
"streamSelection" Text -> StreamSelection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StreamSelection -> Pair) -> Maybe StreamSelection -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamSelection
streamSelection,
            (Text
"adMarkers" Text -> AdMarkers -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AdMarkers -> Pair) -> Maybe AdMarkers -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AdMarkers
adMarkers,
            (Text
"includeIframeOnlyStream" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeIframeOnlyStream,
            (Text
"repeatExtXKey" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
repeatExtXKey
          ]
      )