{-# 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.MediaConvert.Types.HlsEncryptionSettings
-- 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.MediaConvert.Types.HlsEncryptionSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.HlsEncryptionType
import Amazonka.MediaConvert.Types.HlsInitializationVectorInManifest
import Amazonka.MediaConvert.Types.HlsKeyProviderType
import Amazonka.MediaConvert.Types.HlsOfflineEncrypted
import Amazonka.MediaConvert.Types.SpekeKeyProvider
import Amazonka.MediaConvert.Types.StaticKeyProvider
import qualified Amazonka.Prelude as Prelude

-- | Settings for HLS encryption
--
-- /See:/ 'newHlsEncryptionSettings' smart constructor.
data HlsEncryptionSettings = HlsEncryptionSettings'
  { -- | Enable this setting to insert the EXT-X-SESSION-KEY element into the
    -- master playlist. This allows for offline Apple HLS FairPlay content
    -- protection.
    HlsEncryptionSettings -> Maybe HlsOfflineEncrypted
offlineEncrypted :: Prelude.Maybe HlsOfflineEncrypted,
    -- | Encrypts the segments with the given encryption scheme. Leave blank to
    -- disable. Selecting \'Disabled\' in the web interface also disables
    -- encryption.
    HlsEncryptionSettings -> Maybe HlsEncryptionType
encryptionMethod :: Prelude.Maybe HlsEncryptionType,
    -- | This is a 128-bit, 16-byte hex value represented by a 32-character text
    -- string. If this parameter is not set then the Initialization Vector will
    -- follow the segment number by default.
    HlsEncryptionSettings -> Maybe Text
constantInitializationVector :: Prelude.Maybe Prelude.Text,
    -- | Specify whether your DRM encryption key is static or from a key provider
    -- that follows the SPEKE standard. For more information about SPEKE, see
    -- https:\/\/docs.aws.amazon.com\/speke\/latest\/documentation\/what-is-speke.html.
    HlsEncryptionSettings -> Maybe HlsKeyProviderType
type' :: Prelude.Maybe HlsKeyProviderType,
    -- | Use these settings to set up encryption with a static key provider.
    HlsEncryptionSettings -> Maybe StaticKeyProvider
staticKeyProvider :: Prelude.Maybe StaticKeyProvider,
    -- | If your output group type is HLS, DASH, or Microsoft Smooth, use these
    -- settings when doing DRM encryption with a SPEKE-compliant key provider.
    -- If your output group type is CMAF, use the SpekeKeyProviderCmaf settings
    -- instead.
    HlsEncryptionSettings -> Maybe SpekeKeyProvider
spekeKeyProvider :: Prelude.Maybe SpekeKeyProvider,
    -- | The Initialization Vector is a 128-bit number used in conjunction with
    -- the key for encrypting blocks. If set to INCLUDE, Initialization Vector
    -- is listed in the manifest. Otherwise Initialization Vector is not in the
    -- manifest.
    HlsEncryptionSettings -> Maybe HlsInitializationVectorInManifest
initializationVectorInManifest :: Prelude.Maybe HlsInitializationVectorInManifest
  }
  deriving (HlsEncryptionSettings -> HlsEncryptionSettings -> Bool
(HlsEncryptionSettings -> HlsEncryptionSettings -> Bool)
-> (HlsEncryptionSettings -> HlsEncryptionSettings -> Bool)
-> Eq HlsEncryptionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HlsEncryptionSettings -> HlsEncryptionSettings -> Bool
$c/= :: HlsEncryptionSettings -> HlsEncryptionSettings -> Bool
== :: HlsEncryptionSettings -> HlsEncryptionSettings -> Bool
$c== :: HlsEncryptionSettings -> HlsEncryptionSettings -> Bool
Prelude.Eq, ReadPrec [HlsEncryptionSettings]
ReadPrec HlsEncryptionSettings
Int -> ReadS HlsEncryptionSettings
ReadS [HlsEncryptionSettings]
(Int -> ReadS HlsEncryptionSettings)
-> ReadS [HlsEncryptionSettings]
-> ReadPrec HlsEncryptionSettings
-> ReadPrec [HlsEncryptionSettings]
-> Read HlsEncryptionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HlsEncryptionSettings]
$creadListPrec :: ReadPrec [HlsEncryptionSettings]
readPrec :: ReadPrec HlsEncryptionSettings
$creadPrec :: ReadPrec HlsEncryptionSettings
readList :: ReadS [HlsEncryptionSettings]
$creadList :: ReadS [HlsEncryptionSettings]
readsPrec :: Int -> ReadS HlsEncryptionSettings
$creadsPrec :: Int -> ReadS HlsEncryptionSettings
Prelude.Read, Int -> HlsEncryptionSettings -> ShowS
[HlsEncryptionSettings] -> ShowS
HlsEncryptionSettings -> String
(Int -> HlsEncryptionSettings -> ShowS)
-> (HlsEncryptionSettings -> String)
-> ([HlsEncryptionSettings] -> ShowS)
-> Show HlsEncryptionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HlsEncryptionSettings] -> ShowS
$cshowList :: [HlsEncryptionSettings] -> ShowS
show :: HlsEncryptionSettings -> String
$cshow :: HlsEncryptionSettings -> String
showsPrec :: Int -> HlsEncryptionSettings -> ShowS
$cshowsPrec :: Int -> HlsEncryptionSettings -> ShowS
Prelude.Show, (forall x. HlsEncryptionSettings -> Rep HlsEncryptionSettings x)
-> (forall x. Rep HlsEncryptionSettings x -> HlsEncryptionSettings)
-> Generic HlsEncryptionSettings
forall x. Rep HlsEncryptionSettings x -> HlsEncryptionSettings
forall x. HlsEncryptionSettings -> Rep HlsEncryptionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HlsEncryptionSettings x -> HlsEncryptionSettings
$cfrom :: forall x. HlsEncryptionSettings -> Rep HlsEncryptionSettings x
Prelude.Generic)

