{-# 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.AmplifyBackend.Types.UpdateBackendAuthMFAConfig
-- 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.AmplifyBackend.Types.UpdateBackendAuthMFAConfig where

import Amazonka.AmplifyBackend.Types.MFAMode
import Amazonka.AmplifyBackend.Types.Settings
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Updates the multi-factor authentication (MFA) configuration for the
-- backend of your Amplify project.
--
-- /See:/ 'newUpdateBackendAuthMFAConfig' smart constructor.
data UpdateBackendAuthMFAConfig = UpdateBackendAuthMFAConfig'
  { -- | The settings of your MFA configuration for the backend of your Amplify
    -- project.
    UpdateBackendAuthMFAConfig -> Maybe Settings
settings :: Prelude.Maybe Settings,
    -- | The MFA mode for the backend of your Amplify project.
    UpdateBackendAuthMFAConfig -> Maybe MFAMode
mfaMode :: Prelude.Maybe MFAMode
  }
  deriving (UpdateBackendAuthMFAConfig -> UpdateBackendAuthMFAConfig -> Bool
(UpdateBackendAuthMFAConfig -> UpdateBackendAuthMFAConfig -> Bool)
-> (UpdateBackendAuthMFAConfig
    -> UpdateBackendAuthMFAConfig -> Bool)
-> Eq UpdateBackendAuthMFAConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBackendAuthMFAConfig -> UpdateBackendAuthMFAConfig -> Bool
$c/= :: UpdateBackendAuthMFAConfig -> UpdateBackendAuthMFAConfig -> Bool
== :: UpdateBackendAuthMFAConfig -> UpdateBackendAuthMFAConfig -> Bool
$c== :: UpdateBackendAuthMFAConfig -> UpdateBackendAuthMFAConfig -> Bool
Prelude.Eq, ReadPrec [UpdateBackendAuthMFAConfig]
ReadPrec UpdateBackendAuthMFAConfig
Int -> ReadS UpdateBackendAuthMFAConfig
ReadS [UpdateBackendAuthMFAConfig]
(Int -> ReadS UpdateBackendAuthMFAConfig)
-> ReadS [UpdateBackendAuthMFAConfig]
-> ReadPrec UpdateBackendAuthMFAConfig
-> ReadPrec [UpdateBackendAuthMFAConfig]
-> Read UpdateBackendAuthMFAConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBackendAuthMFAConfig]
$creadListPrec :: ReadPrec [UpdateBackendAuthMFAConfig]
readPrec :: ReadPrec UpdateBackendAuthMFAConfig
$creadPrec :: ReadPrec UpdateBackendAuthMFAConfig
readList :: ReadS [UpdateBackendAuthMFAConfig]
$creadList :: ReadS [UpdateBackendAuthMFAConfig]
readsPrec :: Int -> ReadS UpdateBackendAuthMFAConfig
$creadsPrec :: Int -> ReadS UpdateBackendAuthMFAConfig
Prelude.Read, Int -> UpdateBackendAuthMFAConfig -> ShowS
[UpdateBackendAuthMFAConfig] -> ShowS
UpdateBackendAuthMFAConfig -> String
(Int -> UpdateBackendAuthMFAConfig -> ShowS)
-> (UpdateBackendAuthMFAConfig -> String)
-> ([UpdateBackendAuthMFAConfig] -> ShowS)
-> Show UpdateBackendAuthMFAConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBackendAuthMFAConfig] -> ShowS
$cshowList :: [UpdateBackendAuthMFAConfig] -> ShowS
show :: UpdateBackendAuthMFAConfig -> String
$cshow :: UpdateBackendAuthMFAConfig -> String
showsPrec :: Int -> UpdateBackendAuthMFAConfig -> ShowS
$cshowsPrec :: Int -> UpdateBackendAuthMFAConfig -> ShowS
Prelude.Show, (forall x.
 UpdateBackendAuthMFAConfig -> Rep UpdateBackendAuthMFAConfig x)
-> (forall x.
    Rep UpdateBackendAuthMFAConfig x -> UpdateBackendAuthMFAConfig)
