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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.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
(MssEncryption -> MssEncryption -> Bool)
-> (MssEncryption -> MssEncryption -> Bool) -> Eq MssEncryption
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]
(Int -> ReadS MssEncryption)
-> ReadS [MssEncryption]
-> ReadPrec MssEncryption
-> ReadPrec [MssEncryption]
-> Read 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
(Int -> MssEncryption -> ShowS)
-> (MssEncryption -> String)
-> ([MssEncryption] -> ShowS)
-> Show MssEncryption
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. MssEncryption -> Rep MssEncryption x)
-> (forall x. Rep MssEncryption x -> MssEncryption)
-> Generic MssEncryption
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' :: SpekeKeyProvider -> MssEncryption
MssEncryption'
    { $sel:spekeKeyProvider:MssEncryption' :: SpekeKeyProvider
spekeKeyProvider =
        SpekeKeyProvider
pSpekeKeyProvider_
    }

-- | Undocumented member.
mssEncryption_spekeKeyProvider :: Lens.Lens' MssEncryption SpekeKeyProvider
mssEncryption_spekeKeyProvider :: (SpekeKeyProvider -> f SpekeKeyProvider)
-> MssEncryption -> f MssEncryption
mssEncryption_spekeKeyProvider = (MssEncryption -> SpekeKeyProvider)
-> (MssEncryption -> SpekeKeyProvider -> MssEncryption)
-> Lens
     MssEncryption MssEncryption SpekeKeyProvider 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 Core.FromJSON MssEncryption where
  parseJSON :: Value -> Parser MssEncryption
parseJSON =
    String
-> (Object -> Parser MssEncryption)
-> Value
-> Parser MssEncryption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MssEncryption"
      ( \Object
x ->
          SpekeKeyProvider -> MssEncryption
MssEncryption'
            (SpekeKeyProvider -> MssEncryption)
-> Parser SpekeKeyProvider -> Parser MssEncryption
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 MssEncryption

instance Prelude.NFData MssEncryption

instance Core.ToJSON MssEncryption where
  toJSON :: MssEncryption -> Value
toJSON MssEncryption' {SpekeKeyProvider
spekeKeyProvider :: SpekeKeyProvider
$sel:spekeKeyProvider:MssEncryption' :: MssEncryption -> 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)
          ]
      )