-- |
-- Create a value of 'HlsEncryptionSettings' 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:
--
-- 'offlineEncrypted', 'hlsEncryptionSettings_offlineEncrypted' - Enable this setting to insert the EXT-X-SESSION-KEY element into the
-- master playlist. This allows for offline Apple HLS FairPlay content
-- protection.
--
-- 'encryptionMethod', 'hlsEncryptionSettings_encryptionMethod' - Encrypts the segments with the given encryption scheme. Leave blank to
-- disable. Selecting \'Disabled\' in the web interface also disables
-- encryption.
--
-- 'constantInitializationVector', 'hlsEncryptionSettings_constantInitializationVector' - This is a 128-bit, 16-byte hex value represented by a 32-character text
-- string. If this parameter is not set then the Initialization Vector will
-- follow the segment number by default.
--
-- 'type'', 'hlsEncryptionSettings_type' - Specify whether your DRM encryption key is static or from a key provider
-- that follows the SPEKE standard. For more information about SPEKE, see
-- https:\/\/docs.aws.amazon.com\/speke\/latest\/documentation\/what-is-speke.html.
--
-- 'staticKeyProvider', 'hlsEncryptionSettings_staticKeyProvider' - Use these settings to set up encryption with a static key provider.
--
-- 'spekeKeyProvider', 'hlsEncryptionSettings_spekeKeyProvider' - If your output group type is HLS, DASH, or Microsoft Smooth, use these
-- settings when doing DRM encryption with a SPEKE-compliant key provider.
-- If your output group type is CMAF, use the SpekeKeyProviderCmaf settings
-- instead.
--
-- 'initializationVectorInManifest', 'hlsEncryptionSettings_initializationVectorInManifest' - The Initialization Vector is a 128-bit number used in conjunction with
-- the key for encrypting blocks. If set to INCLUDE, Initialization Vector
-- is listed in the manifest. Otherwise Initialization Vector is not in the
-- manifest.
newHlsEncryptionSettings ::
  HlsEncryptionSettings
newHlsEncryptionSettings :: HlsEncryptionSettings
newHlsEncryptionSettings =
  HlsEncryptionSettings' :: Maybe HlsOfflineEncrypted
