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

    -- * Request Lenses
    resendConfirmationCode_clientMetadata,
    resendConfirmationCode_analyticsMetadata,
    resendConfirmationCode_userContextData,
    resendConfirmationCode_secretHash,
    resendConfirmationCode_clientId,
    resendConfirmationCode_username,

    -- * Destructuring the Response
    ResendConfirmationCodeResponse (..),
    newResendConfirmationCodeResponse,

    -- * Response Lenses
    resendConfirmationCodeResponse_codeDeliveryDetails,
    resendConfirmationCodeResponse_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 resend the confirmation code.
--
-- /See:/ 'newResendConfirmationCode' smart constructor.
data ResendConfirmationCode = ResendConfirmationCode'
  { -- | 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 ResendConfirmationCode API action, Amazon
    -- Cognito invokes the function that is assigned to the /custom message/
    -- 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 ResendConfirmationCode 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.
    ResendConfirmationCode -> Maybe (HashMap Text Text)
clientMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Pinpoint analytics metadata for collecting metrics for
    -- @ResendConfirmationCode@ calls.
    ResendConfirmationCode -> 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.
    ResendConfirmationCode -> 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.
    ResendConfirmationCode -> Maybe (Sensitive Text)
secretHash :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the client associated with the user pool.
    ResendConfirmationCode -> Sensitive Text
clientId :: Core.Sensitive Prelude.Text,
    -- | The user name of the user to whom you wish to resend a confirmation
    -- code.
    ResendConfirmationCode -> Sensitive Text
username :: Core.Sensitive Prelude.Text
  }
  deriving (ResendConfirmationCode -> ResendConfirmationCode -> Bool
(ResendConfirmationCode -> ResendConfirmationCode -> Bool)
-> (ResendConfirmationCode -> ResendConfirmationCode -> Bool)
-> Eq ResendConfirmationCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResendConfirmationCode -> ResendConfirmationCode -> Bool
$c/= :: ResendConfirmationCode -> ResendConfirmationCode -> Bool
== :: ResendConfirmationCode -> ResendConfirmationCode -> Bool
$c== :: ResendConfirmationCode -> ResendConfirmationCode -> Bool
Prelude.Eq, Int -> ResendConfirmationCode -> ShowS
[ResendConfirmationCode] -> ShowS
ResendConfirmationCode -> String
(Int -> ResendConfirmationCode -> ShowS)
-> (ResendConfirmationCode -> String)
-> ([ResendConfirmationCode] -> ShowS)
-> Show ResendConfirmationCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResendConfirmationCode] -> ShowS
$cshowList :: [ResendConfirmationCode] -> ShowS
show :: ResendConfirmationCode -> String
$cshow :: ResendConfirmationCode -> String
showsPrec :: Int -> ResendConfirmationCode -> ShowS
$cshowsPrec :: Int -> ResendConfirmationCode -> ShowS
Prelude.Show, (forall x. ResendConfirmationCode -> Rep ResendConfirmationCode x)
-> (forall x.
    Rep ResendConfirmationCode x -> ResendConfirmationCode)
-> Generic ResendConfirmationCode
forall x. Rep ResendConfirmationCode x -> ResendConfirmationCode
forall x. ResendConfirmationCode -> Rep ResendConfirmationCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResendConfirmationCode x -> ResendConfirmationCode
$cfrom :: forall x. ResendConfirmationCode -> Rep ResendConfirmationCode x
Prelude.Generic)

-- |
-- Create a value of 'ResendConfirmationCode' 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', 'resendConfirmationCode_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 ResendConfirmationCode API action, Amazon
-- Cognito invokes the function that is assigned to the /custom message/
-- 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 ResendConfirmationCode 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', 'resendConfirmationCode_analyticsMetadata' - The Amazon Pinpoint analytics metadata for collecting metrics for
-- @ResendConfirmationCode@ calls.
--
-- 'userContextData', 'resendConfirmationCode_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', 'resendConfirmationCode_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', 'resendConfirmationCode_clientId' - The ID of the client associated with the user pool.
--
-- 'username', 'resendConfirmationCode_username' - The user name of the user to whom you wish to resend a confirmation
-- code.
newResendConfirmationCode ::
  -- | 'clientId'
  Prelude.Text ->
  -- | 'username'
  Prelude.Text ->
  ResendConfirmationCode
