{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CognitoIdentityProvider.SetUserPoolMfaConfig
-- 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)
--
-- Set the user pool multi-factor authentication (MFA) configuration.
--
-- This action might generate an SMS text message. Starting June 1, 2021,
-- U.S. telecom carriers require that you register an origination phone
-- number before you can send SMS messages to U.S. phone numbers. If you
-- use SMS text messages in Amazon Cognito, you must register a phone
-- number with
-- <https://console.aws.amazon.com/pinpoint/home/ Amazon Pinpoint>. Cognito
-- will use the the registered number automatically. Otherwise, Cognito
-- users that must receive SMS messages might be unable to sign up,
-- activate their accounts, or sign in.
--
-- If you have never used SMS text messages with Amazon Cognito or any
-- other Amazon Web Service, Amazon SNS might place your account in SMS
-- sandbox. In
-- /<https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html sandbox mode>/
-- , you’ll have limitations, such as sending messages to only verified
-- phone numbers. After testing in the sandbox environment, you can move
-- out of the SMS sandbox and into production. For more information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-sms-userpool-settings.html SMS message settings for Cognito User Pools>
-- in the /Amazon Cognito Developer Guide/.
module Amazonka.CognitoIdentityProvider.SetUserPoolMfaConfig
  ( -- * Creating a Request
    SetUserPoolMfaConfig (..),
    newSetUserPoolMfaConfig,

    -- * Request Lenses
    setUserPoolMfaConfig_smsMfaConfiguration,
    setUserPoolMfaConfig_softwareTokenMfaConfiguration,
    setUserPoolMfaConfig_mfaConfiguration,
    setUserPoolMfaConfig_userPoolId,

    -- * Destructuring the Response
    SetUserPoolMfaConfigResponse (..),
    newSetUserPoolMfaConfigResponse,

    -- * Response Lenses
    setUserPoolMfaConfigResponse_smsMfaConfiguration,
    setUserPoolMfaConfigResponse_softwareTokenMfaConfiguration,
    setUserPoolMfaConfigResponse_mfaConfiguration,
    setUserPoolMfaConfigResponse_httpStatus,
  )
where