-> Generic UpdateBackendAuthMFAConfig
forall x.
Rep UpdateBackendAuthMFAConfig x -> UpdateBackendAuthMFAConfig
forall x.
UpdateBackendAuthMFAConfig -> Rep UpdateBackendAuthMFAConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateBackendAuthMFAConfig x -> UpdateBackendAuthMFAConfig
$cfrom :: forall x.
UpdateBackendAuthMFAConfig -> Rep UpdateBackendAuthMFAConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateBackendAuthMFAConfig' 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:
--
-- 'settings', 'updateBackendAuthMFAConfig_settings' - The settings of your MFA configuration for the backend of your Amplify
-- project.
--
-- 'mfaMode', 'updateBackendAuthMFAConfig_mfaMode' - The MFA mode for the backend of your Amplify project.
newUpdateBackendAuthMFAConfig ::
  UpdateBackendAuthMFAConfig
newUpdateBackendAuthMFAConfig :: UpdateBackendAuthMFAConfig
newUpdateBackendAuthMFAConfig =
  UpdateBackendAuthMFAConfig' :: Maybe Settings -> Maybe MFAMode -> UpdateBackendAuthMFAConfig
UpdateBackendAuthMFAConfig'
    { $sel:settings:UpdateBackendAuthMFAConfig' :: Maybe Settings
settings =
        Maybe Settings
forall a. Maybe a
Prelude.Nothing,
      $sel:mfaMode:UpdateBackendAuthMFAConfig' :: Maybe MFAMode
mfaMode = Maybe MFAMode
forall a. Maybe a
Prelude.Nothing
    }

-- | The settings of your MFA configuration for the backend of your Amplify
-- project.
updateBackendAuthMFAConfig_settings :: Lens.Lens' UpdateBackendAuthMFAConfig (Prelude.Maybe Settings)
updateBackendAuthMFAConfig_settings :: (Maybe Settings -> f (Maybe Settings))
-> UpdateBackendAuthMFAConfig -> f UpdateBackendAuthMFAConfig
updateBackendAuthMFAConfig_settings = (UpdateBackendAuthMFAConfig -> Maybe Settings)
-> (UpdateBackendAuthMFAConfig
    -> Maybe Settings -> UpdateBackendAuthMFAConfig)
-> Lens
     UpdateBackendAuthMFAConfig
     UpdateBackendAuthMFAConfig
     (Maybe Settings)
     (Maybe Settings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBackendAuthMFAConfig' {Maybe Settings
settings :: Maybe Settings
$sel:settings:UpdateBackendAuthMFAConfig' :: UpdateBackendAuthMFAConfig -> Maybe Settings
settings} -> Maybe Settings
settings) (\s :: UpdateBackendAuthMFAConfig
s@UpdateBackendAuthMFAConfig' {} Maybe Settings
a -> UpdateBackendAuthMFAConfig
s {$sel:settings:UpdateBackendAuthMFAConfig' :: Maybe Settings
settings = Maybe Settings
a} :: UpdateBackendAuthMFAConfig)

-- | The MFA mode for the backend of your Amplify project.
updateBackendAuthMFAConfig_mfaMode :: Lens.Lens' UpdateBackendAuthMFAConfig (Prelude.Maybe MFAMode)
updateBackendAuthMFAConfig_mfaMode :: (Maybe MFAMode -> f (Maybe MFAMode))
-> UpdateBackendAuthMFAConfig -> f UpdateBackendAuthMFAConfig
updateBackendAuthMFAConfig_mfaMode = (UpdateBackendAuthMFAConfig -> Maybe MFAMode)
-> (UpdateBackendAuthMFAConfig
    -> Maybe MFAMode -> UpdateBackendAuthMFAConfig)
-> Lens
     UpdateBackendAuthMFAConfig
     UpdateBackendAuthMFAConfig
     (Maybe MFAMode)
     (Maybe MFAMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBackendAuthMFAConfig' {Maybe MFAMode
mfaMode :: Maybe MFAMode
$sel:mfaMode:UpdateBackendAuthMFAConfig' :: UpdateBackendAuthMFAConfig -> Maybe MFAMode
mfaMode} -> Maybe MFAMode
mfaMode) (\s :: UpdateBackendAuthMFAConfig
s@UpdateBackendAuthMFAConfig' {} Maybe MFAMode
a -> UpdateBackendAuthMFAConfig
s {$sel:mfaMode:UpdateBackendAuthMFAConfig' :: Maybe MFAMode
mfaMode = Maybe MFAMode
a} :: UpdateBackendAuthMFAConfig)

instance Prelude.Hashable UpdateBackendAuthMFAConfig

instance Prelude.NFData UpdateBackendAuthMFAConfig

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