{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.KeyProviderSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:staticKeySettings:KeyProviderSettings' :: Maybe StaticKeySettings
staticKeySettings =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
keyProviderSettings_staticKeySettings :: Lens.Lens' KeyProviderSettings (Prelude.Maybe StaticKeySettings)
keyProviderSettings_staticKeySettings :: Lens' KeyProviderSettings (Maybe StaticKeySettings)
keyProviderSettings_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 Data.FromJSON KeyProviderSettings where
  parseJSON :: Value -> Parser KeyProviderSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"KeyProviderSettings"
      ( \Object
x ->
          Maybe StaticKeySettings -> KeyProviderSettings
KeyProviderSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"staticKeySettings")
      )

instance Prelude.Hashable KeyProviderSettings where
  hashWithSalt :: Int -> KeyProviderSettings -> Int
hashWithSalt Int
_salt KeyProviderSettings' {Maybe StaticKeySettings
staticKeySettings :: Maybe StaticKeySettings
$sel:staticKeySettings:KeyProviderSettings' :: KeyProviderSettings -> Maybe StaticKeySettings
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StaticKeySettings
staticKeySettings

instance Prelude.NFData KeyProviderSettings where
  rnf :: KeyProviderSettings -> ()
rnf KeyProviderSettings' {Maybe StaticKeySettings
staticKeySettings :: Maybe StaticKeySettings
$sel:staticKeySettings:KeyProviderSettings' :: KeyProviderSettings -> Maybe StaticKeySettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StaticKeySettings
staticKeySettings

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