import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSetUserPoolMfaConfig' smart constructor.
data SetUserPoolMfaConfig = SetUserPoolMfaConfig'
  { -- | The SMS text message MFA configuration.
    SetUserPoolMfaConfig -> Maybe SmsMfaConfigType
smsMfaConfiguration :: Prelude.Maybe SmsMfaConfigType,
    -- | The software token MFA configuration.
    SetUserPoolMfaConfig -> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration :: Prelude.Maybe SoftwareTokenMfaConfigType,
    -- | The MFA configuration. Users who don\'t have an MFA factor set up won\'t
    -- be able to sign-in if you set the MfaConfiguration value to ‘ON’. See
    -- <cognito/latest/developerguide/user-pool-settings-mfa.html Adding Multi-Factor Authentication (MFA) to a User Pool>
    -- to learn more. Valid values include:
    --
    -- -   @OFF@ MFA will not be used for any users.
    --
    -- -   @ON@ MFA is required for all users to sign in.
    --
    -- -   @OPTIONAL@ MFA will be required only for individual users who have
    --     an MFA factor enabled.
    SetUserPoolMfaConfig -> Maybe UserPoolMfaType
mfaConfiguration :: Prelude.Maybe UserPoolMfaType,
    -- | The user pool ID.
    SetUserPoolMfaConfig -> Text
userPoolId :: Prelude.Text
  }
  deriving (SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool
(SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool)
-> (SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool)
-> Eq SetUserPoolMfaConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool
$c/= :: SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool
== :: SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool
$c== :: SetUserPoolMfaConfig -> SetUserPoolMfaConfig -> Bool
Prelude.Eq, ReadPrec [SetUserPoolMfaConfig]
ReadPrec SetUserPoolMfaConfig
Int -> ReadS SetUserPoolMfaConfig
ReadS [SetUserPoolMfaConfig]
(Int -> ReadS SetUserPoolMfaConfig)
-> ReadS [SetUserPoolMfaConfig]
-> ReadPrec SetUserPoolMfaConfig
-> ReadPrec [SetUserPoolMfaConfig]
-> Read SetUserPoolMfaConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetUserPoolMfaConfig]
$creadListPrec :: ReadPrec [SetUserPoolMfaConfig]
readPrec :: ReadPrec SetUserPoolMfaConfig
$creadPrec :: ReadPrec SetUserPoolMfaConfig
readList :: ReadS [SetUserPoolMfaConfig]
$creadList :: ReadS [SetUserPoolMfaConfig]
readsPrec :: Int -> ReadS SetUserPoolMfaConfig
$creadsPrec :: Int -> ReadS SetUserPoolMfaConfig
Prelude.Read, Int -> SetUserPoolMfaConfig -> ShowS
[SetUserPoolMfaConfig] -> ShowS
SetUserPoolMfaConfig -> String
(Int -> SetUserPoolMfaConfig -> ShowS)
-> (SetUserPoolMfaConfig -> String)
-> ([SetUserPoolMfaConfig] -> ShowS)
-> Show SetUserPoolMfaConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetUserPoolMfaConfig] -> ShowS
$cshowList :: [SetUserPoolMfaConfig] -> ShowS
show :: SetUserPoolMfaConfig -> String
$cshow :: SetUserPoolMfaConfig -> String
showsPrec :: Int -> SetUserPoolMfaConfig -> ShowS
$cshowsPrec :: Int -> SetUserPoolMfaConfig -> ShowS
Prelude.Show, (forall x. SetUserPoolMfaConfig -> Rep SetUserPoolMfaConfig x)
-> (forall x. Rep SetUserPoolMfaConfig x -> SetUserPoolMfaConfig)
-> Generic SetUserPoolMfaConfig
forall x. Rep SetUserPoolMfaConfig x -> SetUserPoolMfaConfig
forall x. SetUserPoolMfaConfig -> Rep SetUserPoolMfaConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetUserPoolMfaConfig x -> SetUserPoolMfaConfig
$cfrom :: forall x. SetUserPoolMfaConfig -> Rep SetUserPoolMfaConfig x
Prelude.Generic)

-- |
-- Create a value of 'SetUserPoolMfaConfig' 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:
--
-- 'smsMfaConfiguration', 'setUserPoolMfaConfig_smsMfaConfiguration' - The SMS text message MFA configuration.
--
-- 'softwareTokenMfaConfiguration', 'setUserPoolMfaConfig_softwareTokenMfaConfiguration' - The software token MFA configuration.
--
-- 'mfaConfiguration', 'setUserPoolMfaConfig_mfaConfiguration' - The MFA configuration. Users who don\'t have an MFA factor set up won\'t
-- be able to sign-in if you set the MfaConfiguration value to ‘ON’. See
-- <cognito/latest/developerguide/user-pool-settings-mfa.html Adding Multi-Factor Authentication (MFA) to a User Pool>
-- to learn more. Valid values include:
--
-- -   @OFF@ MFA will not be used for any users.
--
-- -   @ON@ MFA is required for all users to sign in.
--
-- -   @OPTIONAL@ MFA will be required only for individual users who have
--     an MFA factor enabled.
--
-- 'userPoolId', 'setUserPoolMfaConfig_userPoolId' - The user pool ID.
newSetUserPoolMfaConfig ::
  -- | 'userPoolId'
  Prelude.Text ->
  SetUserPoolMfaConfig
newSetUserPoolMfaConfig :: Text -> SetUserPoolMfaConfig
newSetUserPoolMfaConfig Text
pUserPoolId_ =
  SetUserPoolMfaConfig' :: Maybe SmsMfaConfigType
