{-# 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.ConfirmForgotPassword
-- 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)
--
-- Allows a user to enter a confirmation code to reset a forgotten
-- password.
module Amazonka.CognitoIdentityProvider.ConfirmForgotPassword
  ( -- * Creating a Request
    ConfirmForgotPassword (..),
    newConfirmForgotPassword,

    -- * Request Lenses
    confirmForgotPassword_clientMetadata,
    confirmForgotPassword_analyticsMetadata,
    confirmForgotPassword_userContextData,
    confirmForgotPassword_secretHash,
    confirmForgotPassword_clientId,
    confirmForgotPassword_username,
    confirmForgotPassword_confirmationCode,
    confirmForgotPassword_password,

    -- * Destructuring the Response
    ConfirmForgotPasswordResponse (..),
    newConfirmForgotPasswordResponse,

    -- * Response Lenses
    confirmForgotPasswordResponse_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

-- | The request representing the confirmation for a password reset.
--
-- /See:/ 'newConfirmForgotPassword' smart constructor.
data ConfirmForgotPassword = ConfirmForgotPassword'
  { -- | A map of custom key-value pairs that you can provide as input for any
    -- custom workflows that this action triggers.
    --
    -- You create custom workflows by assigning Lambda functions to user pool
    -- triggers. When you use the ConfirmForgotPassword API action, Amazon
    -- Cognito invokes the function that is assigned to the /post confirmation/
    -- trigger. When Amazon Cognito invokes this function, it passes a JSON
    -- payload, which the function receives as input. This payload contains a
    -- @clientMetadata@ attribute, which provides the data that you assigned to
    -- the ClientMetadata parameter in your ConfirmForgotPassword request. In
    -- your function code in Lambda, you can process the @clientMetadata@ value
    -- to enhance your workflow for your specific needs.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html Customizing User Pool Workflows with Lambda Triggers>
    -- in the /Amazon Cognito Developer Guide/.
    --
    -- Take the following limitations into consideration when you use the
    -- ClientMetadata parameter:
    --
    -- -   Amazon Cognito does not store the ClientMetadata value. This data is
    --     available only to Lambda triggers that are assigned to a user pool
    --     to support custom workflows. If your user pool configuration does
    --     not include triggers, the ClientMetadata parameter serves no
    --     purpose.
    --
    -- -   Amazon Cognito does not validate the ClientMetadata value.
    --
    -- -   Amazon Cognito does not encrypt the the ClientMetadata value, so
    --     don\'t use it to provide sensitive information.
    ConfirmForgotPassword -> Maybe (HashMap Text Text)
clientMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Pinpoint analytics metadata for collecting metrics for
    -- @ConfirmForgotPassword@ calls.
    ConfirmForgotPassword -> Maybe AnalyticsMetadataType
analyticsMetadata :: Prelude.Maybe AnalyticsMetadataType,
    -- | Contextual data such as the user\'s device fingerprint, IP address, or
    -- location used for evaluating the risk of an unexpected event by Amazon
    -- Cognito advanced security.
    ConfirmForgotPassword -> Maybe UserContextDataType
userContextData :: Prelude.Maybe UserContextDataType,
    -- | A keyed-hash message authentication code (HMAC) calculated using the
    -- secret key of a user pool client and username plus the client ID in the
    -- message.
    ConfirmForgotPassword -> Maybe (Sensitive Text)
secretHash :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The app client ID of the app associated with the user pool.
    ConfirmForgotPassword -> Sensitive Text
clientId :: Core.Sensitive Prelude.Text,
    -- | The user name of the user for whom you want to enter a code to retrieve
    -- a forgotten password.
    ConfirmForgotPassword -> Sensitive Text
username :: Core.Sensitive Prelude.Text,
    -- | The confirmation code sent by a user\'s request to retrieve a forgotten
    -- password. For more information, see
    -- <https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html ForgotPassword>.
    ConfirmForgotPassword -> Text
confirmationCode :: Prelude.Text,
    -- | The password sent by a user\'s request to retrieve a forgotten password.
    ConfirmForgotPassword -> Sensitive Text
password :: Core.Sensitive Prelude.Text
  }
  deriving (ConfirmForgotPassword -> ConfirmForgotPassword -> Bool
(ConfirmForgotPassword -> ConfirmForgotPassword -> Bool)
-> (ConfirmForgotPassword -> ConfirmForgotPassword -> Bool)
-> Eq ConfirmForgotPassword
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmForgotPassword -> ConfirmForgotPassword -> Bool
$c/= :: ConfirmForgotPassword -> ConfirmForgotPassword -> Bool
== :: ConfirmForgotPassword -> ConfirmForgotPassword -> Bool
$c== :: ConfirmForgotPassword -> ConfirmForgotPassword -> Bool
Prelude.Eq, Int -> ConfirmForgotPassword -> ShowS
[ConfirmForgotPassword] -> ShowS
ConfirmForgotPassword -> String
(Int -> ConfirmForgotPassword -> ShowS)
-> (ConfirmForgotPassword -> String)
-> ([ConfirmForgotPassword] -> ShowS)
-> Show ConfirmForgotPassword
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmForgotPassword] -> ShowS
$cshowList :: [ConfirmForgotPassword] -> ShowS
show :: ConfirmForgotPassword -> String
$cshow :: ConfirmForgotPassword -> String
showsPrec :: Int -> ConfirmForgotPassword -> ShowS
$cshowsPrec :: Int -> ConfirmForgotPassword -> ShowS
Prelude.Show, (forall x. ConfirmForgotPassword -> Rep ConfirmForgotPassword x)
-> (forall x. Rep ConfirmForgotPassword x -> ConfirmForgotPassword)
-> Generic ConfirmForgotPassword
forall x. Rep ConfirmForgotPassword x -> ConfirmForgotPassword
forall x. ConfirmForgotPassword -> Rep ConfirmForgotPassword x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfirmForgotPassword x -> ConfirmForgotPassword
$cfrom :: forall x. ConfirmForgotPassword -> Rep ConfirmForgotPassword x
Prelude.Generic)