-> Maybe HlsEncryptionType
-> Maybe Text
-> Maybe HlsKeyProviderType
-> Maybe StaticKeyProvider
-> Maybe SpekeKeyProvider
-> Maybe HlsInitializationVectorInManifest
-> HlsEncryptionSettings
HlsEncryptionSettings'
    { $sel:offlineEncrypted:HlsEncryptionSettings' :: Maybe HlsOfflineEncrypted
offlineEncrypted =
        Maybe HlsOfflineEncrypted
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionMethod:HlsEncryptionSettings' :: Maybe HlsEncryptionType
encryptionMethod = Maybe HlsEncryptionType
forall a. Maybe a
Prelude.Nothing,
      $sel:constantInitializationVector:HlsEncryptionSettings' :: Maybe Text
constantInitializationVector = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':HlsEncryptionSettings' :: Maybe HlsKeyProviderType
type' = Maybe HlsKeyProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:staticKeyProvider:HlsEncryptionSettings' :: Maybe StaticKeyProvider
staticKeyProvider = Maybe StaticKeyProvider
forall a. Maybe a
Prelude.Nothing,
      $sel:spekeKeyProvider:HlsEncryptionSettings' :: Maybe SpekeKeyProvider
spekeKeyProvider = Maybe SpekeKeyProvider
forall a. Maybe a
Prelude.Nothing,
      $sel:initializationVectorInManifest:HlsEncryptionSettings' :: Maybe HlsInitializationVectorInManifest
initializationVectorInManifest = Maybe HlsInitializationVectorInManifest
forall a. Maybe a
Prelude.Nothing
    }

-- | Enable this setting to insert the EXT-X-SESSION-KEY element into the
-- master playlist. This allows for offline Apple HLS FairPlay content
-- protection.
hlsEncryptionSettings_offlineEncrypted :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe HlsOfflineEncrypted)
hlsEncryptionSettings_offlineEncrypted :: (Maybe HlsOfflineEncrypted -> f (Maybe HlsOfflineEncrypted))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_offlineEncrypted = (HlsEncryptionSettings -> Maybe HlsOfflineEncrypted)
-> (HlsEncryptionSettings
    -> Maybe HlsOfflineEncrypted -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe HlsOfflineEncrypted)
     (Maybe HlsOfflineEncrypted)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe HlsOfflineEncrypted
offlineEncrypted :: Maybe HlsOfflineEncrypted
$sel:offlineEncrypted:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsOfflineEncrypted
offlineEncrypted} -> Maybe HlsOfflineEncrypted
offlineEncrypted) (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe HlsOfflineEncrypted
a -> HlsEncryptionSettings
s {$sel:offlineEncrypted:HlsEncryptionSettings' :: Maybe HlsOfflineEncrypted
offlineEncrypted = Maybe HlsOfflineEncrypted
a} :: HlsEncryptionSettings)

-- | Encrypts the segments with the given encryption scheme. Leave blank to
-- disable. Selecting \'Disabled\' in the web interface also disables
-- encryption.
hlsEncryptionSettings_encryptionMethod :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe HlsEncryptionType)
hlsEncryptionSettings_encryptionMethod :: (Maybe HlsEncryptionType -> f (Maybe HlsEncryptionType))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_encryptionMethod = (HlsEncryptionSettings -> Maybe HlsEncryptionType)
-> (HlsEncryptionSettings
    -> Maybe HlsEncryptionType -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe HlsEncryptionType)
     (Maybe HlsEncryptionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe HlsEncryptionType
encryptionMethod :: Maybe HlsEncryptionType
$sel:encryptionMethod:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsEncryptionType
encryptionMethod} -> Maybe HlsEncryptionType
encryptionMethod) (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe HlsEncryptionType
a -> HlsEncryptionSettings
s {$sel:encryptionMethod:HlsEncryptionSettings' :: Maybe HlsEncryptionType
encryptionMethod = Maybe HlsEncryptionType
a} :: HlsEncryptionSettings)

-- | This is a 128-bit, 16-byte hex value represented by a 32-character text
-- string. If this parameter is not set then the Initialization Vector will
-- follow the segment number by default.
hlsEncryptionSettings_constantInitializationVector :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe Prelude.Text)
hlsEncryptionSettings_constantInitializationVector :: (Maybe Text -> f (Maybe Text))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_constantInitializationVector = (HlsEncryptionSettings -> Maybe Text)
-> (HlsEncryptionSettings -> Maybe Text -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe Text
constantInitializationVector :: Maybe Text
$sel:constantInitializationVector:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe Text
constantInitializationVector} -> Maybe Text
constantInitializationVector) (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe Text
a -> HlsEncryptionSettings
s {$sel:constantInitializationVector:HlsEncryptionSettings' :: Maybe Text
constantInitializationVector = Maybe Text
a} :: HlsEncryptionSettings)

