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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackageVOD.Types.SpekeKeyProvider
import qualified Amazonka.Prelude as Prelude

-- | A Dynamic Adaptive Streaming over HTTP (DASH) encryption configuration.
--
-- /See:/ 'newDashEncryption' smart constructor.
data DashEncryption = DashEncryption'
  { DashEncryption -> SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
  }
  deriving (DashEncryption -> DashEncryption -> Bool
(DashEncryption -> DashEncryption -> Bool)
-> (DashEncryption -> DashEncryption -> Bool) -> Eq DashEncryption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DashEncryption -> DashEncryption -> Bool
$c/= :: DashEncryption -> DashEncryption -> Bool
== :: DashEncryption -> DashEncryption -> Bool
$c== :: DashEncryption -> DashEncryption -> Bool
Prelude.Eq, ReadPrec [DashEncryption]
ReadPrec DashEncryption
Int -> ReadS DashEncryption
ReadS [DashEncryption]
(Int -> ReadS DashEncryption)
-> ReadS [DashEncryption]
-> ReadPrec DashEncryption
-> ReadPrec [DashEncryption]
-> Read DashEncryption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DashEncryption]
$creadListPrec :: ReadPrec [DashEncryption]
readPrec :: ReadPrec DashEncryption
$creadPrec :: ReadPrec DashEncryption
readList :: ReadS [DashEncryption]
$creadList :: ReadS [DashEncryption]
readsPrec :: Int -> ReadS DashEncryption
$creadsPrec :: Int -> ReadS DashEncryption
Prelude.Read, Int -> DashEncryption -> ShowS
[DashEncryption] -> ShowS
DashEncryption -> String
(Int -> DashEncryption -> ShowS)
-> (DashEncryption -> String)
-> ([DashEncryption] -> ShowS)
-> Show DashEncryption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DashEncryption] -> ShowS
$cshowList :: [DashEncryption] -> ShowS
show :: DashEncryption -> String
$cshow :: DashEncryption -> String
showsPrec :: Int -> DashEncryption -> ShowS
$cshowsPrec :: Int -> DashEncryption -> ShowS
Prelude.Show, (forall x. DashEncryption -> Rep DashEncryption x)
-> (forall x. Rep DashEncryption x -> DashEncryption)
-> Generic DashEncryption
forall x. Rep DashEncryption x -> DashEncryption
forall x. DashEncryption -> Rep DashEncryption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DashEncryption x -> DashEncryption
$cfrom :: forall x. DashEncryption -> Rep DashEncryption x
Prelude.Generic)

-- |
-- Create a value of 'DashEncryption' 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:
--
-- 'spekeKeyProvider', 'dashEncryption_spekeKeyProvider' - Undocumented member.
newDashEncryption ::
  -- | 'spekeKeyProvider'
  SpekeKeyProvider ->
  DashEncryption
newDashEncryption :: SpekeKeyProvider -> DashEncryption
newDashEncryption SpekeKeyProvider
pSpekeKeyProvider_ =
  DashEncryption' :: SpekeKeyProvider -> DashEncryption
DashEncryption'
    { $sel:spekeKeyProvider:DashEncryption' :: SpekeKeyProvider
spekeKeyProvider =
        SpekeKeyProvider
pSpekeKeyProvider_
    }

-- | Undocumented member.
dashEncryption_spekeKeyProvider :: Lens.Lens' DashEncryption SpekeKeyProvider
dashEncryption_spekeKeyProvider :: (SpekeKeyProvider -> f SpekeKeyProvider)
-> DashEncryption -> f DashEncryption
dashEncryption_spekeKeyProvider = (DashEncryption -> SpekeKeyProvider)
-> (DashEncryption -> SpekeKeyProvider -> DashEncryption)
-> Lens
     DashEncryption DashEncryption SpekeKeyProvider SpekeKeyProvider
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DashEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:DashEncryption' :: DashEncryption -> SpekeKeyProvider
spekeKeyProvider} -> SpekeKeyProvider
spekeKeyProvider) (\s :: DashEncryption
s@DashEncryption' {} SpekeKeyProvider
a -> DashEncryption
s {$sel:spekeKeyProvider:DashEncryption' :: SpekeKeyProvider
spekeKeyProvider = SpekeKeyProvider
a} :: DashEncryption)

instance Core.FromJSON DashEncryption where
  parseJSON :: Value -> Parser DashEncryption
parseJSON =
    String
-> (Object -> Parser DashEncryption)
-> Value
-> Parser DashEncryption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DashEncryption"
      ( \Object
x ->
          SpekeKeyProvider -> DashEncryption
DashEncryption'
            (SpekeKeyProvider -> DashEncryption)
-> Parser SpekeKeyProvider -> Parser DashEncryption
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser SpekeKeyProvider
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"spekeKeyProvider")
      )

instance Prelude.Hashable DashEncryption

instance Prelude.NFData DashEncryption

instance Core.ToJSON DashEncryption where
  toJSON :: DashEncryption -> Value
toJSON DashEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:DashEncryption' :: DashEncryption -> SpekeKeyProvider
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"spekeKeyProvider" Text -> SpekeKeyProvider -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SpekeKeyProvider
spekeKeyProvider)
          ]
      )