{-# 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.CreateBackendAuthUserPoolConfig
-- 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.CreateBackendAuthUserPoolConfig where

import Amazonka.AmplifyBackend.Types.CreateBackendAuthForgotPasswordConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthMFAConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthOAuthConfig
import Amazonka.AmplifyBackend.Types.CreateBackendAuthPasswordPolicyConfig
import Amazonka.AmplifyBackend.Types.RequiredSignUpAttributesElement
import Amazonka.AmplifyBackend.Types.SignInMethod
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the Amazon Cognito user pool configuration for the auth
-- resource to be configured for your Amplify project.
--
-- /See:/ 'newCreateBackendAuthUserPoolConfig' smart constructor.
data CreateBackendAuthUserPoolConfig = CreateBackendAuthUserPoolConfig'
  { -- | Describes the password policy for your Amazon Cognito user pool,
    -- configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy :: Prelude.Maybe CreateBackendAuthPasswordPolicyConfig,
    -- | Describes whether to apply multi-factor authentication policies for your
    -- Amazon Cognito user pool configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
mfa :: Prelude.Maybe CreateBackendAuthMFAConfig,
    -- | Describes the forgotten password policy for your Amazon Cognito user
    -- pool, configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword :: Prelude.Maybe CreateBackendAuthForgotPasswordConfig,
    -- | Describes the OAuth policy and rules for your Amazon Cognito user pool,
    -- configured as a part of your Amplify project.
    CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
oAuth :: Prelude.Maybe CreateBackendAuthOAuthConfig,
    -- | The required attributes to sign up new users in the user pool.
    CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
requiredSignUpAttributes :: [RequiredSignUpAttributesElement],
    -- | Describes the sign-in methods that your Amplify app users use to log in
    -- using the Amazon Cognito user pool, configured as a part of your Amplify
    -- project.
    CreateBackendAuthUserPoolConfig -> SignInMethod
signInMethod :: SignInMethod,
    -- | The Amazon Cognito user pool name.
    CreateBackendAuthUserPoolConfig -> Text
userPoolName :: Prelude.Text
  }
  deriving (CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
(CreateBackendAuthUserPoolConfig
 -> CreateBackendAuthUserPoolConfig -> Bool)
-> (CreateBackendAuthUserPoolConfig
    -> CreateBackendAuthUserPoolConfig -> Bool)
-> Eq CreateBackendAuthUserPoolConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
$c/= :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
== :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
$c== :: CreateBackendAuthUserPoolConfig
-> CreateBackendAuthUserPoolConfig -> Bool
Prelude.Eq, ReadPrec [CreateBackendAuthUserPoolConfig]
ReadPrec CreateBackendAuthUserPoolConfig
Int -> ReadS CreateBackendAuthUserPoolConfig
ReadS [CreateBackendAuthUserPoolConfig]
(Int -> ReadS CreateBackendAuthUserPoolConfig)
-> ReadS [CreateBackendAuthUserPoolConfig]
-> ReadPrec CreateBackendAuthUserPoolConfig
-> ReadPrec [CreateBackendAuthUserPoolConfig]
-> Read CreateBackendAuthUserPoolConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendAuthUserPoolConfig]
$creadListPrec :: ReadPrec [CreateBackendAuthUserPoolConfig]
readPrec :: ReadPrec CreateBackendAuthUserPoolConfig
$creadPrec :: ReadPrec CreateBackendAuthUserPoolConfig
readList :: ReadS [CreateBackendAuthUserPoolConfig]
$creadList :: ReadS [CreateBackendAuthUserPoolConfig]
readsPrec :: Int -> ReadS CreateBackendAuthUserPoolConfig
$creadsPrec :: Int -> ReadS CreateBackendAuthUserPoolConfig
Prelude.Read, Int -> CreateBackendAuthUserPoolConfig -> ShowS
[CreateBackendAuthUserPoolConfig] -> ShowS
CreateBackendAuthUserPoolConfig -> String
(Int -> CreateBackendAuthUserPoolConfig -> ShowS)
-> (CreateBackendAuthUserPoolConfig -> String)
-> ([CreateBackendAuthUserPoolConfig] -> ShowS)
-> Show CreateBackendAuthUserPoolConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendAuthUserPoolConfig] -> ShowS
$cshowList :: [CreateBackendAuthUserPoolConfig] -> ShowS
show :: CreateBackendAuthUserPoolConfig -> String
$cshow :: CreateBackendAuthUserPoolConfig -> String
showsPrec :: Int -> CreateBackendAuthUserPoolConfig -> ShowS
$cshowsPrec :: Int -> CreateBackendAuthUserPoolConfig -> ShowS
Prelude.Show, (forall x.
 CreateBackendAuthUserPoolConfig
 -> Rep CreateBackendAuthUserPoolConfig x)
