{-# 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.MediaLive.Types.KeyProviderSettings
-- 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.MediaLive.Types.KeyProviderSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.StaticKeySettings
import qualified Amazonka.Prelude as Prelude

-- | Key Provider Settings
--
-- /See:/ 'newKeyProviderSettings' smart constructor.
data KeyProviderSettings = KeyProviderSettings'
  { KeyProviderSettings -> Maybe StaticKeySettings
staticKeySettings :: Prelude.Maybe StaticKeySettings
  }
  deriving (KeyProviderSettings -> KeyProviderSettings -> Bool
(KeyProviderSettings -> KeyProviderSettings -> Bool)
-> (KeyProviderSettings -> KeyProviderSettings -> Bool)
-> Eq KeyProviderSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyProviderSettings -> KeyProviderSettings -> Bool
$c/= :: KeyProviderSettings -> KeyProviderSettings -> Bool
== :: KeyProviderSettings -> KeyProviderSettings -> Bool
$c== :: KeyProviderSettings -> KeyProviderSettings -> Bool
Prelude.Eq, ReadPrec [KeyProviderSettings]
ReadPrec KeyProviderSettings
Int -> ReadS KeyProviderSettings
ReadS [KeyProviderSettings]
(Int -> ReadS KeyProviderSettings)
-> ReadS [KeyProviderSettings]
-> ReadPrec KeyProviderSettings
-> ReadPrec [KeyProviderSettings]
-> Read KeyProviderSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyProviderSettings]
$creadListPrec :: ReadPrec [KeyProviderSettings]
readPrec :: ReadPrec KeyProviderSettings
$creadPrec :: ReadPrec KeyProviderSettings
readList :: ReadS [KeyProviderSettings]
$creadList :: ReadS [KeyProviderSettings]
readsPrec :: Int -> ReadS KeyProviderSettings
$creadsPrec :: Int -> ReadS KeyProviderSettings
Prelude.Read, Int -> KeyProviderSettings -> ShowS
[KeyProviderSettings] -> ShowS
KeyProviderSettings -> String
(Int -> KeyProviderSettings -> ShowS)
-> (KeyProviderSettings -> String)
-> ([KeyProviderSettings] -> ShowS)
-> Show KeyProviderSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyProviderSettings] -> ShowS
$cshowList :: [KeyProviderSettings] -> ShowS
show :: KeyProviderSettings -> String
$cshow :: KeyProviderSettings -> String
showsPrec :: Int -> KeyProviderSettings -> ShowS
$cshowsPrec :: Int -> KeyProviderSettings -> ShowS
Prelude.Show, (forall x. KeyProviderSettings -> Rep KeyProviderSettings x)
-> (forall x. Rep KeyProviderSettings x -> KeyProviderSettings)
-> Generic KeyProviderSettings
forall x. Rep KeyProviderSettings x -> KeyProviderSettings
forall x. KeyProviderSettings -> Rep KeyProviderSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyProviderSettings x -> KeyProviderSettings
$cfrom :: forall x. KeyProviderSettings -> Rep KeyProviderSettings x
Prelude.Generic)

-- |
-- Create a value of 'KeyProviderSettings' 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:
--
-- 'staticKeySettings', 'keyProviderSettings_staticKeySettings' - Undocumented member.
newKeyProviderSettings ::
  KeyProviderSettings
newKeyProviderSettings :: KeyProviderSettings
newKeyProviderSettings =
  KeyProviderSettings' :: Maybe StaticKeySettings -> KeyProviderSettings
KeyProviderSettings'
    { $sel:staticKeySettings:KeyProviderSettings' :: Maybe StaticKeySettings
staticKeySettings =
        Maybe StaticKeySettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
keyProviderSettings_staticKeySettings :: Lens.Lens' KeyProviderSettings (Prelude.Maybe StaticKeySettings)
keyProviderSettings_staticKeySettings :: (Maybe StaticKeySettings -> f (Maybe StaticKeySettings))
-> KeyProviderSettings -> f KeyProviderSettings
keyProviderSettings_staticKeySettings = (KeyProviderSettings -> Maybe StaticKeySettings)
-> (KeyProviderSettings
    -> Maybe StaticKeySettings -> KeyProviderSettings)
-> Lens
     KeyProviderSettings
     KeyProviderSettings
     (Maybe StaticKeySettings)
     (Maybe StaticKeySettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyProviderSettings' {Maybe StaticKeySettings
staticKeySettings :: Maybe StaticKeySettings
$sel:staticKeySettings:KeyProviderSettings' :: KeyProviderSettings -> Maybe StaticKeySettings
staticKeySettings} -> Maybe StaticKeySettings
staticKeySettings) (\s :: KeyProviderSettings
s@KeyProviderSettings' {} Maybe StaticKeySettings
a -> KeyProviderSettings
s {$sel:staticKeySettings:KeyProviderSettings' :: Maybe StaticKeySettings
staticKeySettings = Maybe StaticKeySettings
a} :: KeyProviderSettings)

instance Core.FromJSON KeyProviderSettings where
  parseJSON :: Value -> Parser KeyProviderSettings
parseJSON =
    String
-> (Object -> Parser KeyProviderSettings)
-> Value
-> Parser KeyProviderSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"KeyProviderSettings"
      ( \Object
x ->
          Maybe StaticKeySettings -> KeyProviderSettings
KeyProviderSettings'
            (Maybe StaticKeySettings -> KeyProviderSettings)
-> Parser (Maybe StaticKeySettings) -> Parser KeyProviderSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe StaticKeySettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"staticKeySettings")
      )

instance Prelude.Hashable KeyProviderSettings

instance Prelude.NFData KeyProviderSettings

instance Core.ToJSON KeyProviderSettings where
  toJSON :: KeyProviderSettings -> Value
toJSON KeyProviderSettings' {Maybe StaticKeySettings
staticKeySettings :: Maybe StaticKeySettings
$sel:staticKeySettings:KeyProviderSettings' :: KeyProviderSettings -> Maybe StaticKeySettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"staticKeySettings" Text -> StaticKeySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StaticKeySettings -> Pair)
-> Maybe StaticKeySettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StaticKeySettings
staticKeySettings
          ]
      )