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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.CmafEncryptionType
import Amazonka.MediaConvert.Types.CmafInitializationVectorInManifest
import Amazonka.MediaConvert.Types.CmafKeyProviderType
import Amazonka.MediaConvert.Types.SpekeKeyProviderCmaf
import Amazonka.MediaConvert.Types.StaticKeyProvider
import qualified Amazonka.Prelude as Prelude

-- | Settings for CMAF encryption
--
-- /See:/ 'newCmafEncryptionSettings' smart constructor.
data CmafEncryptionSettings = CmafEncryptionSettings'
  { -- | Specify the encryption scheme that you want the service to use when
    -- encrypting your CMAF segments. Choose AES-CBC subsample (SAMPLE-AES) or
    -- AES_CTR (AES-CTR).
    CmafEncryptionSettings -> Maybe CmafEncryptionType
encryptionMethod :: Prelude.Maybe CmafEncryptionType,
    -- | 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.
    CmafEncryptionSettings -> 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.
    CmafEncryptionSettings -> Maybe CmafKeyProviderType
type' :: Prelude.Maybe CmafKeyProviderType,
    -- | Use these settings to set up encryption with a static key provider.
    CmafEncryptionSettings -> Maybe StaticKeyProvider
staticKeyProvider :: Prelude.Maybe StaticKeyProvider,
    -- | If your output group type is CMAF, use these settings when doing DRM
    -- encryption with a SPEKE-compliant key provider. If your output group
    -- type is HLS, DASH, or Microsoft Smooth, use the SpekeKeyProvider
    -- settings instead.
    CmafEncryptionSettings -> Maybe SpekeKeyProviderCmaf
spekeKeyProvider :: Prelude.Maybe SpekeKeyProviderCmaf,
    -- | When you use DRM with CMAF outputs, choose whether the service writes
    -- the 128-bit encryption initialization vector in the HLS and DASH
    -- manifests.
    CmafEncryptionSettings -> Maybe CmafInitializationVectorInManifest
initializationVectorInManifest :: Prelude.Maybe CmafInitializationVectorInManifest
  }
  deriving (CmafEncryptionSettings -> CmafEncryptionSettings -> Bool
(CmafEncryptionSettings -> CmafEncryptionSettings -> Bool)
-> (CmafEncryptionSettings -> CmafEncryptionSettings -> Bool)
-> Eq CmafEncryptionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmafEncryptionSettings -> CmafEncryptionSettings -> Bool
$c/= :: CmafEncryptionSettings -> CmafEncryptionSettings -> Bool
== :: CmafEncryptionSettings -> CmafEncryptionSettings -> Bool
$c== :: CmafEncryptionSettings -> CmafEncryptionSettings -> Bool
Prelude.Eq, ReadPrec [CmafEncryptionSettings]
ReadPrec CmafEncryptionSettings
Int -> ReadS CmafEncryptionSettings
ReadS [CmafEncryptionSettings]
(Int -> ReadS CmafEncryptionSettings)
-> ReadS [CmafEncryptionSettings]
-> ReadPrec CmafEncryptionSettings
-> ReadPrec [CmafEncryptionSettings]
-> Read CmafEncryptionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmafEncryptionSettings]
$creadListPrec :: ReadPrec [CmafEncryptionSettings]
readPrec :: ReadPrec CmafEncryptionSettings
$creadPrec :: ReadPrec CmafEncryptionSettings
readList :: ReadS [CmafEncryptionSettings]
$creadList :: ReadS [CmafEncryptionSettings]
readsPrec :: Int -> ReadS CmafEncryptionSettings
$creadsPrec :: Int -> ReadS CmafEncryptionSettings
Prelude.Read, Int -> CmafEncryptionSettings -> ShowS
[CmafEncryptionSettings] -> ShowS
CmafEncryptionSettings -> String
(Int -> CmafEncryptionSettings -> ShowS)
-> (CmafEncryptionSettings -> String)
-> ([CmafEncryptionSettings] -> ShowS)
-> Show CmafEncryptionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmafEncryptionSettings] -> ShowS
$cshowList :: [CmafEncryptionSettings] -> ShowS
show :: CmafEncryptionSettings -> String
$cshow :: CmafEncryptionSettings -> String
showsPrec :: Int -> CmafEncryptionSettings -> ShowS
$cshowsPrec :: Int -> CmafEncryptionSettings -> ShowS
Prelude.Show, (forall x. CmafEncryptionSettings -> Rep CmafEncryptionSettings x)
-> (forall x.
    Rep CmafEncryptionSettings x -> CmafEncryptionSettings)