-- | Specify whether your DRM encryption key is static or from a key provider
-- that follows the SPEKE standard. For more information about SPEKE, see
-- https:\/\/docs.aws.amazon.com\/speke\/latest\/documentation\/what-is-speke.html.
hlsEncryptionSettings_type :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe HlsKeyProviderType)
hlsEncryptionSettings_type :: (Maybe HlsKeyProviderType -> f (Maybe HlsKeyProviderType))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_type = (HlsEncryptionSettings -> Maybe HlsKeyProviderType)
-> (HlsEncryptionSettings
    -> Maybe HlsKeyProviderType -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe HlsKeyProviderType)
     (Maybe HlsKeyProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe HlsKeyProviderType
type' :: Maybe HlsKeyProviderType
$sel:type':HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsKeyProviderType
type'} -> Maybe HlsKeyProviderType
type') (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe HlsKeyProviderType
a -> HlsEncryptionSettings
s {$sel:type':HlsEncryptionSettings' :: Maybe HlsKeyProviderType
type' = Maybe HlsKeyProviderType
a} :: HlsEncryptionSettings)

-- | Use these settings to set up encryption with a static key provider.
hlsEncryptionSettings_staticKeyProvider :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe StaticKeyProvider)
hlsEncryptionSettings_staticKeyProvider :: (Maybe StaticKeyProvider -> f (Maybe StaticKeyProvider))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_staticKeyProvider = (HlsEncryptionSettings -> Maybe StaticKeyProvider)
-> (HlsEncryptionSettings
    -> Maybe StaticKeyProvider -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe StaticKeyProvider)
     (Maybe StaticKeyProvider)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe StaticKeyProvider
staticKeyProvider :: Maybe StaticKeyProvider
$sel:staticKeyProvider:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe StaticKeyProvider
staticKeyProvider} -> Maybe StaticKeyProvider
staticKeyProvider) (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe StaticKeyProvider
a -> HlsEncryptionSettings
s {$sel:staticKeyProvider:HlsEncryptionSettings' :: Maybe StaticKeyProvider
staticKeyProvider = Maybe StaticKeyProvider
a} :: HlsEncryptionSettings)

-- | If your output group type is HLS, DASH, or Microsoft Smooth, use these
-- settings when doing DRM encryption with a SPEKE-compliant key provider.
-- If your output group type is CMAF, use the SpekeKeyProviderCmaf settings
-- instead.
hlsEncryptionSettings_spekeKeyProvider :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe SpekeKeyProvider)
hlsEncryptionSettings_spekeKeyProvider :: (Maybe SpekeKeyProvider -> f (Maybe SpekeKeyProvider))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_spekeKeyProvider = (HlsEncryptionSettings -> Maybe SpekeKeyProvider)
-> (HlsEncryptionSettings
    -> Maybe SpekeKeyProvider -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe SpekeKeyProvider)
     (Maybe SpekeKeyProvider)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe SpekeKeyProvider
spekeKeyProvider :: Maybe SpekeKeyProvider
$sel:spekeKeyProvider:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe SpekeKeyProvider
spekeKeyProvider} -> Maybe SpekeKeyProvider
spekeKeyProvider) (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe SpekeKeyProvider
a -> HlsEncryptionSettings
s {$sel:spekeKeyProvider:HlsEncryptionSettings' :: Maybe SpekeKeyProvider
spekeKeyProvider = Maybe SpekeKeyProvider
a} :: HlsEncryptionSettings)

-- | The Initialization Vector is a 128-bit number used in conjunction with
-- the key for encrypting blocks. If set to INCLUDE, Initialization Vector
-- is listed in the manifest. Otherwise Initialization Vector is not in the
-- manifest.
hlsEncryptionSettings_initializationVectorInManifest :: Lens.Lens' HlsEncryptionSettings (Prelude.Maybe HlsInitializationVectorInManifest)
hlsEncryptionSettings_initializationVectorInManifest :: (Maybe HlsInitializationVectorInManifest
 -> f (Maybe HlsInitializationVectorInManifest))