newResendConfirmationCode :: Text -> Text -> ResendConfirmationCode
newResendConfirmationCode Text
pClientId_ Text
pUsername_ =
  ResendConfirmationCode' :: Maybe (HashMap Text Text)
-> Maybe AnalyticsMetadataType
-> Maybe UserContextDataType
-> Maybe (Sensitive Text)
-> Sensitive Text
-> Sensitive Text
-> ResendConfirmationCode
ResendConfirmationCode'
    { $sel:clientMetadata:ResendConfirmationCode' :: Maybe (HashMap Text Text)
clientMetadata =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:analyticsMetadata:ResendConfirmationCode' :: Maybe AnalyticsMetadataType
analyticsMetadata = Maybe AnalyticsMetadataType
forall a. Maybe a
Prelude.Nothing,
      $sel:userContextData:ResendConfirmationCode' :: Maybe UserContextDataType
userContextData = Maybe UserContextDataType
forall a. Maybe a
Prelude.Nothing,
      $sel:secretHash:ResendConfirmationCode' :: Maybe (Sensitive Text)
secretHash = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:clientId:ResendConfirmationCode' :: 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:ResendConfirmationCode' :: 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_
    }

-- | 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 ResendConfirmationCode API action, Amazon
-- Cognito invokes the function that is assigned to the /custom message/
-- 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 ResendConfirmationCode 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.
resendConfirmationCode_clientMetadata :: Lens.Lens' ResendConfirmationCode (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
resendConfirmationCode_clientMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ResendConfirmationCode -> f ResendConfirmationCode
resendConfirmationCode_clientMetadata = (ResendConfirmationCode -> Maybe (HashMap Text Text))
-> (ResendConfirmationCode
    -> Maybe (HashMap Text Text) -> ResendConfirmationCode)
-> Lens
     ResendConfirmationCode
     ResendConfirmationCode
     (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 (\ResendConfirmationCode' {Maybe (HashMap Text Text)
clientMetadata :: Maybe (HashMap Text Text)
$sel:clientMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (HashMap Text Text)
clientMetadata} -> Maybe (HashMap Text Text)
clientMetadata) (\s :: ResendConfirmationCode
s@ResendConfirmationCode' {} Maybe (HashMap Text Text)
a -> ResendConfirmationCode
s {$sel:clientMetadata:ResendConfirmationCode' :: Maybe (HashMap Text Text)
clientMetadata = Maybe (HashMap Text Text)
a} :: ResendConfirmationCode) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ResendConfirmationCode -> f ResendConfirmationCode)
-> ((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)))
-> ResendConfirmationCode
-> f ResendConfirmationCode
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
-- @ResendConfirmationCode@ calls.
resendConfirmationCode_analyticsMetadata :: Lens.Lens' ResendConfirmationCode (Prelude.Maybe AnalyticsMetadataType)
resendConfirmationCode_analyticsMetadata :: (Maybe AnalyticsMetadataType -> f (Maybe AnalyticsMetadataType))
-> ResendConfirmationCode -> f ResendConfirmationCode
resendConfirmationCode_analyticsMetadata = (ResendConfirmationCode -> Maybe AnalyticsMetadataType)
-> (ResendConfirmationCode
    -> Maybe AnalyticsMetadataType -> ResendConfirmationCode)
-> Lens
     ResendConfirmationCode
     ResendConfirmationCode
     (Maybe AnalyticsMetadataType)
     (Maybe AnalyticsMetadataType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResendConfirmationCode' {Maybe AnalyticsMetadataType
analyticsMetadata :: Maybe AnalyticsMetadataType
$sel:analyticsMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe AnalyticsMetadataType
analyticsMetadata} -> Maybe AnalyticsMetadataType
analyticsMetadata) (\s :: ResendConfirmationCode
s@ResendConfirmationCode' {} Maybe AnalyticsMetadataType
a -> ResendConfirmationCode
s {$sel:analyticsMetadata:ResendConfirmationCode' :: Maybe AnalyticsMetadataType
analyticsMetadata = Maybe AnalyticsMetadataType
a} :: ResendConfirmationCode)

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