-> (forall x.
    Rep CreateBackendAuthUserPoolConfig x
    -> CreateBackendAuthUserPoolConfig)
-> Generic CreateBackendAuthUserPoolConfig
forall x.
Rep CreateBackendAuthUserPoolConfig x
-> CreateBackendAuthUserPoolConfig
forall x.
CreateBackendAuthUserPoolConfig
-> Rep CreateBackendAuthUserPoolConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackendAuthUserPoolConfig x
-> CreateBackendAuthUserPoolConfig
$cfrom :: forall x.
CreateBackendAuthUserPoolConfig
-> Rep CreateBackendAuthUserPoolConfig x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackendAuthUserPoolConfig' 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:
--
-- 'passwordPolicy', 'createBackendAuthUserPoolConfig_passwordPolicy' - Describes the password policy for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
--
-- 'mfa', 'createBackendAuthUserPoolConfig_mfa' - Describes whether to apply multi-factor authentication policies for your
-- Amazon Cognito user pool configured as a part of your Amplify project.
--
-- 'forgotPassword', 'createBackendAuthUserPoolConfig_forgotPassword' - Describes the forgotten password policy for your Amazon Cognito user
-- pool, configured as a part of your Amplify project.
--
-- 'oAuth', 'createBackendAuthUserPoolConfig_oAuth' - Describes the OAuth policy and rules for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
--
-- 'requiredSignUpAttributes', 'createBackendAuthUserPoolConfig_requiredSignUpAttributes' - The required attributes to sign up new users in the user pool.
--
-- 'signInMethod', 'createBackendAuthUserPoolConfig_signInMethod' - Describes the sign-in methods that your Amplify app users use to log in
-- using the Amazon Cognito user pool, configured as a part of your Amplify
-- project.
--
-- 'userPoolName', 'createBackendAuthUserPoolConfig_userPoolName' - The Amazon Cognito user pool name.
newCreateBackendAuthUserPoolConfig ::
  -- | 'signInMethod'
  SignInMethod ->
  -- | 'userPoolName'
  Prelude.Text ->
  CreateBackendAuthUserPoolConfig
newCreateBackendAuthUserPoolConfig :: SignInMethod -> Text -> CreateBackendAuthUserPoolConfig
newCreateBackendAuthUserPoolConfig
  SignInMethod
pSignInMethod_
  Text
pUserPoolName_ =
    CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthPasswordPolicyConfig
-> Maybe CreateBackendAuthMFAConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
-> Maybe CreateBackendAuthOAuthConfig
-> [RequiredSignUpAttributesElement]
-> SignInMethod
-> Text
-> CreateBackendAuthUserPoolConfig
CreateBackendAuthUserPoolConfig'
      { $sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy =
          Maybe CreateBackendAuthPasswordPolicyConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:mfa:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthMFAConfig
mfa = Maybe CreateBackendAuthMFAConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword = Maybe CreateBackendAuthForgotPasswordConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:oAuth:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthOAuthConfig
oAuth = Maybe CreateBackendAuthOAuthConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: [RequiredSignUpAttributesElement]
requiredSignUpAttributes = [RequiredSignUpAttributesElement]
forall a. Monoid a => a
Prelude.mempty,
        $sel:signInMethod:CreateBackendAuthUserPoolConfig' :: SignInMethod
signInMethod = SignInMethod
pSignInMethod_,
        $sel:userPoolName:CreateBackendAuthUserPoolConfig' :: Text
userPoolName = Text
pUserPoolName_
      }