-> Generic CmafEncryptionSettings
forall x. Rep CmafEncryptionSettings x -> CmafEncryptionSettings
forall x. CmafEncryptionSettings -> Rep CmafEncryptionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CmafEncryptionSettings x -> CmafEncryptionSettings
$cfrom :: forall x. CmafEncryptionSettings -> Rep CmafEncryptionSettings x
Prelude.Generic)

-- |
-- Create a value of 'CmafEncryptionSettings' 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:
--
-- 'encryptionMethod', 'cmafEncryptionSettings_encryptionMethod' - Specify the encryption scheme that you want the service to use when
-- encrypting your CMAF segments. Choose AES-CBC subsample (SAMPLE-AES) or
-- AES_CTR (AES-CTR).
--
-- 'constantInitializationVector', 'cmafEncryptionSettings_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'', 'cmafEncryptionSettings_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', 'cmafEncryptionSettings_staticKeyProvider' - Use these settings to set up encryption with a static key provider.
--
-- 'spekeKeyProvider', 'cmafEncryptionSettings_spekeKeyProvider' - If your output group type is CMAF, use these settings when doing DRM
-- encryption with a SPEKE-compliant key provider. If your output group
-- type is HLS, DASH, or Microsoft Smooth, use the SpekeKeyProvider
-- settings instead.
--
-- 'initializationVectorInManifest', 'cmafEncryptionSettings_initializationVectorInManifest' - When you use DRM with CMAF outputs, choose whether the service writes
-- the 128-bit encryption initialization vector in the HLS and DASH
-- manifests.
newCmafEncryptionSettings ::
  CmafEncryptionSettings
newCmafEncryptionSettings :: CmafEncryptionSettings
newCmafEncryptionSettings =
  CmafEncryptionSettings' :: Maybe CmafEncryptionType
-> Maybe Text
-> Maybe CmafKeyProviderType
-> Maybe StaticKeyProvider
-> Maybe SpekeKeyProviderCmaf
-> Maybe CmafInitializationVectorInManifest
-> CmafEncryptionSettings
CmafEncryptionSettings'
    { $sel:encryptionMethod:CmafEncryptionSettings' :: Maybe CmafEncryptionType
encryptionMethod =
        Maybe CmafEncryptionType
forall a. Maybe a
Prelude.Nothing,
      $sel:constantInitializationVector:CmafEncryptionSettings' :: Maybe Text
constantInitializationVector = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':CmafEncryptionSettings' :: Maybe CmafKeyProviderType
type' = Maybe CmafKeyProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:staticKeyProvider:CmafEncryptionSettings' :: Maybe StaticKeyProvider
staticKeyProvider = Maybe StaticKeyProvider
forall a. Maybe a
Prelude.Nothing,
      $sel:spekeKeyProvider:CmafEncryptionSettings' :: Maybe SpekeKeyProviderCmaf
spekeKeyProvider = Maybe SpekeKeyProviderCmaf
forall a. Maybe a
Prelude.Nothing,
      $sel:initializationVectorInManifest:CmafEncryptionSettings' :: Maybe CmafInitializationVectorInManifest
initializationVectorInManifest = Maybe CmafInitializationVectorInManifest
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify the encryption scheme that you want the service to use when
-- encrypting your CMAF segments. Choose AES-CBC subsample (SAMPLE-AES) or
-- AES_CTR (AES-CTR).
cmafEncryptionSettings_encryptionMethod :: Lens.Lens' CmafEncryptionSettings (Prelude.Maybe CmafEncryptionType)
cmafEncryptionSettings_encryptionMethod :: (Maybe CmafEncryptionType -> f (Maybe CmafEncryptionType))
-> CmafEncryptionSettings -> f CmafEncryptionSettings
cmafEncryptionSettings_encryptionMethod = (CmafEncryptionSettings -> Maybe CmafEncryptionType)
-> (CmafEncryptionSettings
    -> Maybe CmafEncryptionType -> CmafEncryptionSettings)
-> Lens
     CmafEncryptionSettings
     CmafEncryptionSettings
     (Maybe CmafEncryptionType)
     (Maybe CmafEncryptionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryptionSettings' {Maybe CmafEncryptionType
encryptionMethod :: Maybe CmafEncryptionType
$sel:encryptionMethod:CmafEncryptionSettings' :: CmafEncryptionSettings -> Maybe CmafEncryptionType
encryptionMethod} -> Maybe CmafEncryptionType
encryptionMethod) (\s :: CmafEncryptionSettings
s@CmafEncryptionSettings' {} Maybe CmafEncryptionType
a -> CmafEncryptionSettings
s {$sel:encryptionMethod:CmafEncryptionSettings' :: Maybe CmafEncryptionType
encryptionMethod = Maybe CmafEncryptionType
a} :: CmafEncryptionSettings)

