{-# 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.MediaTailor.Types.DashConfiguration
-- 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.MediaTailor.Types.DashConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaTailor.Types.OriginManifestType
import qualified Amazonka.Prelude as Prelude

-- | The configuration for DASH content.
--
-- /See:/ 'newDashConfiguration' smart constructor.
data DashConfiguration = DashConfiguration'
  { -- | The URL generated by MediaTailor to initiate a playback session. The
    -- session uses server-side reporting. This setting is ignored in PUT
    -- operations.
    DashConfiguration -> Maybe Text
manifestEndpointPrefix :: Prelude.Maybe Prelude.Text,
    -- | The setting that controls whether MediaTailor includes the Location tag
    -- in DASH manifests. MediaTailor populates the Location tag with the URL
    -- for manifest update requests, to be used by players that don\'t support
    -- sticky redirects. Disable this if you have CDN routing rules set up for
    -- accessing MediaTailor manifests, and you are either using client-side
    -- reporting or your players support sticky HTTP redirects. Valid values
    -- are @DISABLED@ and @EMT_DEFAULT@. The @EMT_DEFAULT@ setting enables the
    -- inclusion of the tag and is the default value.
    DashConfiguration -> Maybe Text
mpdLocation :: Prelude.Maybe Prelude.Text,
    -- | The setting that controls whether MediaTailor handles manifests from the
    -- origin server as multi-period manifests or single-period manifests. If
    -- your origin server produces single-period manifests, set this to
    -- @SINGLE_PERIOD@. The default setting is @MULTI_PERIOD@. For multi-period
    -- manifests, omit this setting or set it to @MULTI_PERIOD@.
    DashConfiguration -> Maybe OriginManifestType
originManifestType :: Prelude.Maybe OriginManifestType
  }
  deriving (DashConfiguration -> DashConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashConfiguration -> DashConfiguration -> Bool
$c/= :: DashConfiguration -> DashConfiguration -> Bool
== :: DashConfiguration -> DashConfiguration -> Bool
$c== :: DashConfiguration -> DashConfiguration -> Bool
Prelude.Eq, ReadPrec [DashConfiguration]
ReadPrec DashConfiguration
Int -> ReadS DashConfiguration
ReadS [DashConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashConfiguration]
$creadListPrec :: ReadPrec [DashConfiguration]
readPrec :: ReadPrec DashConfiguration
$creadPrec :: ReadPrec DashConfiguration
readList :: ReadS [DashConfiguration]
$creadList :: ReadS [DashConfiguration]
readsPrec :: Int -> ReadS DashConfiguration
$creadsPrec :: Int -> ReadS DashConfiguration
Prelude.Read, Int -> DashConfiguration -> ShowS
[DashConfiguration] -> ShowS
DashConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashConfiguration] -> ShowS
$cshowList :: [DashConfiguration] -> ShowS
show :: DashConfiguration -> String
$cshow :: DashConfiguration -> String
showsPrec :: Int -> DashConfiguration -> ShowS
$cshowsPrec :: Int -> DashConfiguration -> ShowS
Prelude.Show, forall x. Rep DashConfiguration x -> DashConfiguration
forall x. DashConfiguration -> Rep DashConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashConfiguration x -> DashConfiguration
$cfrom :: forall x. DashConfiguration -> Rep DashConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DashConfiguration' 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:
--
-- 'manifestEndpointPrefix', 'dashConfiguration_manifestEndpointPrefix' - The URL generated by MediaTailor to initiate a playback session. The
-- session uses server-side reporting. This setting is ignored in PUT
-- operations.
--
-- 'mpdLocation', 'dashConfiguration_mpdLocation' - The setting that controls whether MediaTailor includes the Location tag
-- in DASH manifests. MediaTailor populates the Location tag with the URL
-- for manifest update requests, to be used by players that don\'t support
-- sticky redirects. Disable this if you have CDN routing rules set up for
-- accessing MediaTailor manifests, and you are either using client-side
-- reporting or your players support sticky HTTP redirects. Valid values
-- are @DISABLED@ and @EMT_DEFAULT@. The @EMT_DEFAULT@ setting enables the
-- inclusion of the tag and is the default value.
--
-- 'originManifestType', 'dashConfiguration_originManifestType' - The setting that controls whether MediaTailor handles manifests from the
-- origin server as multi-period manifests or single-period manifests. If
-- your origin server produces single-period manifests, set this to
-- @SINGLE_PERIOD@. The default setting is @MULTI_PERIOD@. For multi-period
-- manifests, omit this setting or set it to @MULTI_PERIOD@.
newDashConfiguration ::
  DashConfiguration
newDashConfiguration :: DashConfiguration
newDashConfiguration =
  DashConfiguration'
    { $sel:manifestEndpointPrefix:DashConfiguration' :: Maybe Text
manifestEndpointPrefix =
        forall a. Maybe a
Prelude.Nothing,
      $sel:mpdLocation:DashConfiguration' :: Maybe Text
mpdLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:originManifestType:DashConfiguration' :: Maybe OriginManifestType
originManifestType = forall a. Maybe a
Prelude.Nothing
    }

-- | The URL generated by MediaTailor to initiate a playback session. The
-- session uses server-side reporting. This setting is ignored in PUT
-- operations.
dashConfiguration_manifestEndpointPrefix :: Lens.Lens' DashConfiguration (Prelude.Maybe Prelude.Text)
dashConfiguration_manifestEndpointPrefix :: Lens' DashConfiguration (Maybe Text)
dashConfiguration_manifestEndpointPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashConfiguration' {Maybe Text
manifestEndpointPrefix :: Maybe Text
$sel:manifestEndpointPrefix:DashConfiguration' :: DashConfiguration -> Maybe Text
manifestEndpointPrefix} -> Maybe Text
manifestEndpointPrefix) (\s :: DashConfiguration
s@DashConfiguration' {} Maybe Text
a -> DashConfiguration
s {$sel:manifestEndpointPrefix:DashConfiguration' :: Maybe Text
manifestEndpointPrefix = Maybe Text
a} :: DashConfiguration)