-- |
-- Create a value of 'ConfirmForgotPassword' 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:
--
-- 'clientMetadata', 'confirmForgotPassword_clientMetadata' - A map of custom key-value pairs that you can provide as input for any
-- custom workflows that this action triggers.
--
-- You create custom workflows by assigning Lambda functions to user pool
-- triggers. When you use the ConfirmForgotPassword API action, Amazon
-- Cognito invokes the function that is assigned to the /post confirmation/
-- trigger. When Amazon Cognito invokes this function, it passes a JSON
-- payload, which the function receives as input. This payload contains a
-- @clientMetadata@ attribute, which provides the data that you assigned to
-- the ClientMetadata parameter in your ConfirmForgotPassword request. In
-- your function code in Lambda, you can process the @clientMetadata@ value
-- to enhance your workflow for your specific needs.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html Customizing User Pool Workflows with Lambda Triggers>
-- in the /Amazon Cognito Developer Guide/.
--
-- Take the following limitations into consideration when you use the
-- ClientMetadata parameter:
--
-- -   Amazon Cognito does not store the ClientMetadata value. This data is
--     available only to Lambda triggers that are assigned to a user pool
--     to support custom workflows. If your user pool configuration does
--     not include triggers, the ClientMetadata parameter serves no
--     purpose.
--
-- -   Amazon Cognito does not validate the ClientMetadata value.
--
-- -   Amazon Cognito does not encrypt the the ClientMetadata value, so
--     don\'t use it to provide sensitive information.
--
-- 'analyticsMetadata', 'confirmForgotPassword_analyticsMetadata' - The Amazon Pinpoint analytics metadata for collecting metrics for
-- @ConfirmForgotPassword@ calls.
--
-- 'userContextData', 'confirmForgotPassword_userContextData' - Contextual data such as the user\'s device fingerprint, IP address, or
-- location used for evaluating the risk of an unexpected event by Amazon
-- Cognito advanced security.
--
-- 'secretHash', 'confirmForgotPassword_secretHash' - A keyed-hash message authentication code (HMAC) calculated using the
-- secret key of a user pool client and username plus the client ID in the
-- message.
--
-- 'clientId', 'confirmForgotPassword_clientId' - The app client ID of the app associated with the user pool.
--
-- 'username', 'confirmForgotPassword_username' - The user name of the user for whom you want to enter a code to retrieve
-- a forgotten password.
--
-- 'confirmationCode', 'confirmForgotPassword_confirmationCode' - The confirmation code sent by a user\'s request to retrieve a forgotten
-- password. For more information, see
-- <https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html ForgotPassword>.
--
-- 'password', 'confirmForgotPassword_password' - The password sent by a user\'s request to retrieve a forgotten password.
newConfirmForgotPassword ::
  -- | 'clientId'
  Prelude.Text ->
  -- | 'username'
  Prelude.Text ->
  -- | 'confirmationCode'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  ConfirmForgotPassword