-- | 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.
cmafEncryptionSettings_constantInitializationVector :: Lens.Lens' CmafEncryptionSettings (Prelude.Maybe Prelude.Text)
cmafEncryptionSettings_constantInitializationVector :: (Maybe Text -> f (Maybe Text))
-> CmafEncryptionSettings -> f CmafEncryptionSettings
cmafEncryptionSettings_constantInitializationVector = (CmafEncryptionSettings -> Maybe Text)
-> (CmafEncryptionSettings -> Maybe Text -> CmafEncryptionSettings)
-> Lens
     CmafEncryptionSettings
     CmafEncryptionSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryptionSettings' {Maybe Text
constantInitializationVector :: Maybe Text
$sel:constantInitializationVector:CmafEncryptionSettings' :: CmafEncryptionSettings -> Maybe Text
constantInitializationVector} -> Maybe Text
constantInitializationVector) (\s :: CmafEncryptionSettings
s@CmafEncryptionSettings' {} Maybe Text
a -> CmafEncryptionSettings
s {$sel:constantInitializationVector:CmafEncryptionSettings' :: Maybe Text
constantInitializationVector = Maybe Text
a} :: CmafEncryptionSettings)

-- | 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.
cmafEncryptionSettings_type :: Lens.Lens' CmafEncryptionSettings (Prelude.Maybe CmafKeyProviderType)
cmafEncryptionSettings_type :: (Maybe CmafKeyProviderType -> f (Maybe CmafKeyProviderType))
-> CmafEncryptionSettings -> f CmafEncryptionSettings
cmafEncryptionSettings_type = (CmafEncryptionSettings -> Maybe CmafKeyProviderType)
-> (CmafEncryptionSettings
    -> Maybe CmafKeyProviderType -> CmafEncryptionSettings)
-> Lens
     CmafEncryptionSettings
     CmafEncryptionSettings
     (Maybe CmafKeyProviderType)
     (Maybe CmafKeyProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryptionSettings' {Maybe CmafKeyProviderType
type' :: Maybe CmafKeyProviderType
$sel:type':CmafEncryptionSettings' :: CmafEncryptionSettings -> Maybe CmafKeyProviderType
type'} -> Maybe CmafKeyProviderType
type') (\s :: CmafEncryptionSettings
s@CmafEncryptionSettings' {} Maybe CmafKeyProviderType
a -> CmafEncryptionSettings
s {$sel:type':CmafEncryptionSettings' :: Maybe CmafKeyProviderType
type' = Maybe CmafKeyProviderType
a} :: CmafEncryptionSettings)

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

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

-- | When you use DRM with CMAF outputs, choose whether the service writes
-- the 128-bit encryption initialization vector in the HLS and DASH
-- manifests.
cmafEncryptionSettings_initializationVectorInManifest :: Lens.Lens' CmafEncryptionSettings (Prelude.Maybe CmafInitializationVectorInManifest)
cmafEncryptionSettings_initializationVectorInManifest :: (Maybe CmafInitializationVectorInManifest
 -> f (Maybe CmafInitializationVectorInManifest))
-> CmafEncryptionSettings -> f CmafEncryptionSettings
cmafEncryptionSettings_initializationVectorInManifest = (CmafEncryptionSettings
 -> Maybe CmafInitializationVectorInManifest)
-> (CmafEncryptionSettings
    -> Maybe CmafInitializationVectorInManifest
    -> CmafEncryptionSettings)
