{-# 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.MssEncryption
-- 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.MediaPackageVOD.Types.MssEncryption where

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

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

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

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

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

instance Prelude.Hashable MssEncryption where
  hashWithSalt :: Int -> MssEncryption -> Int
hashWithSalt Int
_salt MssEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:MssEncryption' :: MssEncryption -> SpekeKeyProvider
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SpekeKeyProvider
spekeKeyProvider

instance Prelude.NFData MssEncryption where
  rnf :: MssEncryption -> ()
rnf MssEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:MssEncryption' :: MssEncryption -> SpekeKeyProvider
..} = forall a. NFData a => a -> ()
Prelude.rnf SpekeKeyProvider
spekeKeyProvider

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