newConfirmForgotPassword :: Text -> Text -> Text -> Text -> ConfirmForgotPassword
newConfirmForgotPassword
  Text
pClientId_
  Text
pUsername_
  Text
pConfirmationCode_
  Text
pPassword_ =
    ConfirmForgotPassword' :: Maybe (HashMap Text Text)
-> Maybe AnalyticsMetadataType
-> Maybe UserContextDataType
-> Maybe (Sensitive Text)
-> Sensitive Text
-> Sensitive Text
-> Text
-> Sensitive Text
-> ConfirmForgotPassword
ConfirmForgotPassword'
      { $sel:clientMetadata:ConfirmForgotPassword' :: Maybe (HashMap Text Text)
clientMetadata =
          Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:analyticsMetadata:ConfirmForgotPassword' :: Maybe AnalyticsMetadataType
analyticsMetadata = Maybe AnalyticsMetadataType
forall a. Maybe a
Prelude.Nothing,
        $sel:userContextData:ConfirmForgotPassword' :: Maybe UserContextDataType
userContextData = Maybe UserContextDataType
forall a. Maybe a
Prelude.Nothing,
        $sel:secretHash:ConfirmForgotPassword' :: Maybe (Sensitive Text)
secretHash = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:clientId:ConfirmForgotPassword' :: Sensitive Text
clientId = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pClientId_,
        $sel:username:ConfirmForgotPassword' :: Sensitive Text
username = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pUsername_,
        $sel:confirmationCode:ConfirmForgotPassword' :: Text
confirmationCode = Text
pConfirmationCode_,
        $sel:password:ConfirmForgotPassword' :: Sensitive Text
password = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_
      }

