{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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,
-- US telecom carriers require you to register an origination phone number
-- before you can send SMS messages to US 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>. Amazon
-- Cognito uses the registered number automatically. Otherwise, Amazon
-- Cognito users who must receive SMS messages might not be able 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 Simple Notification Service might place
-- your account in the SMS sandbox. In
-- /<https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html sandbox mode>/
-- , you can send messages only to verified phone numbers. After you test
-- your app while in the sandbox environment, you can move out of the
-- 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 Amazon Cognito user pools>
-- in the /Amazon Cognito Developer Guide/.
module Amazonka.CognitoIdentityProvider.ResendConfirmationCode
  ( -- * Creating a Request
    ResendConfirmationCode (..),
    newResendConfirmationCode,

    -- * Request Lenses
    resendConfirmationCode_analyticsMetadata,
    resendConfirmationCode_clientMetadata,
    resendConfirmationCode_secretHash,
    resendConfirmationCode_userContextData,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | The Amazon Pinpoint analytics metadata that contributes to your metrics
    -- for @ResendConfirmationCode@ calls.
    ResendConfirmationCode -> Maybe AnalyticsMetadataType
analyticsMetadata :: Prelude.Maybe AnalyticsMetadataType,
    -- | 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/.
    --
    -- When you use the ClientMetadata parameter, remember that Amazon Cognito
    -- won\'t do the following:
    --
    -- -   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 doesn\'t include
    --     triggers, the ClientMetadata parameter serves no purpose.
    --
    -- -   Validate the ClientMetadata value.
    --
    -- -   Encrypt the ClientMetadata value. Don\'t use Amazon Cognito to
    --     provide sensitive information.
    ResendConfirmationCode -> Maybe (HashMap Text Text)
clientMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | 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 (Data.Sensitive Prelude.Text),
    -- | Contextual data about your user session, such as the device fingerprint,
    -- IP address, or location. Amazon Cognito advanced security evaluates the
    -- risk of an authentication event based on the context that your app
    -- generates and passes to Amazon Cognito when it makes API requests.
    ResendConfirmationCode -> Maybe UserContextDataType
userContextData :: Prelude.Maybe UserContextDataType,
    -- | The ID of the client associated with the user pool.
    ResendConfirmationCode -> Sensitive Text
clientId :: Data.Sensitive Prelude.Text,
    -- | The @username@ attribute of the user to whom you want to resend a
    -- confirmation code.
    ResendConfirmationCode -> Sensitive Text
username :: Data.Sensitive Prelude.Text
  }
  deriving (ResendConfirmationCode -> ResendConfirmationCode -> Bool
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
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. 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:
--
-- 'analyticsMetadata', 'resendConfirmationCode_analyticsMetadata' - The Amazon Pinpoint analytics metadata that contributes to your metrics
-- for @ResendConfirmationCode@ calls.
--
-- '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/.
--
-- When you use the ClientMetadata parameter, remember that Amazon Cognito
-- won\'t do the following:
--
-- -   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 doesn\'t include
--     triggers, the ClientMetadata parameter serves no purpose.
--
-- -   Validate the ClientMetadata value.
--
-- -   Encrypt the ClientMetadata value. Don\'t use Amazon Cognito to
--     provide sensitive information.
--
-- '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.
--
-- 'userContextData', 'resendConfirmationCode_userContextData' - Contextual data about your user session, such as the device fingerprint,
-- IP address, or location. Amazon Cognito advanced security evaluates the
-- risk of an authentication event based on the context that your app
-- generates and passes to Amazon Cognito when it makes API requests.
--
-- 'clientId', 'resendConfirmationCode_clientId' - The ID of the client associated with the user pool.
--
-- 'username', 'resendConfirmationCode_username' - The @username@ attribute of the user to whom you want to resend a
-- confirmation code.
newResendConfirmationCode ::
  -- | 'clientId'
  Prelude.Text ->
  -- | 'username'
  Prelude.Text ->
  ResendConfirmationCode
newResendConfirmationCode :: Text -> Text -> ResendConfirmationCode
newResendConfirmationCode Text
pClientId_ Text
pUsername_ =
  ResendConfirmationCode'
    { $sel:analyticsMetadata:ResendConfirmationCode' :: Maybe AnalyticsMetadataType
analyticsMetadata =
        forall a. Maybe a
Prelude.Nothing,
      $sel:clientMetadata:ResendConfirmationCode' :: Maybe (HashMap Text Text)
clientMetadata = forall a. Maybe a
Prelude.Nothing,
      $sel:secretHash:ResendConfirmationCode' :: Maybe (Sensitive Text)
secretHash = forall a. Maybe a
Prelude.Nothing,
      $sel:userContextData:ResendConfirmationCode' :: Maybe UserContextDataType
userContextData = forall a. Maybe a
Prelude.Nothing,
      $sel:clientId:ResendConfirmationCode' :: Sensitive Text
clientId = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pClientId_,
      $sel:username:ResendConfirmationCode' :: Sensitive Text
username = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pUsername_
    }

-- | The Amazon Pinpoint analytics metadata that contributes to your metrics
-- for @ResendConfirmationCode@ calls.
resendConfirmationCode_analyticsMetadata :: Lens.Lens' ResendConfirmationCode (Prelude.Maybe AnalyticsMetadataType)
resendConfirmationCode_analyticsMetadata :: Lens' ResendConfirmationCode (Maybe AnalyticsMetadataType)
resendConfirmationCode_analyticsMetadata = 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)

-- | 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/.
--
-- When you use the ClientMetadata parameter, remember that Amazon Cognito
-- won\'t do the following:
--
-- -   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 doesn\'t include
--     triggers, the ClientMetadata parameter serves no purpose.
--
-- -   Validate the ClientMetadata value.
--
-- -   Encrypt the ClientMetadata value. Don\'t use Amazon Cognito to
--     provide sensitive information.
resendConfirmationCode_clientMetadata :: Lens.Lens' ResendConfirmationCode (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
resendConfirmationCode_clientMetadata :: Lens' ResendConfirmationCode (Maybe (HashMap Text Text))
resendConfirmationCode_clientMetadata = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' ResendConfirmationCode (Maybe Text)
resendConfirmationCode_secretHash = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | Contextual data about your user session, such as the device fingerprint,
-- IP address, or location. Amazon Cognito advanced security evaluates the
-- risk of an authentication event based on the context that your app
-- generates and passes to Amazon Cognito when it makes API requests.
resendConfirmationCode_userContextData :: Lens.Lens' ResendConfirmationCode (Prelude.Maybe UserContextDataType)
resendConfirmationCode_userContextData :: Lens' ResendConfirmationCode (Maybe UserContextDataType)
resendConfirmationCode_userContextData = 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)