-- | 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.
resendConfirmationCode_secretHash :: Lens.Lens' ResendConfirmationCode (Prelude.Maybe Prelude.Text)
resendConfirmationCode_secretHash :: (Maybe Text -> f (Maybe Text))
-> ResendConfirmationCode -> f ResendConfirmationCode
resendConfirmationCode_secretHash = (ResendConfirmationCode -> Maybe (Sensitive Text))
-> (ResendConfirmationCode
    -> Maybe (Sensitive Text) -> ResendConfirmationCode)
-> Lens
     ResendConfirmationCode
     ResendConfirmationCode
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResendConfirmationCode' {Maybe (Sensitive Text)
secretHash :: Maybe (Sensitive Text)
$sel:secretHash:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (Sensitive Text)
secretHash} -> Maybe (Sensitive Text)
secretHash) (\s :: ResendConfirmationCode
s@ResendConfirmationCode' {} Maybe (Sensitive Text)
a -> ResendConfirmationCode
s {$sel:secretHash:ResendConfirmationCode' :: Maybe (Sensitive Text)
secretHash = Maybe (Sensitive Text)
a} :: ResendConfirmationCode) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ResendConfirmationCode -> f ResendConfirmationCode)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ResendConfirmationCode
-> f ResendConfirmationCode
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 client associated with the user pool.
resendConfirmationCode_clientId :: Lens.Lens' ResendConfirmationCode Prelude.Text
resendConfirmationCode_clientId :: (Text -> f Text)
-> ResendConfirmationCode -> f ResendConfirmationCode
resendConfirmationCode_clientId = (ResendConfirmationCode -> Sensitive Text)
-> (ResendConfirmationCode
    -> Sensitive Text -> ResendConfirmationCode)
-> Lens
     ResendConfirmationCode
     ResendConfirmationCode
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResendConfirmationCode' {Sensitive Text
clientId :: Sensitive Text
$sel:clientId:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
clientId} -> Sensitive Text
clientId) (\s :: ResendConfirmationCode
s@ResendConfirmationCode' {} Sensitive Text
a -> ResendConfirmationCode
s {$sel:clientId:ResendConfirmationCode' :: Sensitive Text
clientId = Sensitive Text
a} :: ResendConfirmationCode) ((Sensitive Text -> f (Sensitive Text))
 -> ResendConfirmationCode -> f ResendConfirmationCode)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ResendConfirmationCode
-> f ResendConfirmationCode
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 to whom you wish to resend a confirmation
-- code.
resendConfirmationCode_username :: Lens.Lens' ResendConfirmationCode Prelude.Text
resendConfirmationCode_username :: (Text -> f Text)
-> ResendConfirmationCode -> f ResendConfirmationCode
resendConfirmationCode_username = (ResendConfirmationCode -> Sensitive Text)
-> (ResendConfirmationCode
    -> Sensitive Text -> ResendConfirmationCode)
-> Lens
     ResendConfirmationCode
     ResendConfirmationCode
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResendConfirmationCode' {Sensitive Text
username :: Sensitive Text
$sel:username:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
username} -> Sensitive Text
username) (\s :: ResendConfirmationCode
s@ResendConfirmationCode' {} Sensitive Text
a -> ResendConfirmationCode
s {$sel:username:ResendConfirmationCode' :: Sensitive Text
username = Sensitive Text
a} :: ResendConfirmationCode) ((Sensitive Text -> f (Sensitive Text))
 -> ResendConfirmationCode -> f ResendConfirmationCode)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ResendConfirmationCode
-> f ResendConfirmationCode
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 ResendConfirmationCode where
  type
    AWSResponse ResendConfirmationCode =
      ResendConfirmationCodeResponse
  request :: ResendConfirmationCode -> Request ResendConfirmationCode
request = Service -> ResendConfirmationCode -> Request ResendConfirmationCode
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ResendConfirmationCode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ResendConfirmationCode)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ResendConfirmationCode))
-> Logger
-> Service
-> Proxy ResendConfirmationCode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ResendConfirmationCode)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe CodeDeliveryDetailsType
-> Int -> ResendConfirmationCodeResponse
ResendConfirmationCodeResponse'
            (Maybe CodeDeliveryDetailsType
 -> Int -> ResendConfirmationCodeResponse)