-- | A map of custom key-value pairs that you can provide as input for any
-- custom workflows that this action triggers.
--
-- You create custom workflows by assigning Lambda functions to user pool
-- triggers. When you use the ConfirmForgotPassword API action, Amazon
-- Cognito invokes the function that is assigned to the /post confirmation/
-- trigger. When Amazon Cognito invokes this function, it passes a JSON
-- payload, which the function receives as input. This payload contains a
-- @clientMetadata@ attribute, which provides the data that you assigned to
-- the ClientMetadata parameter in your ConfirmForgotPassword request. In
-- your function code in Lambda, you can process the @clientMetadata@ value
-- to enhance your workflow for your specific needs.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html Customizing User Pool Workflows with Lambda Triggers>
-- in the /Amazon Cognito Developer Guide/.
--
-- Take the following limitations into consideration when you use the
-- ClientMetadata parameter:
--
-- -   Amazon Cognito does not store the ClientMetadata value. This data is
--     available only to Lambda triggers that are assigned to a user pool
--     to support custom workflows. If your user pool configuration does
--     not include triggers, the ClientMetadata parameter serves no
--     purpose.
--
-- -   Amazon Cognito does not validate the ClientMetadata value.
--
-- -   Amazon Cognito does not encrypt the the ClientMetadata value, so
--     don\'t use it to provide sensitive information.
confirmForgotPassword_clientMetadata :: Lens.Lens' ConfirmForgotPassword (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
confirmForgotPassword_clientMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_clientMetadata = (ConfirmForgotPassword -> Maybe (HashMap Text Text))
-> (ConfirmForgotPassword
    -> Maybe (HashMap Text Text) -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Maybe (HashMap Text Text)
clientMetadata :: Maybe (HashMap Text Text)
$sel:clientMetadata:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe (HashMap Text Text)
clientMetadata} -> Maybe (HashMap Text Text)
clientMetadata) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Maybe (HashMap Text Text)
a -> ConfirmForgotPassword
s {$sel:clientMetadata:ConfirmForgotPassword' :: Maybe (HashMap Text Text)
clientMetadata = Maybe (HashMap Text Text)
a} :: ConfirmForgotPassword) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ConfirmForgotPassword -> f ConfirmForgotPassword)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ConfirmForgotPassword
-> f ConfirmForgotPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Pinpoint analytics metadata for collecting metrics for
-- @ConfirmForgotPassword@ calls.
confirmForgotPassword_analyticsMetadata :: Lens.Lens' ConfirmForgotPassword (Prelude.Maybe AnalyticsMetadataType)
confirmForgotPassword_analyticsMetadata :: (Maybe AnalyticsMetadataType -> f (Maybe AnalyticsMetadataType))
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_analyticsMetadata = (ConfirmForgotPassword -> Maybe AnalyticsMetadataType)
-> (ConfirmForgotPassword
    -> Maybe AnalyticsMetadataType -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Maybe AnalyticsMetadataType)
     (Maybe AnalyticsMetadataType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Maybe AnalyticsMetadataType
analyticsMetadata :: Maybe AnalyticsMetadataType
$sel:analyticsMetadata:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe AnalyticsMetadataType
analyticsMetadata} -> Maybe AnalyticsMetadataType
analyticsMetadata) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Maybe AnalyticsMetadataType
a -> ConfirmForgotPassword
s {$sel:analyticsMetadata:ConfirmForgotPassword' :: Maybe AnalyticsMetadataType
analyticsMetadata = Maybe AnalyticsMetadataType
a} :: ConfirmForgotPassword)

-- | Contextual data such as the user\'s device fingerprint, IP address, or
-- location used for evaluating the risk of an unexpected event by Amazon
-- Cognito advanced security.
confirmForgotPassword_userContextData :: Lens.Lens' ConfirmForgotPassword (Prelude.Maybe UserContextDataType)
confirmForgotPassword_userContextData :: (Maybe UserContextDataType -> f (Maybe UserContextDataType))
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_userContextData = (ConfirmForgotPassword -> Maybe UserContextDataType)
-> (ConfirmForgotPassword
    -> Maybe UserContextDataType -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Maybe UserContextDataType)
     (Maybe UserContextDataType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Maybe UserContextDataType
userContextData :: Maybe UserContextDataType
$sel:userContextData:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe UserContextDataType
userContextData} -> Maybe UserContextDataType
userContextData) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Maybe UserContextDataType
a -> ConfirmForgotPassword
s {$sel:userContextData:ConfirmForgotPassword' :: Maybe UserContextDataType
userContextData = Maybe UserContextDataType
a} :: ConfirmForgotPassword)