-- | Describes the password policy for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_passwordPolicy :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthPasswordPolicyConfig)
createBackendAuthUserPoolConfig_passwordPolicy :: (Maybe CreateBackendAuthPasswordPolicyConfig
 -> f (Maybe CreateBackendAuthPasswordPolicyConfig))
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_passwordPolicy = (CreateBackendAuthUserPoolConfig
 -> Maybe CreateBackendAuthPasswordPolicyConfig)
-> (CreateBackendAuthUserPoolConfig
    -> Maybe CreateBackendAuthPasswordPolicyConfig
    -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     (Maybe CreateBackendAuthPasswordPolicyConfig)
     (Maybe CreateBackendAuthPasswordPolicyConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy :: Maybe CreateBackendAuthPasswordPolicyConfig
$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy} -> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthPasswordPolicyConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy = Maybe CreateBackendAuthPasswordPolicyConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes whether to apply multi-factor authentication policies for your
-- Amazon Cognito user pool configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_mfa :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthMFAConfig)
createBackendAuthUserPoolConfig_mfa :: (Maybe CreateBackendAuthMFAConfig
 -> f (Maybe CreateBackendAuthMFAConfig))
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_mfa = (CreateBackendAuthUserPoolConfig
 -> Maybe CreateBackendAuthMFAConfig)
-> (CreateBackendAuthUserPoolConfig
    -> Maybe CreateBackendAuthMFAConfig
    -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     (Maybe CreateBackendAuthMFAConfig)
     (Maybe CreateBackendAuthMFAConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthMFAConfig
mfa :: Maybe CreateBackendAuthMFAConfig
$sel:mfa:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
mfa} -> Maybe CreateBackendAuthMFAConfig
mfa) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthMFAConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:mfa:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthMFAConfig
mfa = Maybe CreateBackendAuthMFAConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes the forgotten password policy for your Amazon Cognito user
-- pool, configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_forgotPassword :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthForgotPasswordConfig)
createBackendAuthUserPoolConfig_forgotPassword :: (Maybe CreateBackendAuthForgotPasswordConfig
 -> f (Maybe CreateBackendAuthForgotPasswordConfig))
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_forgotPassword = (CreateBackendAuthUserPoolConfig
 -> Maybe CreateBackendAuthForgotPasswordConfig)
-> (CreateBackendAuthUserPoolConfig
    -> Maybe CreateBackendAuthForgotPasswordConfig
    -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     (Maybe CreateBackendAuthForgotPasswordConfig)
     (Maybe CreateBackendAuthForgotPasswordConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword :: Maybe CreateBackendAuthForgotPasswordConfig
$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword} -> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthForgotPasswordConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword = Maybe CreateBackendAuthForgotPasswordConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | Describes the OAuth policy and rules for your Amazon Cognito user pool,
-- configured as a part of your Amplify project.
createBackendAuthUserPoolConfig_oAuth :: Lens.Lens' CreateBackendAuthUserPoolConfig (Prelude.Maybe CreateBackendAuthOAuthConfig)
createBackendAuthUserPoolConfig_oAuth :: (Maybe CreateBackendAuthOAuthConfig
 -> f (Maybe CreateBackendAuthOAuthConfig))
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_oAuth = (CreateBackendAuthUserPoolConfig
 -> Maybe CreateBackendAuthOAuthConfig)
-> (CreateBackendAuthUserPoolConfig
    -> Maybe CreateBackendAuthOAuthConfig
    -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     (Maybe CreateBackendAuthOAuthConfig)
     (Maybe CreateBackendAuthOAuthConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Maybe CreateBackendAuthOAuthConfig
oAuth :: Maybe CreateBackendAuthOAuthConfig
$sel:oAuth:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
oAuth} -> Maybe CreateBackendAuthOAuthConfig
oAuth) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Maybe CreateBackendAuthOAuthConfig
a -> CreateBackendAuthUserPoolConfig
s {$sel:oAuth:CreateBackendAuthUserPoolConfig' :: Maybe CreateBackendAuthOAuthConfig
oAuth = Maybe CreateBackendAuthOAuthConfig
a} :: CreateBackendAuthUserPoolConfig)

-- | The required attributes to sign up new users in the user pool.
createBackendAuthUserPoolConfig_requiredSignUpAttributes :: Lens.Lens' CreateBackendAuthUserPoolConfig [RequiredSignUpAttributesElement]
createBackendAuthUserPoolConfig_requiredSignUpAttributes :: ([RequiredSignUpAttributesElement]
 -> f [RequiredSignUpAttributesElement])
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_requiredSignUpAttributes = (CreateBackendAuthUserPoolConfig
 -> [RequiredSignUpAttributesElement])
-> (CreateBackendAuthUserPoolConfig
    -> [RequiredSignUpAttributesElement]
    -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     [RequiredSignUpAttributesElement]
     [RequiredSignUpAttributesElement]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {[RequiredSignUpAttributesElement]
requiredSignUpAttributes :: [RequiredSignUpAttributesElement]
$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
requiredSignUpAttributes} -> [RequiredSignUpAttributesElement]
requiredSignUpAttributes) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} [RequiredSignUpAttributesElement]
a -> CreateBackendAuthUserPoolConfig
s {$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: [RequiredSignUpAttributesElement]
requiredSignUpAttributes = [RequiredSignUpAttributesElement]
a} :: CreateBackendAuthUserPoolConfig) (([RequiredSignUpAttributesElement]
  -> f [RequiredSignUpAttributesElement])
 -> CreateBackendAuthUserPoolConfig
 -> f CreateBackendAuthUserPoolConfig)
-> (([RequiredSignUpAttributesElement]
     -> f [RequiredSignUpAttributesElement])
    -> [RequiredSignUpAttributesElement]
    -> f [RequiredSignUpAttributesElement])
-> ([RequiredSignUpAttributesElement]
    -> f [RequiredSignUpAttributesElement])
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RequiredSignUpAttributesElement]
 -> f [RequiredSignUpAttributesElement])
-> [RequiredSignUpAttributesElement]
-> f [RequiredSignUpAttributesElement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes the sign-in methods that your Amplify app users use to log in
-- using the Amazon Cognito user pool, configured as a part of your Amplify
-- project.
createBackendAuthUserPoolConfig_signInMethod :: Lens.Lens' CreateBackendAuthUserPoolConfig SignInMethod
createBackendAuthUserPoolConfig_signInMethod :: (SignInMethod -> f SignInMethod)
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_signInMethod = (CreateBackendAuthUserPoolConfig -> SignInMethod)
-> (CreateBackendAuthUserPoolConfig
    -> SignInMethod -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     SignInMethod
     SignInMethod
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {SignInMethod
signInMethod :: SignInMethod
$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> SignInMethod
signInMethod} -> SignInMethod
signInMethod) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} SignInMethod
a -> CreateBackendAuthUserPoolConfig
s {$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: SignInMethod
signInMethod = SignInMethod
a} :: CreateBackendAuthUserPoolConfig)

-- | The Amazon Cognito user pool name.
createBackendAuthUserPoolConfig_userPoolName :: Lens.Lens' CreateBackendAuthUserPoolConfig Prelude.Text
createBackendAuthUserPoolConfig_userPoolName :: (Text -> f Text)
-> CreateBackendAuthUserPoolConfig
-> f CreateBackendAuthUserPoolConfig
createBackendAuthUserPoolConfig_userPoolName = (CreateBackendAuthUserPoolConfig -> Text)
-> (CreateBackendAuthUserPoolConfig
    -> Text -> CreateBackendAuthUserPoolConfig)
-> Lens
     CreateBackendAuthUserPoolConfig
     CreateBackendAuthUserPoolConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthUserPoolConfig' {Text
userPoolName :: Text
$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Text
userPoolName} -> Text
userPoolName) (\s :: CreateBackendAuthUserPoolConfig
s@CreateBackendAuthUserPoolConfig' {} Text
a -> CreateBackendAuthUserPoolConfig
s {$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: Text
userPoolName = Text
a} :: CreateBackendAuthUserPoolConfig)

instance
  Core.FromJSON
    CreateBackendAuthUserPoolConfig
  where
  parseJSON :: Value -> Parser CreateBackendAuthUserPoolConfig
parseJSON =
    String
-> (Object -> Parser CreateBackendAuthUserPoolConfig)
-> Value
-> Parser CreateBackendAuthUserPoolConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CreateBackendAuthUserPoolConfig"
      ( \Object
x ->
          Maybe CreateBackendAuthPasswordPolicyConfig
-> Maybe CreateBackendAuthMFAConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
-> Maybe CreateBackendAuthOAuthConfig
-> [RequiredSignUpAttributesElement]
-> SignInMethod
-> Text
-> CreateBackendAuthUserPoolConfig
CreateBackendAuthUserPoolConfig'
            (Maybe CreateBackendAuthPasswordPolicyConfig
 -> Maybe CreateBackendAuthMFAConfig
 -> Maybe CreateBackendAuthForgotPasswordConfig
 -> Maybe CreateBackendAuthOAuthConfig
 -> [RequiredSignUpAttributesElement]
 -> SignInMethod
 -> Text
 -> CreateBackendAuthUserPoolConfig)
-> Parser (Maybe CreateBackendAuthPasswordPolicyConfig)
-> Parser
     (Maybe CreateBackendAuthMFAConfig
      -> Maybe CreateBackendAuthForgotPasswordConfig
      -> Maybe CreateBackendAuthOAuthConfig
      -> [RequiredSignUpAttributesElement]
      -> SignInMethod
      -> Text
      -> CreateBackendAuthUserPoolConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe CreateBackendAuthPasswordPolicyConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"passwordPolicy")
            Parser
  (Maybe CreateBackendAuthMFAConfig
   -> Maybe CreateBackendAuthForgotPasswordConfig
   -> Maybe CreateBackendAuthOAuthConfig
   -> [RequiredSignUpAttributesElement]
   -> SignInMethod
   -> Text
   -> CreateBackendAuthUserPoolConfig)
-> Parser (Maybe CreateBackendAuthMFAConfig)
-> Parser
     (Maybe CreateBackendAuthForgotPasswordConfig
      -> Maybe CreateBackendAuthOAuthConfig
      -> [RequiredSignUpAttributesElement]
      -> SignInMethod
      -> Text
      -> CreateBackendAuthUserPoolConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CreateBackendAuthMFAConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"mfa")
            Parser
  (Maybe CreateBackendAuthForgotPasswordConfig
   -> Maybe CreateBackendAuthOAuthConfig
   -> [RequiredSignUpAttributesElement]
   -> SignInMethod
   -> Text
   -> CreateBackendAuthUserPoolConfig)
-> Parser (Maybe CreateBackendAuthForgotPasswordConfig)
-> Parser
     (Maybe CreateBackendAuthOAuthConfig
      -> [RequiredSignUpAttributesElement]
      -> SignInMethod
      -> Text
      -> CreateBackendAuthUserPoolConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe CreateBackendAuthForgotPasswordConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"forgotPassword")
            Parser
  (Maybe CreateBackendAuthOAuthConfig
   -> [RequiredSignUpAttributesElement]
   -> SignInMethod
   -> Text
   -> CreateBackendAuthUserPoolConfig)
-> Parser (Maybe CreateBackendAuthOAuthConfig)
-> Parser
     ([RequiredSignUpAttributesElement]
      -> SignInMethod -> Text -> CreateBackendAuthUserPoolConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CreateBackendAuthOAuthConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"oAuth")
            Parser
  ([RequiredSignUpAttributesElement]
   -> SignInMethod -> Text -> CreateBackendAuthUserPoolConfig)
-> Parser [RequiredSignUpAttributesElement]
-> Parser (SignInMethod -> Text -> CreateBackendAuthUserPoolConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [RequiredSignUpAttributesElement])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"requiredSignUpAttributes"
                            Parser (Maybe [RequiredSignUpAttributesElement])
-> [RequiredSignUpAttributesElement]
-> Parser [RequiredSignUpAttributesElement]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [RequiredSignUpAttributesElement]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (SignInMethod -> Text -> CreateBackendAuthUserPoolConfig)
-> Parser SignInMethod
-> Parser (Text -> CreateBackendAuthUserPoolConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SignInMethod
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"signInMethod")
            Parser (Text -> CreateBackendAuthUserPoolConfig)
-> Parser Text -> Parser CreateBackendAuthUserPoolConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"userPoolName")
      )

instance
  Prelude.Hashable
    CreateBackendAuthUserPoolConfig

instance
  Prelude.NFData
    CreateBackendAuthUserPoolConfig

instance Core.ToJSON CreateBackendAuthUserPoolConfig where
  toJSON :: CreateBackendAuthUserPoolConfig -> Value
toJSON CreateBackendAuthUserPoolConfig' {[RequiredSignUpAttributesElement]
Maybe CreateBackendAuthPasswordPolicyConfig
Maybe CreateBackendAuthMFAConfig
Maybe CreateBackendAuthForgotPasswordConfig
Maybe CreateBackendAuthOAuthConfig
Text
SignInMethod
userPoolName :: Text
signInMethod :: SignInMethod
requiredSignUpAttributes :: [RequiredSignUpAttributesElement]
oAuth :: Maybe CreateBackendAuthOAuthConfig
forgotPassword :: Maybe CreateBackendAuthForgotPasswordConfig
mfa :: Maybe CreateBackendAuthMFAConfig
passwordPolicy :: Maybe CreateBackendAuthPasswordPolicyConfig
$sel:userPoolName:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Text
$sel:signInMethod:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> SignInMethod
$sel:requiredSignUpAttributes:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> [RequiredSignUpAttributesElement]
$sel:oAuth:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthOAuthConfig
$sel:forgotPassword:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthForgotPasswordConfig
$sel:mfa:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig -> Maybe CreateBackendAuthMFAConfig
$sel:passwordPolicy:CreateBackendAuthUserPoolConfig' :: CreateBackendAuthUserPoolConfig
-> Maybe CreateBackendAuthPasswordPolicyConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"passwordPolicy" Text -> CreateBackendAuthPasswordPolicyConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CreateBackendAuthPasswordPolicyConfig -> Pair)
-> Maybe CreateBackendAuthPasswordPolicyConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateBackendAuthPasswordPolicyConfig
passwordPolicy,
            (Text
"mfa" Text -> CreateBackendAuthMFAConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CreateBackendAuthMFAConfig -> Pair)
-> Maybe CreateBackendAuthMFAConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateBackendAuthMFAConfig
mfa,
            (Text
"forgotPassword" Text -> CreateBackendAuthForgotPasswordConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CreateBackendAuthForgotPasswordConfig -> Pair)
-> Maybe CreateBackendAuthForgotPasswordConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateBackendAuthForgotPasswordConfig
forgotPassword,
            (Text
"oAuth" Text -> CreateBackendAuthOAuthConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CreateBackendAuthOAuthConfig -> Pair)
-> Maybe CreateBackendAuthOAuthConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateBackendAuthOAuthConfig
oAuth,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"requiredSignUpAttributes"
                  Text -> [RequiredSignUpAttributesElement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [RequiredSignUpAttributesElement]
requiredSignUpAttributes
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"signInMethod" Text -> SignInMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SignInMethod
signInMethod),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"userPoolName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolName)
          ]
      )