-> Maybe SoftwareTokenMfaConfigType
-> Maybe UserPoolMfaType
-> Text
-> SetUserPoolMfaConfig
SetUserPoolMfaConfig'
    { $sel:smsMfaConfiguration:SetUserPoolMfaConfig' :: Maybe SmsMfaConfigType
smsMfaConfiguration =
        Maybe SmsMfaConfigType
forall a. Maybe a
Prelude.Nothing,
      $sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfig' :: Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration = Maybe SoftwareTokenMfaConfigType
forall a. Maybe a
Prelude.Nothing,
      $sel:mfaConfiguration:SetUserPoolMfaConfig' :: Maybe UserPoolMfaType
mfaConfiguration = Maybe UserPoolMfaType
forall a. Maybe a
Prelude.Nothing,
      $sel:userPoolId:SetUserPoolMfaConfig' :: Text
userPoolId = Text
pUserPoolId_
    }

-- | The SMS text message MFA configuration.
setUserPoolMfaConfig_smsMfaConfiguration :: Lens.Lens' SetUserPoolMfaConfig (Prelude.Maybe SmsMfaConfigType)
setUserPoolMfaConfig_smsMfaConfiguration :: (Maybe SmsMfaConfigType -> f (Maybe SmsMfaConfigType))
-> SetUserPoolMfaConfig -> f SetUserPoolMfaConfig
setUserPoolMfaConfig_smsMfaConfiguration = (SetUserPoolMfaConfig -> Maybe SmsMfaConfigType)
-> (SetUserPoolMfaConfig
    -> Maybe SmsMfaConfigType -> SetUserPoolMfaConfig)
-> Lens
     SetUserPoolMfaConfig
     SetUserPoolMfaConfig
     (Maybe SmsMfaConfigType)
     (Maybe SmsMfaConfigType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfig' {Maybe SmsMfaConfigType
smsMfaConfiguration :: Maybe SmsMfaConfigType
$sel:smsMfaConfiguration:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Maybe SmsMfaConfigType
smsMfaConfiguration} -> Maybe SmsMfaConfigType
smsMfaConfiguration) (\s :: SetUserPoolMfaConfig
s@SetUserPoolMfaConfig' {} Maybe SmsMfaConfigType
a -> SetUserPoolMfaConfig
s {$sel:smsMfaConfiguration:SetUserPoolMfaConfig' :: Maybe SmsMfaConfigType
smsMfaConfiguration = Maybe SmsMfaConfigType
a} :: SetUserPoolMfaConfig)

-- | The software token MFA configuration.
setUserPoolMfaConfig_softwareTokenMfaConfiguration :: Lens.Lens' SetUserPoolMfaConfig (Prelude.Maybe SoftwareTokenMfaConfigType)
setUserPoolMfaConfig_softwareTokenMfaConfiguration :: (Maybe SoftwareTokenMfaConfigType
 -> f (Maybe SoftwareTokenMfaConfigType))
-> SetUserPoolMfaConfig -> f SetUserPoolMfaConfig
setUserPoolMfaConfig_softwareTokenMfaConfiguration = (SetUserPoolMfaConfig -> Maybe SoftwareTokenMfaConfigType)
-> (SetUserPoolMfaConfig
    -> Maybe SoftwareTokenMfaConfigType -> SetUserPoolMfaConfig)
-> Lens
     SetUserPoolMfaConfig
     SetUserPoolMfaConfig
     (Maybe SoftwareTokenMfaConfigType)
     (Maybe SoftwareTokenMfaConfigType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfig' {Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration :: Maybe SoftwareTokenMfaConfigType
$sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration} -> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration) (\s :: SetUserPoolMfaConfig
s@SetUserPoolMfaConfig' {} Maybe SoftwareTokenMfaConfigType
a -> SetUserPoolMfaConfig
s {$sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfig' :: Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration = Maybe SoftwareTokenMfaConfigType
a} :: SetUserPoolMfaConfig)