-- | The setting that controls whether MediaTailor includes the Location tag
-- in DASH manifests. MediaTailor populates the Location tag with the URL
-- for manifest update requests, to be used by players that don\'t support
-- sticky redirects. Disable this if you have CDN routing rules set up for
-- accessing MediaTailor manifests, and you are either using client-side
-- reporting or your players support sticky HTTP redirects. Valid values
-- are @DISABLED@ and @EMT_DEFAULT@. The @EMT_DEFAULT@ setting enables the
-- inclusion of the tag and is the default value.
dashConfiguration_mpdLocation :: Lens.Lens' DashConfiguration (Prelude.Maybe Prelude.Text)
dashConfiguration_mpdLocation :: Lens' DashConfiguration (Maybe Text)
dashConfiguration_mpdLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashConfiguration' {Maybe Text
mpdLocation :: Maybe Text
$sel:mpdLocation:DashConfiguration' :: DashConfiguration -> Maybe Text
mpdLocation} -> Maybe Text
mpdLocation) (\s :: DashConfiguration
s@DashConfiguration' {} Maybe Text
a -> DashConfiguration
s {$sel:mpdLocation:DashConfiguration' :: Maybe Text
mpdLocation = Maybe Text
a} :: DashConfiguration)

-- | The setting that controls whether MediaTailor handles manifests from the
-- origin server as multi-period manifests or single-period manifests. If
-- your origin server produces single-period manifests, set this to
-- @SINGLE_PERIOD@. The default setting is @MULTI_PERIOD@. For multi-period
-- manifests, omit this setting or set it to @MULTI_PERIOD@.
dashConfiguration_originManifestType :: Lens.Lens' DashConfiguration (Prelude.Maybe OriginManifestType)
dashConfiguration_originManifestType :: Lens' DashConfiguration (Maybe OriginManifestType)
dashConfiguration_originManifestType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashConfiguration' {Maybe OriginManifestType
originManifestType :: Maybe OriginManifestType
$sel:originManifestType:DashConfiguration' :: DashConfiguration -> Maybe OriginManifestType
originManifestType} -> Maybe OriginManifestType
originManifestType) (\s :: DashConfiguration
s@DashConfiguration' {} Maybe OriginManifestType
a -> DashConfiguration
s {$sel:originManifestType:DashConfiguration' :: Maybe OriginManifestType
originManifestType = Maybe OriginManifestType
a} :: DashConfiguration)

instance Data.FromJSON DashConfiguration where
  parseJSON :: Value -> Parser DashConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DashConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe OriginManifestType -> DashConfiguration
DashConfiguration'
            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
"ManifestEndpointPrefix")
            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
"MpdLocation")
            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
"OriginManifestType")
      )

instance Prelude.Hashable DashConfiguration where
  hashWithSalt :: Int -> DashConfiguration -> Int
hashWithSalt Int
_salt DashConfiguration' {Maybe Text
Maybe OriginManifestType
originManifestType :: Maybe OriginManifestType
mpdLocation :: Maybe Text
manifestEndpointPrefix :: Maybe Text
$sel:originManifestType:DashConfiguration' :: DashConfiguration -> Maybe OriginManifestType
$sel:mpdLocation:DashConfiguration' :: DashConfiguration -> Maybe Text
$sel:manifestEndpointPrefix:DashConfiguration' :: DashConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
manifestEndpointPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mpdLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OriginManifestType
originManifestType

instance Prelude.NFData DashConfiguration where
  rnf :: DashConfiguration -> ()
rnf DashConfiguration' {Maybe Text
Maybe OriginManifestType
originManifestType :: Maybe OriginManifestType
mpdLocation :: Maybe Text
manifestEndpointPrefix :: Maybe Text
$sel:originManifestType:DashConfiguration' :: DashConfiguration -> Maybe OriginManifestType
$sel:mpdLocation:DashConfiguration' :: DashConfiguration -> Maybe Text
$sel:manifestEndpointPrefix:DashConfiguration' :: DashConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
manifestEndpointPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mpdLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OriginManifestType
originManifestType