-- | The ID of the client associated with the user pool.
resendConfirmationCode_clientId :: Lens.Lens' ResendConfirmationCode Prelude.Text
resendConfirmationCode_clientId :: Lens' ResendConfirmationCode Text
resendConfirmationCode_clientId = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The @username@ attribute of the user to whom you want to resend a
-- confirmation code.
resendConfirmationCode_username :: Lens.Lens' ResendConfirmationCode Prelude.Text
resendConfirmationCode_username :: Lens' ResendConfirmationCode Text
resendConfirmationCode_username = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Core.AWSRequest ResendConfirmationCode where
  type
    AWSResponse ResendConfirmationCode =
      ResendConfirmationCodeResponse
  request :: (Service -> Service)
-> ResendConfirmationCode -> Request ResendConfirmationCode
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ResendConfirmationCode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ResendConfirmationCode)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe CodeDeliveryDetailsType
-> Int -> ResendConfirmationCodeResponse
ResendConfirmationCodeResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CodeDeliveryDetails")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ResendConfirmationCode where
  hashWithSalt :: Int -> ResendConfirmationCode -> Int
hashWithSalt Int
_salt ResendConfirmationCode' {Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Maybe AnalyticsMetadataType
Maybe UserContextDataType
Sensitive Text
username :: Sensitive Text
clientId :: Sensitive Text
userContextData :: Maybe UserContextDataType
secretHash :: Maybe (Sensitive Text)
clientMetadata :: Maybe (HashMap Text Text)
analyticsMetadata :: Maybe AnalyticsMetadataType
$sel:username:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:clientId:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:userContextData:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe UserContextDataType
$sel:secretHash:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (Sensitive Text)
$sel:clientMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (HashMap Text Text)
$sel:analyticsMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe AnalyticsMetadataType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnalyticsMetadataType
analyticsMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
clientMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
secretHash
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UserContextDataType
userContextData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
clientId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
username