-> Either String (Maybe CodeDeliveryDetailsType)
-> Either String (Int -> ResendConfirmationCodeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CodeDeliveryDetailsType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CodeDeliveryDetails")
            Either String (Int -> ResendConfirmationCodeResponse)
-> Either String Int
-> Either String ResendConfirmationCodeResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ResendConfirmationCode

instance Prelude.NFData ResendConfirmationCode

instance Core.ToHeaders ResendConfirmationCode where
  toHeaders :: ResendConfirmationCode -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ResendConfirmationCode -> 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.ResendConfirmationCode" ::
                          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 ResendConfirmationCode where
  toJSON :: ResendConfirmationCode -> Value
toJSON ResendConfirmationCode' {Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Maybe AnalyticsMetadataType
Maybe UserContextDataType
Sensitive Text
username :: Sensitive Text
clientId :: Sensitive Text
secretHash :: Maybe (Sensitive Text)
userContextData :: Maybe UserContextDataType
analyticsMetadata :: Maybe AnalyticsMetadataType
clientMetadata :: Maybe (HashMap Text Text)
$sel:username:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:clientId:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:secretHash:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (Sensitive Text)
$sel:userContextData:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe UserContextDataType
$sel:analyticsMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe AnalyticsMetadataType
$sel:clientMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> 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)
          ]
      )

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

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

-- | The response from the server when the Amazon Cognito Your User Pools
-- service makes the request to resend a confirmation code.
--
-- /See:/ 'newResendConfirmationCodeResponse' smart constructor.
data ResendConfirmationCodeResponse = ResendConfirmationCodeResponse'
  { -- | The code delivery details returned by the server in response to the
    -- request to resend the confirmation code.
    ResendConfirmationCodeResponse -> Maybe CodeDeliveryDetailsType
codeDeliveryDetails :: Prelude.Maybe CodeDeliveryDetailsType,
    -- | The response's http status code.
    ResendConfirmationCodeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ResendConfirmationCodeResponse
-> ResendConfirmationCodeResponse -> Bool
(ResendConfirmationCodeResponse
 -> ResendConfirmationCodeResponse -> Bool)
-> (ResendConfirmationCodeResponse
    -> ResendConfirmationCodeResponse -> Bool)
-> Eq ResendConfirmationCodeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResendConfirmationCodeResponse
-> ResendConfirmationCodeResponse -> Bool
$c/= :: ResendConfirmationCodeResponse
-> ResendConfirmationCodeResponse -> Bool
== :: ResendConfirmationCodeResponse
-> ResendConfirmationCodeResponse -> Bool
$c== :: ResendConfirmationCodeResponse
-> ResendConfirmationCodeResponse -> Bool
Prelude.Eq, ReadPrec [ResendConfirmationCodeResponse]
ReadPrec ResendConfirmationCodeResponse
Int -> ReadS ResendConfirmationCodeResponse
ReadS [ResendConfirmationCodeResponse]
(Int -> ReadS ResendConfirmationCodeResponse)
-> ReadS [ResendConfirmationCodeResponse]
-> ReadPrec ResendConfirmationCodeResponse
-> ReadPrec [ResendConfirmationCodeResponse]
-> Read ResendConfirmationCodeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResendConfirmationCodeResponse]
$creadListPrec :: ReadPrec [ResendConfirmationCodeResponse]
readPrec :: ReadPrec ResendConfirmationCodeResponse
$creadPrec :: ReadPrec ResendConfirmationCodeResponse
readList :: ReadS [ResendConfirmationCodeResponse]
$creadList :: ReadS [ResendConfirmationCodeResponse]
readsPrec :: Int -> ReadS ResendConfirmationCodeResponse
$creadsPrec :: Int -> ReadS ResendConfirmationCodeResponse
Prelude.Read, Int -> ResendConfirmationCodeResponse -> ShowS
[ResendConfirmationCodeResponse] -> ShowS
ResendConfirmationCodeResponse -> String
(Int -> ResendConfirmationCodeResponse -> ShowS)
-> (ResendConfirmationCodeResponse -> String)
-> ([ResendConfirmationCodeResponse] -> ShowS)
-> Show ResendConfirmationCodeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResendConfirmationCodeResponse] -> ShowS
$cshowList :: [ResendConfirmationCodeResponse] -> ShowS
show :: ResendConfirmationCodeResponse -> String
$cshow :: ResendConfirmationCodeResponse -> String
showsPrec :: Int -> ResendConfirmationCodeResponse -> ShowS
$cshowsPrec :: Int -> ResendConfirmationCodeResponse -> ShowS
Prelude.Show, (forall x.
 ResendConfirmationCodeResponse
 -> Rep ResendConfirmationCodeResponse x)