-- | The MFA configuration. Users who don\'t have an MFA factor set up won\'t
-- be able to sign-in if you set the MfaConfiguration value to ‘ON’. See
-- <cognito/latest/developerguide/user-pool-settings-mfa.html Adding Multi-Factor Authentication (MFA) to a User Pool>
-- to learn more. Valid values include:
--
-- -   @OFF@ MFA will not be used for any users.
--
-- -   @ON@ MFA is required for all users to sign in.
--
-- -   @OPTIONAL@ MFA will be required only for individual users who have
--     an MFA factor enabled.
setUserPoolMfaConfig_mfaConfiguration :: Lens.Lens' SetUserPoolMfaConfig (Prelude.Maybe UserPoolMfaType)
setUserPoolMfaConfig_mfaConfiguration :: (Maybe UserPoolMfaType -> f (Maybe UserPoolMfaType))
-> SetUserPoolMfaConfig -> f SetUserPoolMfaConfig
setUserPoolMfaConfig_mfaConfiguration = (SetUserPoolMfaConfig -> Maybe UserPoolMfaType)
-> (SetUserPoolMfaConfig
    -> Maybe UserPoolMfaType -> SetUserPoolMfaConfig)
-> Lens
     SetUserPoolMfaConfig
     SetUserPoolMfaConfig
     (Maybe UserPoolMfaType)
     (Maybe UserPoolMfaType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfig' {Maybe UserPoolMfaType
mfaConfiguration :: Maybe UserPoolMfaType
$sel:mfaConfiguration:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Maybe UserPoolMfaType
mfaConfiguration} -> Maybe UserPoolMfaType
mfaConfiguration) (\s :: SetUserPoolMfaConfig
s@SetUserPoolMfaConfig' {} Maybe UserPoolMfaType
a -> SetUserPoolMfaConfig
s {$sel:mfaConfiguration:SetUserPoolMfaConfig' :: Maybe UserPoolMfaType
mfaConfiguration = Maybe UserPoolMfaType
a} :: SetUserPoolMfaConfig)

-- | The user pool ID.
setUserPoolMfaConfig_userPoolId :: Lens.Lens' SetUserPoolMfaConfig Prelude.Text
setUserPoolMfaConfig_userPoolId :: (Text -> f Text) -> SetUserPoolMfaConfig -> f SetUserPoolMfaConfig
setUserPoolMfaConfig_userPoolId = (SetUserPoolMfaConfig -> Text)
-> (SetUserPoolMfaConfig -> Text -> SetUserPoolMfaConfig)
-> Lens SetUserPoolMfaConfig SetUserPoolMfaConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfig' {Text
userPoolId :: Text
$sel:userPoolId:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Text
userPoolId} -> Text
userPoolId) (\s :: SetUserPoolMfaConfig
s@SetUserPoolMfaConfig' {} Text
a -> SetUserPoolMfaConfig
s {$sel:userPoolId:SetUserPoolMfaConfig' :: Text
userPoolId = Text
a} :: SetUserPoolMfaConfig)

instance Core.AWSRequest SetUserPoolMfaConfig where
  type
    AWSResponse SetUserPoolMfaConfig =
      SetUserPoolMfaConfigResponse
  request :: SetUserPoolMfaConfig -> Request SetUserPoolMfaConfig
request = Service -> SetUserPoolMfaConfig -> Request SetUserPoolMfaConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SetUserPoolMfaConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetUserPoolMfaConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SetUserPoolMfaConfig))
-> Logger
-> Service
-> Proxy SetUserPoolMfaConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetUserPoolMfaConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe SmsMfaConfigType
-> Maybe SoftwareTokenMfaConfigType
-> Maybe UserPoolMfaType
-> Int
-> SetUserPoolMfaConfigResponse
SetUserPoolMfaConfigResponse'
            (Maybe SmsMfaConfigType
 -> Maybe SoftwareTokenMfaConfigType
 -> Maybe UserPoolMfaType
 -> Int
 -> SetUserPoolMfaConfigResponse)