-> HlsEncryptionSettings -> f HlsEncryptionSettings
hlsEncryptionSettings_initializationVectorInManifest = (HlsEncryptionSettings -> Maybe HlsInitializationVectorInManifest)
-> (HlsEncryptionSettings
    -> Maybe HlsInitializationVectorInManifest
    -> HlsEncryptionSettings)
-> Lens
     HlsEncryptionSettings
     HlsEncryptionSettings
     (Maybe HlsInitializationVectorInManifest)
     (Maybe HlsInitializationVectorInManifest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HlsEncryptionSettings' {Maybe HlsInitializationVectorInManifest
initializationVectorInManifest :: Maybe HlsInitializationVectorInManifest
$sel:initializationVectorInManifest:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsInitializationVectorInManifest
initializationVectorInManifest} -> Maybe HlsInitializationVectorInManifest
initializationVectorInManifest) (\s :: HlsEncryptionSettings
s@HlsEncryptionSettings' {} Maybe HlsInitializationVectorInManifest
a -> HlsEncryptionSettings
s {$sel:initializationVectorInManifest:HlsEncryptionSettings' :: Maybe HlsInitializationVectorInManifest
initializationVectorInManifest = Maybe HlsInitializationVectorInManifest
a} :: HlsEncryptionSettings)

instance Core.FromJSON HlsEncryptionSettings where
  parseJSON :: Value -> Parser HlsEncryptionSettings
parseJSON =
    String
-> (Object -> Parser HlsEncryptionSettings)
-> Value
-> Parser HlsEncryptionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HlsEncryptionSettings"
      ( \Object
x ->
          Maybe HlsOfflineEncrypted
-> Maybe HlsEncryptionType
-> Maybe Text
-> Maybe HlsKeyProviderType
-> Maybe StaticKeyProvider
-> Maybe SpekeKeyProvider
-> Maybe HlsInitializationVectorInManifest
-> HlsEncryptionSettings
HlsEncryptionSettings'
            (Maybe HlsOfflineEncrypted
 -> Maybe HlsEncryptionType
 -> Maybe Text
 -> Maybe HlsKeyProviderType
 -> Maybe StaticKeyProvider
 -> Maybe SpekeKeyProvider
 -> Maybe HlsInitializationVectorInManifest
 -> HlsEncryptionSettings)
-> Parser (Maybe HlsOfflineEncrypted)
-> Parser
     (Maybe HlsEncryptionType
      -> Maybe Text
      -> Maybe HlsKeyProviderType
      -> Maybe StaticKeyProvider
      -> Maybe SpekeKeyProvider
      -> Maybe HlsInitializationVectorInManifest
      -> HlsEncryptionSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HlsOfflineEncrypted)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"offlineEncrypted")
            Parser
  (Maybe HlsEncryptionType
   -> Maybe Text
   -> Maybe HlsKeyProviderType
   -> Maybe StaticKeyProvider
   -> Maybe SpekeKeyProvider
   -> Maybe HlsInitializationVectorInManifest
   -> HlsEncryptionSettings)
-> Parser (Maybe HlsEncryptionType)
-> Parser
     (Maybe Text
      -> Maybe HlsKeyProviderType
      -> Maybe StaticKeyProvider
      -> Maybe SpekeKeyProvider
      -> Maybe HlsInitializationVectorInManifest
      -> HlsEncryptionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HlsEncryptionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryptionMethod")
            Parser
  (Maybe Text
   -> Maybe HlsKeyProviderType
   -> Maybe StaticKeyProvider
   -> Maybe SpekeKeyProvider
   -> Maybe HlsInitializationVectorInManifest
   -> HlsEncryptionSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe HlsKeyProviderType
      -> Maybe StaticKeyProvider
      -> Maybe SpekeKeyProvider
      -> Maybe HlsInitializationVectorInManifest
      -> HlsEncryptionSettings)
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
"constantInitializationVector")
            Parser
  (Maybe HlsKeyProviderType
   -> Maybe StaticKeyProvider
   -> Maybe SpekeKeyProvider
   -> Maybe HlsInitializationVectorInManifest
   -> HlsEncryptionSettings)