-> (forall x.
    Rep ResendConfirmationCodeResponse x
    -> ResendConfirmationCodeResponse)
-> Generic ResendConfirmationCodeResponse
forall x.
Rep ResendConfirmationCodeResponse x
-> ResendConfirmationCodeResponse
forall x.
ResendConfirmationCodeResponse
-> Rep ResendConfirmationCodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResendConfirmationCodeResponse x
-> ResendConfirmationCodeResponse
$cfrom :: forall x.
ResendConfirmationCodeResponse
-> Rep ResendConfirmationCodeResponse x
Prelude.Generic)

-- |
-- Create a value of 'ResendConfirmationCodeResponse' 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:
--
-- 'codeDeliveryDetails', 'resendConfirmationCodeResponse_codeDeliveryDetails' - The code delivery details returned by the server in response to the
-- request to resend the confirmation code.
--
-- 'httpStatus', 'resendConfirmationCodeResponse_httpStatus' - The response's http status code.
newResendConfirmationCodeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ResendConfirmationCodeResponse
newResendConfirmationCodeResponse :: Int -> ResendConfirmationCodeResponse
newResendConfirmationCodeResponse Int
pHttpStatus_ =
  ResendConfirmationCodeResponse' :: Maybe CodeDeliveryDetailsType
-> Int -> ResendConfirmationCodeResponse
ResendConfirmationCodeResponse'
    { $sel:codeDeliveryDetails:ResendConfirmationCodeResponse' :: Maybe CodeDeliveryDetailsType
codeDeliveryDetails =
        Maybe CodeDeliveryDetailsType
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ResendConfirmationCodeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The code delivery details returned by the server in response to the
-- request to resend the confirmation code.
resendConfirmationCodeResponse_codeDeliveryDetails :: Lens.Lens' ResendConfirmationCodeResponse (Prelude.Maybe CodeDeliveryDetailsType)
resendConfirmationCodeResponse_codeDeliveryDetails :: (Maybe CodeDeliveryDetailsType
 -> f (Maybe CodeDeliveryDetailsType))
-> ResendConfirmationCodeResponse
-> f ResendConfirmationCodeResponse
resendConfirmationCodeResponse_codeDeliveryDetails = (ResendConfirmationCodeResponse -> Maybe CodeDeliveryDetailsType)
-> (ResendConfirmationCodeResponse
    -> Maybe CodeDeliveryDetailsType -> ResendConfirmationCodeResponse)
-> Lens
     ResendConfirmationCodeResponse
     ResendConfirmationCodeResponse
     (Maybe CodeDeliveryDetailsType)
     (Maybe CodeDeliveryDetailsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResendConfirmationCodeResponse' {Maybe CodeDeliveryDetailsType
codeDeliveryDetails :: Maybe CodeDeliveryDetailsType
$sel:codeDeliveryDetails:ResendConfirmationCodeResponse' :: ResendConfirmationCodeResponse -> Maybe CodeDeliveryDetailsType
codeDeliveryDetails} -> Maybe CodeDeliveryDetailsType
codeDeliveryDetails) (\s :: ResendConfirmationCodeResponse
s@ResendConfirmationCodeResponse' {} Maybe CodeDeliveryDetailsType
a -> ResendConfirmationCodeResponse
s {$sel:codeDeliveryDetails:ResendConfirmationCodeResponse' :: Maybe CodeDeliveryDetailsType
codeDeliveryDetails = Maybe CodeDeliveryDetailsType
a} :: ResendConfirmationCodeResponse)

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

instance
  Prelude.NFData
    ResendConfirmationCodeResponse