-> Either String (Maybe SmsMfaConfigType)
-> Either
     String
     (Maybe SoftwareTokenMfaConfigType
      -> Maybe UserPoolMfaType -> Int -> SetUserPoolMfaConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SmsMfaConfigType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SmsMfaConfiguration")
            Either
  String
  (Maybe SoftwareTokenMfaConfigType
   -> Maybe UserPoolMfaType -> Int -> SetUserPoolMfaConfigResponse)
-> Either String (Maybe SoftwareTokenMfaConfigType)
-> Either
     String
     (Maybe UserPoolMfaType -> Int -> SetUserPoolMfaConfigResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe SoftwareTokenMfaConfigType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SoftwareTokenMfaConfiguration")
            Either
  String
  (Maybe UserPoolMfaType -> Int -> SetUserPoolMfaConfigResponse)
-> Either String (Maybe UserPoolMfaType)
-> Either String (Int -> SetUserPoolMfaConfigResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe UserPoolMfaType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MfaConfiguration")
            Either String (Int -> SetUserPoolMfaConfigResponse)
-> Either String Int -> Either String SetUserPoolMfaConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable SetUserPoolMfaConfig

instance Prelude.NFData SetUserPoolMfaConfig

instance Core.ToHeaders SetUserPoolMfaConfig where
  toHeaders :: SetUserPoolMfaConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SetUserPoolMfaConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.SetUserPoolMfaConfig" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON SetUserPoolMfaConfig where
  toJSON :: SetUserPoolMfaConfig -> Value
toJSON SetUserPoolMfaConfig' {Maybe SmsMfaConfigType
Maybe SoftwareTokenMfaConfigType
Maybe UserPoolMfaType
Text
userPoolId :: Text
mfaConfiguration :: Maybe UserPoolMfaType
softwareTokenMfaConfiguration :: Maybe SoftwareTokenMfaConfigType
smsMfaConfiguration :: Maybe SmsMfaConfigType
$sel:userPoolId:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Text
$sel:mfaConfiguration:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Maybe UserPoolMfaType
$sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Maybe SoftwareTokenMfaConfigType
$sel:smsMfaConfiguration:SetUserPoolMfaConfig' :: SetUserPoolMfaConfig -> Maybe SmsMfaConfigType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SmsMfaConfiguration" Text -> SmsMfaConfigType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SmsMfaConfigType -> Pair) -> Maybe SmsMfaConfigType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SmsMfaConfigType
smsMfaConfiguration,
            (Text
"SoftwareTokenMfaConfiguration" Text -> SoftwareTokenMfaConfigType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SoftwareTokenMfaConfigType -> Pair)
-> Maybe SoftwareTokenMfaConfigType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration,
            (Text
"MfaConfiguration" Text -> UserPoolMfaType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UserPoolMfaType -> Pair) -> Maybe UserPoolMfaType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserPoolMfaType
mfaConfiguration,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId)
          ]
      )

instance Core.ToPath SetUserPoolMfaConfig where
  toPath :: SetUserPoolMfaConfig -> ByteString
toPath = ByteString -> SetUserPoolMfaConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery SetUserPoolMfaConfig where
  toQuery :: SetUserPoolMfaConfig -> QueryString