-> Lens
     CmafEncryptionSettings
     CmafEncryptionSettings
     (Maybe CmafInitializationVectorInManifest)
     (Maybe CmafInitializationVectorInManifest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CmafEncryptionSettings' {Maybe CmafInitializationVectorInManifest
initializationVectorInManifest :: Maybe CmafInitializationVectorInManifest
$sel:initializationVectorInManifest:CmafEncryptionSettings' :: CmafEncryptionSettings -> Maybe CmafInitializationVectorInManifest
initializationVectorInManifest} -> Maybe CmafInitializationVectorInManifest
initializationVectorInManifest) (\s :: CmafEncryptionSettings
s@CmafEncryptionSettings' {} Maybe CmafInitializationVectorInManifest
a -> CmafEncryptionSettings
s {$sel:initializationVectorInManifest:CmafEncryptionSettings' :: Maybe CmafInitializationVectorInManifest
initializationVectorInManifest = Maybe CmafInitializationVectorInManifest
a} :: CmafEncryptionSettings)

instance Core.FromJSON CmafEncryptionSettings where
  parseJSON :: Value -> Parser CmafEncryptionSettings
parseJSON =
    String
-> (Object -> Parser CmafEncryptionSettings)
-> Value
-> Parser CmafEncryptionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CmafEncryptionSettings"
      ( \Object
x ->
          Maybe CmafEncryptionType
-> Maybe Text
-> Maybe CmafKeyProviderType
-> Maybe StaticKeyProvider
-> Maybe SpekeKeyProviderCmaf
-> Maybe CmafInitializationVectorInManifest
-> CmafEncryptionSettings
CmafEncryptionSettings'
            (Maybe CmafEncryptionType
 -> Maybe Text
 -> Maybe CmafKeyProviderType
 -> Maybe StaticKeyProvider
 -> Maybe SpekeKeyProviderCmaf
 -> Maybe CmafInitializationVectorInManifest
 -> CmafEncryptionSettings)
-> Parser (Maybe CmafEncryptionType)
-> Parser
     (Maybe Text
      -> Maybe CmafKeyProviderType
      -> Maybe StaticKeyProvider
      -> Maybe SpekeKeyProviderCmaf
      -> Maybe CmafInitializationVectorInManifest
      -> CmafEncryptionSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CmafEncryptionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"encryptionMethod")
            Parser
  (Maybe Text
   -> Maybe CmafKeyProviderType
   -> Maybe StaticKeyProvider
   -> Maybe SpekeKeyProviderCmaf
   -> Maybe CmafInitializationVectorInManifest
   -> CmafEncryptionSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe CmafKeyProviderType
      -> Maybe StaticKeyProvider
      -> Maybe SpekeKeyProviderCmaf
      -> Maybe CmafInitializationVectorInManifest
      -> CmafEncryptionSettings)
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 CmafKeyProviderType
   -> Maybe StaticKeyProvider
   -> Maybe SpekeKeyProviderCmaf
   -> Maybe CmafInitializationVectorInManifest
   -> CmafEncryptionSettings)
-> Parser (Maybe CmafKeyProviderType)
-> Parser
     (Maybe StaticKeyProvider
      -> Maybe SpekeKeyProviderCmaf
      -> Maybe CmafInitializationVectorInManifest
      -> CmafEncryptionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CmafKeyProviderType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser
  (Maybe StaticKeyProvider
   -> Maybe SpekeKeyProviderCmaf
   -> Maybe CmafInitializationVectorInManifest
   -> CmafEncryptionSettings)
-> Parser (Maybe StaticKeyProvider)
-> Parser
     (Maybe SpekeKeyProviderCmaf
      -> Maybe CmafInitializationVectorInManifest
      -> CmafEncryptionSettings)
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 SpekeKeyProviderCmaf
   -> Maybe CmafInitializationVectorInManifest
   -> CmafEncryptionSettings)
-> Parser (Maybe SpekeKeyProviderCmaf)
-> Parser
     (Maybe CmafInitializationVectorInManifest
      -> CmafEncryptionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SpekeKeyProviderCmaf)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"spekeKeyProvider")
            Parser
  (Maybe CmafInitializationVectorInManifest
   -> CmafEncryptionSettings)
-> Parser (Maybe CmafInitializationVectorInManifest)
-> Parser CmafEncryptionSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CmafInitializationVectorInManifest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"initializationVectorInManifest")
      )

instance Prelude.Hashable CmafEncryptionSettings

instance Prelude.NFData CmafEncryptionSettings

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