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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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
  }
  deriving (DashConfiguration -> DashConfiguration -> Bool
(DashConfiguration -> DashConfiguration -> Bool)
-> (DashConfiguration -> DashConfiguration -> Bool)
-> Eq DashConfiguration
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]
(Int -> ReadS DashConfiguration)
-> ReadS [DashConfiguration]
-> ReadPrec DashConfiguration
-> ReadPrec [DashConfiguration]
-> Read 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
(Int -> DashConfiguration -> ShowS)
-> (DashConfiguration -> String)
-> ([DashConfiguration] -> ShowS)
-> Show DashConfiguration
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. DashConfiguration -> Rep DashConfiguration x)
-> (forall x. Rep DashConfiguration x -> DashConfiguration)
-> Generic DashConfiguration
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.
--
-- '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.
--
-- '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.
newDashConfiguration ::
  DashConfiguration
newDashConfiguration :: DashConfiguration
newDashConfiguration =
  DashConfiguration' :: Maybe Text
-> Maybe OriginManifestType -> Maybe Text -> DashConfiguration
DashConfiguration'
    { $sel:manifestEndpointPrefix:DashConfiguration' :: Maybe Text
manifestEndpointPrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:originManifestType:DashConfiguration' :: Maybe OriginManifestType
originManifestType = Maybe OriginManifestType
forall a. Maybe a
Prelude.Nothing,
      $sel:mpdLocation:DashConfiguration' :: Maybe Text
mpdLocation = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DashConfiguration -> f DashConfiguration
dashConfiguration_manifestEndpointPrefix = (DashConfiguration -> Maybe Text)
-> (DashConfiguration -> Maybe Text -> DashConfiguration)
-> Lens
     DashConfiguration DashConfiguration (Maybe Text) (Maybe Text)
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 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 :: (Maybe OriginManifestType -> f (Maybe OriginManifestType))
-> DashConfiguration -> f DashConfiguration
dashConfiguration_originManifestType = (DashConfiguration -> Maybe OriginManifestType)
-> (DashConfiguration
    -> Maybe OriginManifestType -> DashConfiguration)
-> Lens
     DashConfiguration
     DashConfiguration
     (Maybe OriginManifestType)
     (Maybe 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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> DashConfiguration -> f DashConfiguration
dashConfiguration_mpdLocation = (DashConfiguration -> Maybe Text)
-> (DashConfiguration -> Maybe Text -> DashConfiguration)
-> Lens
     DashConfiguration DashConfiguration (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable DashConfiguration

instance Prelude.NFData DashConfiguration