-- | A keyed-hash message authentication code (HMAC) calculated using the
-- secret key of a user pool client and username plus the client ID in the
-- message.
confirmForgotPassword_secretHash :: Lens.Lens' ConfirmForgotPassword (Prelude.Maybe Prelude.Text)
confirmForgotPassword_secretHash :: (Maybe Text -> f (Maybe Text))
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_secretHash = (ConfirmForgotPassword -> Maybe (Sensitive Text))
-> (ConfirmForgotPassword
    -> Maybe (Sensitive Text) -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Maybe (Sensitive Text)
secretHash :: Maybe (Sensitive Text)
$sel:secretHash:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe (Sensitive Text)
secretHash} -> Maybe (Sensitive Text)
secretHash) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Maybe (Sensitive Text)
a -> ConfirmForgotPassword
s {$sel:secretHash:ConfirmForgotPassword' :: Maybe (Sensitive Text)
secretHash = Maybe (Sensitive Text)
a} :: ConfirmForgotPassword) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ConfirmForgotPassword -> f ConfirmForgotPassword)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ConfirmForgotPassword
-> f ConfirmForgotPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The app client ID of the app associated with the user pool.
confirmForgotPassword_clientId :: Lens.Lens' ConfirmForgotPassword Prelude.Text
confirmForgotPassword_clientId :: (Text -> f Text)
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_clientId = (ConfirmForgotPassword -> Sensitive Text)
-> (ConfirmForgotPassword
    -> Sensitive Text -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Sensitive Text
clientId :: Sensitive Text
$sel:clientId:ConfirmForgotPassword' :: ConfirmForgotPassword -> Sensitive Text
clientId} -> Sensitive Text
clientId) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Sensitive Text
a -> ConfirmForgotPassword
s {$sel:clientId:ConfirmForgotPassword' :: Sensitive Text
clientId = Sensitive Text
a} :: ConfirmForgotPassword) ((Sensitive Text -> f (Sensitive Text))
 -> ConfirmForgotPassword -> f ConfirmForgotPassword)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ConfirmForgotPassword
-> f ConfirmForgotPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The user name of the user for whom you want to enter a code to retrieve
-- a forgotten password.
confirmForgotPassword_username :: Lens.Lens' ConfirmForgotPassword Prelude.Text
confirmForgotPassword_username :: (Text -> f Text)
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_username = (ConfirmForgotPassword -> Sensitive Text)
-> (ConfirmForgotPassword
    -> Sensitive Text -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Sensitive Text
username :: Sensitive Text
$sel:username:ConfirmForgotPassword' :: ConfirmForgotPassword -> Sensitive Text
username} -> Sensitive Text
username) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Sensitive Text
a -> ConfirmForgotPassword
s {$sel:username:ConfirmForgotPassword' :: Sensitive Text
username = Sensitive Text
a} :: ConfirmForgotPassword) ((Sensitive Text -> f (Sensitive Text))
 -> ConfirmForgotPassword -> f ConfirmForgotPassword)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ConfirmForgotPassword
-> f ConfirmForgotPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The confirmation code sent by a user\'s request to retrieve a forgotten
-- password. For more information, see
-- <https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html ForgotPassword>.
confirmForgotPassword_confirmationCode :: Lens.Lens' ConfirmForgotPassword Prelude.Text
confirmForgotPassword_confirmationCode :: (Text -> f Text)
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_confirmationCode = (ConfirmForgotPassword -> Text)
-> (ConfirmForgotPassword -> Text -> ConfirmForgotPassword)
-> Lens ConfirmForgotPassword ConfirmForgotPassword Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Text
confirmationCode :: Text
$sel:confirmationCode:ConfirmForgotPassword' :: ConfirmForgotPassword -> Text
confirmationCode} -> Text
confirmationCode) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Text
a -> ConfirmForgotPassword
s {$sel:confirmationCode:ConfirmForgotPassword' :: Text
confirmationCode = Text
a} :: ConfirmForgotPassword)

-- | The password sent by a user\'s request to retrieve a forgotten password.
confirmForgotPassword_password :: Lens.Lens' ConfirmForgotPassword Prelude.Text
confirmForgotPassword_password :: (Text -> f Text)
-> ConfirmForgotPassword -> f ConfirmForgotPassword
confirmForgotPassword_password = (ConfirmForgotPassword -> Sensitive Text)
-> (ConfirmForgotPassword
    -> Sensitive Text -> ConfirmForgotPassword)