instance Prelude.NFData ResendConfirmationCode where
  rnf :: ResendConfirmationCode -> ()
rnf ResendConfirmationCode' {Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Maybe AnalyticsMetadataType
Maybe UserContextDataType
Sensitive Text
username :: Sensitive Text
clientId :: Sensitive Text
userContextData :: Maybe UserContextDataType
secretHash :: Maybe (Sensitive Text)
clientMetadata :: Maybe (HashMap Text Text)
analyticsMetadata :: Maybe AnalyticsMetadataType
$sel:username:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:clientId:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:userContextData:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe UserContextDataType
$sel:secretHash:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (Sensitive Text)
$sel:clientMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (HashMap Text Text)
$sel:analyticsMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe AnalyticsMetadataType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AnalyticsMetadataType
analyticsMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
clientMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
secretHash
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UserContextDataType
userContextData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
clientId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
username

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

instance Data.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
userContextData :: Maybe UserContextDataType
secretHash :: Maybe (Sensitive Text)
clientMetadata :: Maybe (HashMap Text Text)
analyticsMetadata :: Maybe AnalyticsMetadataType
$sel:username:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:clientId:ResendConfirmationCode' :: ResendConfirmationCode -> Sensitive Text
$sel:userContextData:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe UserContextDataType
$sel:secretHash:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (Sensitive Text)
$sel:clientMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe (HashMap Text Text)
$sel:analyticsMetadata:ResendConfirmationCode' :: ResendConfirmationCode -> Maybe AnalyticsMetadataType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AnalyticsMetadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AnalyticsMetadataType
analyticsMetadata,
            (Key
"ClientMetadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
clientMetadata,
            (Key
"SecretHash" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
secretHash,
            (Key
"UserContextData" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserContextDataType
userContextData,
            forall a. a -> Maybe a
Prelude.Just (Key
"ClientId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
clientId),
            forall a. a -> Maybe a
Prelude.Just (Key
"Username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
username)
          ]
      )

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

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

-- | The response from the server when Amazon Cognito 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
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]
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
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.
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'
    { $sel:codeDeliveryDetails:ResendConfirmationCodeResponse' :: Maybe CodeDeliveryDetailsType
codeDeliveryDetails =
        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 :: Lens'
  ResendConfirmationCodeResponse (Maybe CodeDeliveryDetailsType)
resendConfirmationCodeResponse_codeDeliveryDetails = 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 :: Lens' ResendConfirmationCodeResponse Int
resendConfirmationCodeResponse_httpStatus = 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
  where
  rnf :: ResendConfirmationCodeResponse -> ()
rnf ResendConfirmationCodeResponse' {Int
Maybe CodeDeliveryDetailsType
httpStatus :: Int
codeDeliveryDetails :: Maybe CodeDeliveryDetailsType
$sel:httpStatus:ResendConfirmationCodeResponse' :: ResendConfirmationCodeResponse -> Int
$sel:codeDeliveryDetails:ResendConfirmationCodeResponse' :: ResendConfirmationCodeResponse -> Maybe CodeDeliveryDetailsType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CodeDeliveryDetailsType
codeDeliveryDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus