{-# 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.ConfirmSignUp
-- 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)
--
-- Confirms registration of a user and handles the existing alias from a
-- previous user.
module Amazonka.CognitoIdentityProvider.ConfirmSignUp
  ( -- * Creating a Request
    ConfirmSignUp (..),
    newConfirmSignUp,

    -- * Request Lenses
    confirmSignUp_clientMetadata,
    confirmSignUp_forceAliasCreation,
    confirmSignUp_analyticsMetadata,
    confirmSignUp_userContextData,
    confirmSignUp_secretHash,
    confirmSignUp_clientId,
    confirmSignUp_username,
    confirmSignUp_confirmationCode,

    -- * Destructuring the Response
    ConfirmSignUpResponse (..),
    newConfirmSignUpResponse,

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

-- | Represents the request to confirm registration of a user.
--
-- /See:/ 'newConfirmSignUp' smart constructor.
data ConfirmSignUp = ConfirmSignUp'
  { -- | 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 ConfirmSignUp 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 ConfirmSignUp 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.
    ConfirmSignUp -> Maybe (HashMap Text Text)
clientMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Boolean to be specified to force user confirmation irrespective of
    -- existing alias. By default set to @False@. If this parameter is set to
    -- @True@ and the phone number\/email used for sign up confirmation already
    -- exists as an alias with a different user, the API call will migrate the
    -- alias from the previous user to the newly created user being confirmed.
    -- If set to @False@, the API will throw an __AliasExistsException__ error.
    ConfirmSignUp -> Maybe Bool
forceAliasCreation :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Pinpoint analytics metadata for collecting metrics for
    -- @ConfirmSignUp@ calls.
    ConfirmSignUp -> 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.
    ConfirmSignUp -> 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.
    ConfirmSignUp -> Maybe (Sensitive Text)
secretHash :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the app client associated with the user pool.
    ConfirmSignUp -> Sensitive Text
clientId :: Core.Sensitive Prelude.Text,
    -- | The user name of the user whose registration you wish to confirm.
    ConfirmSignUp -> Sensitive Text
username :: Core.Sensitive Prelude.Text,
    -- | The confirmation code sent by a user\'s request to confirm registration.
    ConfirmSignUp -> Text
confirmationCode :: Prelude.Text
  }
  deriving (ConfirmSignUp -> ConfirmSignUp -> Bool
(ConfirmSignUp -> ConfirmSignUp -> Bool)
-> (ConfirmSignUp -> ConfirmSignUp -> Bool) -> Eq ConfirmSignUp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmSignUp -> ConfirmSignUp -> Bool
$c/= :: ConfirmSignUp -> ConfirmSignUp -> Bool
== :: ConfirmSignUp -> ConfirmSignUp -> Bool
$c== :: ConfirmSignUp -> ConfirmSignUp -> Bool
Prelude.Eq, Int -> ConfirmSignUp -> ShowS
[ConfirmSignUp] -> ShowS
ConfirmSignUp -> String
(Int -> ConfirmSignUp -> ShowS)
-> (ConfirmSignUp -> String)
-> ([ConfirmSignUp] -> ShowS)
-> Show ConfirmSignUp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmSignUp] -> ShowS
$cshowList :: [ConfirmSignUp] -> ShowS
show :: ConfirmSignUp -> String
$cshow :: ConfirmSignUp -> String
showsPrec :: Int -> ConfirmSignUp -> ShowS
$cshowsPrec :: Int -> ConfirmSignUp -> ShowS
Prelude.Show, (forall x. ConfirmSignUp -> Rep ConfirmSignUp x)
-> (forall x. Rep ConfirmSignUp x -> ConfirmSignUp)
-> Generic ConfirmSignUp
forall x. Rep ConfirmSignUp x -> ConfirmSignUp
forall x. ConfirmSignUp -> Rep ConfirmSignUp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfirmSignUp x -> ConfirmSignUp
$cfrom :: forall x. ConfirmSignUp -> Rep ConfirmSignUp x
Prelude.Generic)

-- |
-- Create a value of 'ConfirmSignUp' 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', 'confirmSignUp_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 ConfirmSignUp 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 ConfirmSignUp 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.
--
-- 'forceAliasCreation', 'confirmSignUp_forceAliasCreation' - Boolean to be specified to force user confirmation irrespective of
-- existing alias. By default set to @False@. If this parameter is set to
-- @True@ and the phone number\/email used for sign up confirmation already
-- exists as an alias with a different user, the API call will migrate the
-- alias from the previous user to the newly created user being confirmed.
-- If set to @False@, the API will throw an __AliasExistsException__ error.
--
-- 'analyticsMetadata', 'confirmSignUp_analyticsMetadata' - The Amazon Pinpoint analytics metadata for collecting metrics for
-- @ConfirmSignUp@ calls.
--
-- 'userContextData', 'confirmSignUp_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', 'confirmSignUp_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', 'confirmSignUp_clientId' - The ID of the app client associated with the user pool.
--
-- 'username', 'confirmSignUp_username' - The user name of the user whose registration you wish to confirm.
--
-- 'confirmationCode', 'confirmSignUp_confirmationCode' - The confirmation code sent by a user\'s request to confirm registration.
newConfirmSignUp ::
  -- | 'clientId'
  Prelude.Text ->
  -- | 'username'
  Prelude.Text ->
  -- | 'confirmationCode'
  Prelude.Text ->
  ConfirmSignUp
newConfirmSignUp :: Text -> Text -> Text -> ConfirmSignUp
newConfirmSignUp
  Text
pClientId_
  Text
pUsername_
  Text
pConfirmationCode_ =
    ConfirmSignUp' :: Maybe (HashMap Text Text)
-> Maybe Bool
-> Maybe AnalyticsMetadataType
-> Maybe UserContextDataType
-> Maybe (Sensitive Text)
-> Sensitive Text
-> Sensitive Text
-> Text
-> ConfirmSignUp
ConfirmSignUp'
      { $sel:clientMetadata:ConfirmSignUp' :: Maybe (HashMap Text Text)
clientMetadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:forceAliasCreation:ConfirmSignUp' :: Maybe Bool
forceAliasCreation = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:analyticsMetadata:ConfirmSignUp' :: Maybe AnalyticsMetadataType
analyticsMetadata = Maybe AnalyticsMetadataType
forall a. Maybe a
Prelude.Nothing,
        $sel:userContextData:ConfirmSignUp' :: Maybe UserContextDataType
userContextData = Maybe UserContextDataType
forall a. Maybe a
Prelude.Nothing,
        $sel:secretHash:ConfirmSignUp' :: Maybe (Sensitive Text)
secretHash = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:clientId:ConfirmSignUp' :: 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:ConfirmSignUp' :: 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:ConfirmSignUp' :: Text
confirmationCode = Text
pConfirmationCode_
      }

-- | 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 ConfirmSignUp 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 ConfirmSignUp 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.
confirmSignUp_clientMetadata :: Lens.Lens' ConfirmSignUp (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
confirmSignUp_clientMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_clientMetadata = (ConfirmSignUp -> Maybe (HashMap Text Text))
-> (ConfirmSignUp -> Maybe (HashMap Text Text) -> ConfirmSignUp)
-> Lens
     ConfirmSignUp
     ConfirmSignUp
     (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 (\ConfirmSignUp' {Maybe (HashMap Text Text)
clientMetadata :: Maybe (HashMap Text Text)
$sel:clientMetadata:ConfirmSignUp' :: ConfirmSignUp -> Maybe (HashMap Text Text)
clientMetadata} -> Maybe (HashMap Text Text)
clientMetadata) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Maybe (HashMap Text Text)
a -> ConfirmSignUp
s {$sel:clientMetadata:ConfirmSignUp' :: Maybe (HashMap Text Text)
clientMetadata = Maybe (HashMap Text Text)
a} :: ConfirmSignUp) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ConfirmSignUp -> f ConfirmSignUp)
-> ((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)))
-> ConfirmSignUp
-> f ConfirmSignUp
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

-- | Boolean to be specified to force user confirmation irrespective of
-- existing alias. By default set to @False@. If this parameter is set to
-- @True@ and the phone number\/email used for sign up confirmation already
-- exists as an alias with a different user, the API call will migrate the
-- alias from the previous user to the newly created user being confirmed.
-- If set to @False@, the API will throw an __AliasExistsException__ error.
confirmSignUp_forceAliasCreation :: Lens.Lens' ConfirmSignUp (Prelude.Maybe Prelude.Bool)
confirmSignUp_forceAliasCreation :: (Maybe Bool -> f (Maybe Bool)) -> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_forceAliasCreation = (ConfirmSignUp -> Maybe Bool)
-> (ConfirmSignUp -> Maybe Bool -> ConfirmSignUp)
-> Lens ConfirmSignUp ConfirmSignUp (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSignUp' {Maybe Bool
forceAliasCreation :: Maybe Bool
$sel:forceAliasCreation:ConfirmSignUp' :: ConfirmSignUp -> Maybe Bool
forceAliasCreation} -> Maybe Bool
forceAliasCreation) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Maybe Bool
a -> ConfirmSignUp
s {$sel:forceAliasCreation:ConfirmSignUp' :: Maybe Bool
forceAliasCreation = Maybe Bool
a} :: ConfirmSignUp)

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

-- | 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.
confirmSignUp_userContextData :: Lens.Lens' ConfirmSignUp (Prelude.Maybe UserContextDataType)
confirmSignUp_userContextData :: (Maybe UserContextDataType -> f (Maybe UserContextDataType))
-> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_userContextData = (ConfirmSignUp -> Maybe UserContextDataType)
-> (ConfirmSignUp -> Maybe UserContextDataType -> ConfirmSignUp)
-> Lens
     ConfirmSignUp
     ConfirmSignUp
     (Maybe UserContextDataType)
     (Maybe UserContextDataType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSignUp' {Maybe UserContextDataType
userContextData :: Maybe UserContextDataType
$sel:userContextData:ConfirmSignUp' :: ConfirmSignUp -> Maybe UserContextDataType
userContextData} -> Maybe UserContextDataType
userContextData) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Maybe UserContextDataType
a -> ConfirmSignUp
s {$sel:userContextData:ConfirmSignUp' :: Maybe UserContextDataType
userContextData = Maybe UserContextDataType
a} :: ConfirmSignUp)

-- | 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.
confirmSignUp_secretHash :: Lens.Lens' ConfirmSignUp (Prelude.Maybe Prelude.Text)
confirmSignUp_secretHash :: (Maybe Text -> f (Maybe Text)) -> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_secretHash = (ConfirmSignUp -> Maybe (Sensitive Text))
-> (ConfirmSignUp -> Maybe (Sensitive Text) -> ConfirmSignUp)
-> Lens
     ConfirmSignUp
     ConfirmSignUp
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSignUp' {Maybe (Sensitive Text)
secretHash :: Maybe (Sensitive Text)
$sel:secretHash:ConfirmSignUp' :: ConfirmSignUp -> Maybe (Sensitive Text)
secretHash} -> Maybe (Sensitive Text)
secretHash) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Maybe (Sensitive Text)
a -> ConfirmSignUp
s {$sel:secretHash:ConfirmSignUp' :: Maybe (Sensitive Text)
secretHash = Maybe (Sensitive Text)
a} :: ConfirmSignUp) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ConfirmSignUp -> f ConfirmSignUp)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ConfirmSignUp
-> f ConfirmSignUp
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 ID of the app client associated with the user pool.
confirmSignUp_clientId :: Lens.Lens' ConfirmSignUp Prelude.Text
confirmSignUp_clientId :: (Text -> f Text) -> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_clientId = (ConfirmSignUp -> Sensitive Text)
-> (ConfirmSignUp -> Sensitive Text -> ConfirmSignUp)
-> Lens
     ConfirmSignUp ConfirmSignUp (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSignUp' {Sensitive Text
clientId :: Sensitive Text
$sel:clientId:ConfirmSignUp' :: ConfirmSignUp -> Sensitive Text
clientId} -> Sensitive Text
clientId) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Sensitive Text
a -> ConfirmSignUp
s {$sel:clientId:ConfirmSignUp' :: Sensitive Text
clientId = Sensitive Text
a} :: ConfirmSignUp) ((Sensitive Text -> f (Sensitive Text))
 -> ConfirmSignUp -> f ConfirmSignUp)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ConfirmSignUp
-> f ConfirmSignUp
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 whose registration you wish to confirm.
confirmSignUp_username :: Lens.Lens' ConfirmSignUp Prelude.Text
confirmSignUp_username :: (Text -> f Text) -> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_username = (ConfirmSignUp -> Sensitive Text)
-> (ConfirmSignUp -> Sensitive Text -> ConfirmSignUp)
-> Lens
     ConfirmSignUp ConfirmSignUp (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSignUp' {Sensitive Text
username :: Sensitive Text
$sel:username:ConfirmSignUp' :: ConfirmSignUp -> Sensitive Text
username} -> Sensitive Text
username) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Sensitive Text
a -> ConfirmSignUp
s {$sel:username:ConfirmSignUp' :: Sensitive Text
username = Sensitive Text
a} :: ConfirmSignUp) ((Sensitive Text -> f (Sensitive Text))
 -> ConfirmSignUp -> f ConfirmSignUp)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ConfirmSignUp
-> f ConfirmSignUp
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 confirm registration.
confirmSignUp_confirmationCode :: Lens.Lens' ConfirmSignUp Prelude.Text
confirmSignUp_confirmationCode :: (Text -> f Text) -> ConfirmSignUp -> f ConfirmSignUp
confirmSignUp_confirmationCode = (ConfirmSignUp -> Text)
-> (ConfirmSignUp -> Text -> ConfirmSignUp)
-> Lens ConfirmSignUp ConfirmSignUp Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfirmSignUp' {Text
confirmationCode :: Text
$sel:confirmationCode:ConfirmSignUp' :: ConfirmSignUp -> Text
confirmationCode} -> Text
confirmationCode) (\s :: ConfirmSignUp
s@ConfirmSignUp' {} Text
a -> ConfirmSignUp
s {$sel:confirmationCode:ConfirmSignUp' :: Text
confirmationCode = Text
a} :: ConfirmSignUp)

instance Core.AWSRequest ConfirmSignUp where
  type
    AWSResponse ConfirmSignUp =
      ConfirmSignUpResponse
  request :: ConfirmSignUp -> Request ConfirmSignUp
request = Service -> ConfirmSignUp -> Request ConfirmSignUp
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ConfirmSignUp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ConfirmSignUp)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ConfirmSignUp))
-> Logger
-> Service
-> Proxy ConfirmSignUp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ConfirmSignUp)))
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 -> ConfirmSignUpResponse
ConfirmSignUpResponse'
            (Int -> ConfirmSignUpResponse)
-> Either String Int -> Either String ConfirmSignUpResponse
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 ConfirmSignUp

instance Prelude.NFData ConfirmSignUp

instance Core.ToHeaders ConfirmSignUp where
  toHeaders :: ConfirmSignUp -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ConfirmSignUp -> 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.ConfirmSignUp" ::
                          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 ConfirmSignUp where
  toJSON :: ConfirmSignUp -> Value
toJSON ConfirmSignUp' {Maybe Bool
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Maybe AnalyticsMetadataType
Maybe UserContextDataType
Text
Sensitive Text
confirmationCode :: Text
username :: Sensitive Text
clientId :: Sensitive Text
secretHash :: Maybe (Sensitive Text)
userContextData :: Maybe UserContextDataType
analyticsMetadata :: Maybe AnalyticsMetadataType
forceAliasCreation :: Maybe Bool
clientMetadata :: Maybe (HashMap Text Text)
$sel:confirmationCode:ConfirmSignUp' :: ConfirmSignUp -> Text
$sel:username:ConfirmSignUp' :: ConfirmSignUp -> Sensitive Text
$sel:clientId:ConfirmSignUp' :: ConfirmSignUp -> Sensitive Text
$sel:secretHash:ConfirmSignUp' :: ConfirmSignUp -> Maybe (Sensitive Text)
$sel:userContextData:ConfirmSignUp' :: ConfirmSignUp -> Maybe UserContextDataType
$sel:analyticsMetadata:ConfirmSignUp' :: ConfirmSignUp -> Maybe AnalyticsMetadataType
$sel:forceAliasCreation:ConfirmSignUp' :: ConfirmSignUp -> Maybe Bool
$sel:clientMetadata:ConfirmSignUp' :: ConfirmSignUp -> 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
"ForceAliasCreation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceAliasCreation,
            (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)
          ]
      )

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

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

-- | Represents the response from the server for the registration
-- confirmation.
--
-- /See:/ 'newConfirmSignUpResponse' smart constructor.
data ConfirmSignUpResponse = ConfirmSignUpResponse'
  { -- | The response's http status code.
    ConfirmSignUpResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool
(ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool)
-> (ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool)
-> Eq ConfirmSignUpResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool
$c/= :: ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool
== :: ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool
$c== :: ConfirmSignUpResponse -> ConfirmSignUpResponse -> Bool
Prelude.Eq, ReadPrec [ConfirmSignUpResponse]
ReadPrec ConfirmSignUpResponse
Int -> ReadS ConfirmSignUpResponse
ReadS [ConfirmSignUpResponse]
(Int -> ReadS ConfirmSignUpResponse)
-> ReadS [ConfirmSignUpResponse]
-> ReadPrec ConfirmSignUpResponse
-> ReadPrec [ConfirmSignUpResponse]
-> Read ConfirmSignUpResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfirmSignUpResponse]
$creadListPrec :: ReadPrec [ConfirmSignUpResponse]
readPrec :: ReadPrec ConfirmSignUpResponse
$creadPrec :: ReadPrec ConfirmSignUpResponse
readList :: ReadS [ConfirmSignUpResponse]
$creadList :: ReadS [ConfirmSignUpResponse]
readsPrec :: Int -> ReadS ConfirmSignUpResponse
$creadsPrec :: Int -> ReadS ConfirmSignUpResponse
Prelude.Read, Int -> ConfirmSignUpResponse -> ShowS
[ConfirmSignUpResponse] -> ShowS
ConfirmSignUpResponse -> String
(Int -> ConfirmSignUpResponse -> ShowS)
-> (ConfirmSignUpResponse -> String)
-> ([ConfirmSignUpResponse] -> ShowS)
-> Show ConfirmSignUpResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfirmSignUpResponse] -> ShowS
$cshowList :: [ConfirmSignUpResponse] -> ShowS
show :: ConfirmSignUpResponse -> String
$cshow :: ConfirmSignUpResponse -> String
showsPrec :: Int -> ConfirmSignUpResponse -> ShowS
$cshowsPrec :: Int -> ConfirmSignUpResponse -> ShowS
Prelude.Show, (forall x. ConfirmSignUpResponse -> Rep ConfirmSignUpResponse x)
-> (forall x. Rep ConfirmSignUpResponse x -> ConfirmSignUpResponse)
-> Generic ConfirmSignUpResponse
forall x. Rep ConfirmSignUpResponse x -> ConfirmSignUpResponse
forall x. ConfirmSignUpResponse -> Rep ConfirmSignUpResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfirmSignUpResponse x -> ConfirmSignUpResponse
$cfrom :: forall x. ConfirmSignUpResponse -> Rep ConfirmSignUpResponse x
Prelude.Generic)

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

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

instance Prelude.NFData ConfirmSignUpResponse