-> Lens
     ConfirmForgotPassword
     ConfirmForgotPassword
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmForgotPassword' {Sensitive Text
password :: Sensitive Text
$sel:password:ConfirmForgotPassword' :: ConfirmForgotPassword -> Sensitive Text
password} -> Sensitive Text
password) (\s :: ConfirmForgotPassword
s@ConfirmForgotPassword' {} Sensitive Text
a -> ConfirmForgotPassword
s {$sel:password:ConfirmForgotPassword' :: Sensitive Text
password = Sensitive Text
a} :: ConfirmForgotPassword) ((Sensitive Text -> f (Sensitive Text))
 -> ConfirmForgotPassword -> f ConfirmForgotPassword)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ConfirmForgotPassword
-> f ConfirmForgotPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSRequest ConfirmForgotPassword where
  type
    AWSResponse ConfirmForgotPassword =
      ConfirmForgotPasswordResponse
  request :: ConfirmForgotPassword -> Request ConfirmForgotPassword
request = Service -> ConfirmForgotPassword -> Request ConfirmForgotPassword
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ConfirmForgotPassword
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ConfirmForgotPassword)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ConfirmForgotPassword))
-> Logger
-> Service
-> Proxy ConfirmForgotPassword
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ConfirmForgotPassword)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> ConfirmForgotPasswordResponse
ConfirmForgotPasswordResponse'
            (Int -> ConfirmForgotPasswordResponse)
-> Either String Int -> Either String ConfirmForgotPasswordResponse
forall (f :: * -> *) a b. Functor 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 ConfirmForgotPassword

instance Prelude.NFData ConfirmForgotPassword

instance Core.ToHeaders ConfirmForgotPassword where
  toHeaders :: ConfirmForgotPassword -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ConfirmForgotPassword -> 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.ConfirmForgotPassword" ::
                          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 ConfirmForgotPassword where
  toJSON :: ConfirmForgotPassword -> Value
toJSON ConfirmForgotPassword' {Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Maybe AnalyticsMetadataType
Maybe UserContextDataType
Text
Sensitive Text
password :: Sensitive Text
confirmationCode :: Text
username :: Sensitive Text
clientId :: Sensitive Text
secretHash :: Maybe (Sensitive Text)
userContextData :: Maybe UserContextDataType
analyticsMetadata :: Maybe AnalyticsMetadataType
clientMetadata :: Maybe (HashMap Text Text)
$sel:password:ConfirmForgotPassword' :: ConfirmForgotPassword -> Sensitive Text
$sel:confirmationCode:ConfirmForgotPassword' :: ConfirmForgotPassword -> Text
$sel:username:ConfirmForgotPassword' :: ConfirmForgotPassword -> Sensitive Text
$sel:clientId:ConfirmForgotPassword' :: ConfirmForgotPassword -> Sensitive Text
$sel:secretHash:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe (Sensitive Text)
$sel:userContextData:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe UserContextDataType
$sel:analyticsMetadata:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe AnalyticsMetadataType
$sel:clientMetadata:ConfirmForgotPassword' :: ConfirmForgotPassword -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientMetadata" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
clientMetadata,
            (Text
"AnalyticsMetadata" Text -> AnalyticsMetadataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AnalyticsMetadataType -> Pair)
-> Maybe AnalyticsMetadataType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnalyticsMetadataType
analyticsMetadata,
            (Text
"UserContextData" Text -> UserContextDataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UserContextDataType -> Pair)
-> Maybe UserContextDataType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserContextDataType
userContextData,
            (Text
"SecretHash" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
secretHash,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
clientId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
username),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ConfirmationCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
confirmationCode),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password)
          ]
      )

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

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