toQuery = QueryString -> SetUserPoolMfaConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSetUserPoolMfaConfigResponse' smart constructor.
data SetUserPoolMfaConfigResponse = SetUserPoolMfaConfigResponse'
  { -- | The SMS text message MFA configuration.
    SetUserPoolMfaConfigResponse -> Maybe SmsMfaConfigType
smsMfaConfiguration :: Prelude.Maybe SmsMfaConfigType,
    -- | The software token MFA configuration.
    SetUserPoolMfaConfigResponse -> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration :: Prelude.Maybe SoftwareTokenMfaConfigType,
    -- | The MFA configuration. Valid values include:
    --
    -- -   @OFF@ MFA will not be used for any users.
    --
    -- -   @ON@ MFA is required for all users to sign in.
    --
    -- -   @OPTIONAL@ MFA will be required only for individual users who have
    --     an MFA factor enabled.
    SetUserPoolMfaConfigResponse -> Maybe UserPoolMfaType
mfaConfiguration :: Prelude.Maybe UserPoolMfaType,
    -- | The response's http status code.
    SetUserPoolMfaConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SetUserPoolMfaConfigResponse
-> SetUserPoolMfaConfigResponse -> Bool
(SetUserPoolMfaConfigResponse
 -> SetUserPoolMfaConfigResponse -> Bool)
-> (SetUserPoolMfaConfigResponse
    -> SetUserPoolMfaConfigResponse -> Bool)
-> Eq SetUserPoolMfaConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetUserPoolMfaConfigResponse
-> SetUserPoolMfaConfigResponse -> Bool
$c/= :: SetUserPoolMfaConfigResponse
-> SetUserPoolMfaConfigResponse -> Bool
== :: SetUserPoolMfaConfigResponse
-> SetUserPoolMfaConfigResponse -> Bool
$c== :: SetUserPoolMfaConfigResponse
-> SetUserPoolMfaConfigResponse -> Bool
Prelude.Eq, ReadPrec [SetUserPoolMfaConfigResponse]
ReadPrec SetUserPoolMfaConfigResponse
Int -> ReadS SetUserPoolMfaConfigResponse
ReadS [SetUserPoolMfaConfigResponse]
(Int -> ReadS SetUserPoolMfaConfigResponse)
-> ReadS [SetUserPoolMfaConfigResponse]
-> ReadPrec SetUserPoolMfaConfigResponse
-> ReadPrec [SetUserPoolMfaConfigResponse]
-> Read SetUserPoolMfaConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetUserPoolMfaConfigResponse]
$creadListPrec :: ReadPrec [SetUserPoolMfaConfigResponse]
readPrec :: ReadPrec SetUserPoolMfaConfigResponse
$creadPrec :: ReadPrec SetUserPoolMfaConfigResponse
readList :: ReadS [SetUserPoolMfaConfigResponse]
$creadList :: ReadS [SetUserPoolMfaConfigResponse]
readsPrec :: Int -> ReadS SetUserPoolMfaConfigResponse
$creadsPrec :: Int -> ReadS SetUserPoolMfaConfigResponse
Prelude.Read, Int -> SetUserPoolMfaConfigResponse -> ShowS
[SetUserPoolMfaConfigResponse] -> ShowS
SetUserPoolMfaConfigResponse -> String
(Int -> SetUserPoolMfaConfigResponse -> ShowS)
-> (SetUserPoolMfaConfigResponse -> String)
-> ([SetUserPoolMfaConfigResponse] -> ShowS)
-> Show SetUserPoolMfaConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetUserPoolMfaConfigResponse] -> ShowS
$cshowList :: [SetUserPoolMfaConfigResponse] -> ShowS
show :: SetUserPoolMfaConfigResponse -> String
$cshow :: SetUserPoolMfaConfigResponse -> String
showsPrec :: Int -> SetUserPoolMfaConfigResponse -> ShowS
$cshowsPrec :: Int -> SetUserPoolMfaConfigResponse -> ShowS
Prelude.Show, (forall x.
 SetUserPoolMfaConfigResponse -> Rep SetUserPoolMfaConfigResponse x)
-> (forall x.
    Rep SetUserPoolMfaConfigResponse x -> SetUserPoolMfaConfigResponse)
-> Generic SetUserPoolMfaConfigResponse
forall x.
Rep SetUserPoolMfaConfigResponse x -> SetUserPoolMfaConfigResponse
forall x.
SetUserPoolMfaConfigResponse -> Rep SetUserPoolMfaConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetUserPoolMfaConfigResponse x -> SetUserPoolMfaConfigResponse
$cfrom :: forall x.
SetUserPoolMfaConfigResponse -> Rep SetUserPoolMfaConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'SetUserPoolMfaConfigResponse' 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:
--
-- 'smsMfaConfiguration', 'setUserPoolMfaConfigResponse_smsMfaConfiguration' - The SMS text message MFA configuration.
--
-- 'softwareTokenMfaConfiguration', 'setUserPoolMfaConfigResponse_softwareTokenMfaConfiguration' - The software token MFA configuration.
--
-- 'mfaConfiguration', 'setUserPoolMfaConfigResponse_mfaConfiguration' - The MFA configuration. Valid values include:
--
-- -   @OFF@ MFA will not be used for any users.
--
-- -   @ON@ MFA is required for all users to sign in.
--
-- -   @OPTIONAL@ MFA will be required only for individual users who have
--     an MFA factor enabled.
--
-- 'httpStatus', 'setUserPoolMfaConfigResponse_httpStatus' - The response's http status code.
newSetUserPoolMfaConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SetUserPoolMfaConfigResponse
newSetUserPoolMfaConfigResponse :: Int -> SetUserPoolMfaConfigResponse
newSetUserPoolMfaConfigResponse Int
pHttpStatus_ =
  SetUserPoolMfaConfigResponse' :: Maybe SmsMfaConfigType