-> Parser (Maybe HlsKeyProviderType)
-> Parser
     (Maybe StaticKeyProvider
      -> Maybe SpekeKeyProvider
      -> Maybe HlsInitializationVectorInManifest
      -> HlsEncryptionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HlsKeyProviderType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser
  (Maybe StaticKeyProvider
   -> Maybe SpekeKeyProvider
   -> Maybe HlsInitializationVectorInManifest
   -> HlsEncryptionSettings)
-> Parser (Maybe StaticKeyProvider)
-> Parser
     (Maybe SpekeKeyProvider
      -> Maybe HlsInitializationVectorInManifest
      -> HlsEncryptionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StaticKeyProvider)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"staticKeyProvider")
            Parser
  (Maybe SpekeKeyProvider
   -> Maybe HlsInitializationVectorInManifest
   -> HlsEncryptionSettings)
-> Parser (Maybe SpekeKeyProvider)
-> Parser
     (Maybe HlsInitializationVectorInManifest -> HlsEncryptionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SpekeKeyProvider)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"spekeKeyProvider")
            Parser
  (Maybe HlsInitializationVectorInManifest -> HlsEncryptionSettings)
-> Parser (Maybe HlsInitializationVectorInManifest)
-> Parser HlsEncryptionSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HlsInitializationVectorInManifest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"initializationVectorInManifest")
      )

instance Prelude.Hashable HlsEncryptionSettings

instance Prelude.NFData HlsEncryptionSettings

instance Core.ToJSON HlsEncryptionSettings where
  toJSON :: HlsEncryptionSettings -> Value
toJSON HlsEncryptionSettings' {Maybe Text
Maybe HlsEncryptionType
Maybe HlsInitializationVectorInManifest
Maybe HlsKeyProviderType
Maybe HlsOfflineEncrypted
Maybe SpekeKeyProvider
Maybe StaticKeyProvider
initializationVectorInManifest :: Maybe HlsInitializationVectorInManifest
spekeKeyProvider :: Maybe SpekeKeyProvider
staticKeyProvider :: Maybe StaticKeyProvider
type' :: Maybe HlsKeyProviderType
constantInitializationVector :: Maybe Text
encryptionMethod :: Maybe HlsEncryptionType
offlineEncrypted :: Maybe HlsOfflineEncrypted
$sel:initializationVectorInManifest:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsInitializationVectorInManifest
$sel:spekeKeyProvider:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe SpekeKeyProvider
$sel:staticKeyProvider:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe StaticKeyProvider
$sel:type':HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsKeyProviderType
$sel:constantInitializationVector:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe Text
$sel:encryptionMethod:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsEncryptionType
$sel:offlineEncrypted:HlsEncryptionSettings' :: HlsEncryptionSettings -> Maybe HlsOfflineEncrypted
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"offlineEncrypted" Text -> HlsOfflineEncrypted -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HlsOfflineEncrypted -> Pair)
-> Maybe HlsOfflineEncrypted -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsOfflineEncrypted
offlineEncrypted,
            (Text
"encryptionMethod" Text -> HlsEncryptionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HlsEncryptionType -> Pair)
-> Maybe HlsEncryptionType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsEncryptionType
encryptionMethod,
            (Text
"constantInitializationVector" 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
constantInitializationVector,
            (Text
"type" Text -> HlsKeyProviderType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HlsKeyProviderType -> Pair)
-> Maybe HlsKeyProviderType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsKeyProviderType
type',
            (Text
"staticKeyProvider" Text -> StaticKeyProvider -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StaticKeyProvider -> Pair)
-> Maybe StaticKeyProvider -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StaticKeyProvider
staticKeyProvider,
            (Text
"spekeKeyProvider" Text -> SpekeKeyProvider -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SpekeKeyProvider -> Pair) -> Maybe SpekeKeyProvider -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SpekeKeyProvider
spekeKeyProvider,
            (Text
"initializationVectorInManifest" Text -> HlsInitializationVectorInManifest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HlsInitializationVectorInManifest -> Pair)
-> Maybe HlsInitializationVectorInManifest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HlsInitializationVectorInManifest
initializationVectorInManifest
          ]
      )