-- | The response from the server that results from a user\'s request to
-- retrieve a forgotten password.
--
-- /See:/ 'newConfirmForgotPasswordResponse' smart constructor.
data ConfirmForgotPasswordResponse = ConfirmForgotPasswordResponse'
  { -- | The response's http status code.
    ConfirmForgotPasswordResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ConfirmForgotPasswordResponse
-> ConfirmForgotPasswordResponse -> Bool
(ConfirmForgotPasswordResponse
 -> ConfirmForgotPasswordResponse -> Bool)
-> (ConfirmForgotPasswordResponse
    -> ConfirmForgotPasswordResponse -> Bool)
-> Eq ConfirmForgotPasswordResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmForgotPasswordResponse
-> ConfirmForgotPasswordResponse -> Bool
$c/= :: ConfirmForgotPasswordResponse
-> ConfirmForgotPasswordResponse -> Bool
== :: ConfirmForgotPasswordResponse
-> ConfirmForgotPasswordResponse -> Bool
$c== :: ConfirmForgotPasswordResponse
-> ConfirmForgotPasswordResponse -> Bool
Prelude.Eq, ReadPrec [ConfirmForgotPasswordResponse]
ReadPrec ConfirmForgotPasswordResponse
Int -> ReadS ConfirmForgotPasswordResponse
ReadS [ConfirmForgotPasswordResponse]
(Int -> ReadS ConfirmForgotPasswordResponse)
-> ReadS [ConfirmForgotPasswordResponse]
-> ReadPrec ConfirmForgotPasswordResponse
-> ReadPrec [ConfirmForgotPasswordResponse]
-> Read ConfirmForgotPasswordResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmForgotPasswordResponse]
$creadListPrec :: ReadPrec [ConfirmForgotPasswordResponse]
readPrec :: ReadPrec ConfirmForgotPasswordResponse
$creadPrec :: ReadPrec ConfirmForgotPasswordResponse
readList :: ReadS [ConfirmForgotPasswordResponse]
$creadList :: ReadS [ConfirmForgotPasswordResponse]
readsPrec :: Int -> ReadS ConfirmForgotPasswordResponse
$creadsPrec :: Int -> ReadS ConfirmForgotPasswordResponse
Prelude.Read, Int -> ConfirmForgotPasswordResponse -> ShowS
[ConfirmForgotPasswordResponse] -> ShowS
ConfirmForgotPasswordResponse -> String
(Int -> ConfirmForgotPasswordResponse -> ShowS)
-> (ConfirmForgotPasswordResponse -> String)
-> ([ConfirmForgotPasswordResponse] -> ShowS)
-> Show ConfirmForgotPasswordResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmForgotPasswordResponse] -> ShowS
$cshowList :: [ConfirmForgotPasswordResponse] -> ShowS
show :: ConfirmForgotPasswordResponse -> String
$cshow :: ConfirmForgotPasswordResponse -> String
showsPrec :: Int -> ConfirmForgotPasswordResponse -> ShowS
$cshowsPrec :: Int -> ConfirmForgotPasswordResponse -> ShowS
Prelude.Show, (forall x.
 ConfirmForgotPasswordResponse
 -> Rep ConfirmForgotPasswordResponse x)
-> (forall x.
    Rep ConfirmForgotPasswordResponse x
    -> ConfirmForgotPasswordResponse)
-> Generic ConfirmForgotPasswordResponse
forall x.
Rep ConfirmForgotPasswordResponse x
-> ConfirmForgotPasswordResponse
forall x.
ConfirmForgotPasswordResponse
-> Rep ConfirmForgotPasswordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfirmForgotPasswordResponse x
-> ConfirmForgotPasswordResponse
$cfrom :: forall x.
ConfirmForgotPasswordResponse
-> Rep ConfirmForgotPasswordResponse x
Prelude.Generic)

-- |
-- Create a value of 'ConfirmForgotPasswordResponse' 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:
--
-- 'httpStatus', 'confirmForgotPasswordResponse_httpStatus' - The response's http status code.
newConfirmForgotPasswordResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ConfirmForgotPasswordResponse
newConfirmForgotPasswordResponse :: Int -> ConfirmForgotPasswordResponse
newConfirmForgotPasswordResponse Int
pHttpStatus_ =
  ConfirmForgotPasswordResponse' :: Int -> ConfirmForgotPasswordResponse
ConfirmForgotPasswordResponse'
    { $sel:httpStatus:ConfirmForgotPasswordResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData ConfirmForgotPasswordResponse