-> Maybe SoftwareTokenMfaConfigType
-> Maybe UserPoolMfaType
-> Int
-> SetUserPoolMfaConfigResponse
SetUserPoolMfaConfigResponse'
    { $sel:smsMfaConfiguration:SetUserPoolMfaConfigResponse' :: Maybe SmsMfaConfigType
smsMfaConfiguration =
        Maybe SmsMfaConfigType
forall a. Maybe a
Prelude.Nothing,
      $sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfigResponse' :: Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration =
        Maybe SoftwareTokenMfaConfigType
forall a. Maybe a
Prelude.Nothing,
      $sel:mfaConfiguration:SetUserPoolMfaConfigResponse' :: Maybe UserPoolMfaType
mfaConfiguration = Maybe UserPoolMfaType
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SetUserPoolMfaConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The SMS text message MFA configuration.
setUserPoolMfaConfigResponse_smsMfaConfiguration :: Lens.Lens' SetUserPoolMfaConfigResponse (Prelude.Maybe SmsMfaConfigType)
setUserPoolMfaConfigResponse_smsMfaConfiguration :: (Maybe SmsMfaConfigType -> f (Maybe SmsMfaConfigType))
-> SetUserPoolMfaConfigResponse -> f SetUserPoolMfaConfigResponse
setUserPoolMfaConfigResponse_smsMfaConfiguration = (SetUserPoolMfaConfigResponse -> Maybe SmsMfaConfigType)
-> (SetUserPoolMfaConfigResponse
    -> Maybe SmsMfaConfigType -> SetUserPoolMfaConfigResponse)
-> Lens
     SetUserPoolMfaConfigResponse
     SetUserPoolMfaConfigResponse
     (Maybe SmsMfaConfigType)
     (Maybe SmsMfaConfigType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfigResponse' {Maybe SmsMfaConfigType
smsMfaConfiguration :: Maybe SmsMfaConfigType
$sel:smsMfaConfiguration:SetUserPoolMfaConfigResponse' :: SetUserPoolMfaConfigResponse -> Maybe SmsMfaConfigType
smsMfaConfiguration} -> Maybe SmsMfaConfigType
smsMfaConfiguration) (\s :: SetUserPoolMfaConfigResponse
s@SetUserPoolMfaConfigResponse' {} Maybe SmsMfaConfigType
a -> SetUserPoolMfaConfigResponse
s {$sel:smsMfaConfiguration:SetUserPoolMfaConfigResponse' :: Maybe SmsMfaConfigType
smsMfaConfiguration = Maybe SmsMfaConfigType
a} :: SetUserPoolMfaConfigResponse)

-- | The software token MFA configuration.
setUserPoolMfaConfigResponse_softwareTokenMfaConfiguration :: Lens.Lens' SetUserPoolMfaConfigResponse (Prelude.Maybe SoftwareTokenMfaConfigType)
setUserPoolMfaConfigResponse_softwareTokenMfaConfiguration :: (Maybe SoftwareTokenMfaConfigType
 -> f (Maybe SoftwareTokenMfaConfigType))
-> SetUserPoolMfaConfigResponse -> f SetUserPoolMfaConfigResponse
setUserPoolMfaConfigResponse_softwareTokenMfaConfiguration = (SetUserPoolMfaConfigResponse -> Maybe SoftwareTokenMfaConfigType)
-> (SetUserPoolMfaConfigResponse
    -> Maybe SoftwareTokenMfaConfigType
    -> SetUserPoolMfaConfigResponse)
-> Lens
     SetUserPoolMfaConfigResponse
     SetUserPoolMfaConfigResponse
     (Maybe SoftwareTokenMfaConfigType)
     (Maybe SoftwareTokenMfaConfigType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfigResponse' {Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration :: Maybe SoftwareTokenMfaConfigType
$sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfigResponse' :: SetUserPoolMfaConfigResponse -> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration} -> Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration) (\s :: SetUserPoolMfaConfigResponse
s@SetUserPoolMfaConfigResponse' {} Maybe SoftwareTokenMfaConfigType
a -> SetUserPoolMfaConfigResponse
s {$sel:softwareTokenMfaConfiguration:SetUserPoolMfaConfigResponse' :: Maybe SoftwareTokenMfaConfigType
softwareTokenMfaConfiguration = Maybe SoftwareTokenMfaConfigType
a} :: SetUserPoolMfaConfigResponse)

-- | The MFA configuration. Valid values include:
--
-- -   @OFF@ MFA will not be used for any users.
--
-- -   @ON@ MFA is required for all users to sign in.
--
-- -   @OPTIONAL@ MFA will be required only for individual users who have
--     an MFA factor enabled.
setUserPoolMfaConfigResponse_mfaConfiguration :: Lens.Lens' SetUserPoolMfaConfigResponse (Prelude.Maybe UserPoolMfaType)
setUserPoolMfaConfigResponse_mfaConfiguration :: (Maybe UserPoolMfaType -> f (Maybe UserPoolMfaType))
-> SetUserPoolMfaConfigResponse -> f SetUserPoolMfaConfigResponse
setUserPoolMfaConfigResponse_mfaConfiguration = (SetUserPoolMfaConfigResponse -> Maybe UserPoolMfaType)
-> (SetUserPoolMfaConfigResponse
    -> Maybe UserPoolMfaType -> SetUserPoolMfaConfigResponse)
-> Lens
     SetUserPoolMfaConfigResponse
     SetUserPoolMfaConfigResponse
     (Maybe UserPoolMfaType)
     (Maybe UserPoolMfaType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfigResponse' {Maybe UserPoolMfaType
mfaConfiguration :: Maybe UserPoolMfaType
$sel:mfaConfiguration:SetUserPoolMfaConfigResponse' :: SetUserPoolMfaConfigResponse -> Maybe UserPoolMfaType
mfaConfiguration} -> Maybe UserPoolMfaType
mfaConfiguration) (\s :: SetUserPoolMfaConfigResponse
s@SetUserPoolMfaConfigResponse' {} Maybe UserPoolMfaType
a -> SetUserPoolMfaConfigResponse
s {$sel:mfaConfiguration:SetUserPoolMfaConfigResponse' :: Maybe UserPoolMfaType
mfaConfiguration = Maybe UserPoolMfaType
a} :: SetUserPoolMfaConfigResponse)

-- | The response's http status code.
setUserPoolMfaConfigResponse_httpStatus :: Lens.Lens' SetUserPoolMfaConfigResponse Prelude.Int
setUserPoolMfaConfigResponse_httpStatus :: (Int -> f Int)
-> SetUserPoolMfaConfigResponse -> f SetUserPoolMfaConfigResponse
setUserPoolMfaConfigResponse_httpStatus = (SetUserPoolMfaConfigResponse -> Int)
-> (SetUserPoolMfaConfigResponse
    -> Int -> SetUserPoolMfaConfigResponse)
-> Lens
     SetUserPoolMfaConfigResponse SetUserPoolMfaConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserPoolMfaConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetUserPoolMfaConfigResponse' :: SetUserPoolMfaConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetUserPoolMfaConfigResponse
s@SetUserPoolMfaConfigResponse' {} Int
a -> SetUserPoolMfaConfigResponse
s {$sel:httpStatus:SetUserPoolMfaConfigResponse' :: Int
httpStatus = Int
a} :: SetUserPoolMfaConfigResponse)

instance Prelude.NFData SetUserPoolMfaConfigResponse