{-# 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.SNS.VerifySMSSandboxPhoneNumber
-- 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)
--
-- Verifies a destination phone number with a one-time password (OTP) for
-- the calling account.
--
-- When you start using Amazon SNS to send SMS messages, your account is in
-- the /SMS sandbox/. The SMS sandbox provides a safe environment for you
-- to try Amazon SNS features without risking your reputation as an SMS
-- sender. While your account is in the SMS sandbox, you can use all of the
-- features of Amazon SNS. However, you can send SMS messages only to
-- verified destination phone numbers. For more information, including how
-- to move out of the sandbox to send messages without restrictions, see
-- <https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html SMS sandbox>
-- in the /Amazon SNS Developer Guide/.
module Amazonka.SNS.VerifySMSSandboxPhoneNumber
  ( -- * Creating a Request
    VerifySMSSandboxPhoneNumber (..),
    newVerifySMSSandboxPhoneNumber,

    -- * Request Lenses
    verifySMSSandboxPhoneNumber_phoneNumber,
    verifySMSSandboxPhoneNumber_oneTimePassword,

    -- * Destructuring the Response
    VerifySMSSandboxPhoneNumberResponse (..),
    newVerifySMSSandboxPhoneNumberResponse,

    -- * Response Lenses
    verifySMSSandboxPhoneNumberResponse_httpStatus,
  )
where

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
import Amazonka.SNS.Types

-- | /See:/ 'newVerifySMSSandboxPhoneNumber' smart constructor.
data VerifySMSSandboxPhoneNumber = VerifySMSSandboxPhoneNumber'
  { -- | The destination phone number to verify.
    VerifySMSSandboxPhoneNumber -> Text
phoneNumber :: Prelude.Text,
    -- | The OTP sent to the destination number from the
    -- @CreateSMSSandBoxPhoneNumber@ call.
    VerifySMSSandboxPhoneNumber -> Text
oneTimePassword :: Prelude.Text
  }
  deriving (VerifySMSSandboxPhoneNumber -> VerifySMSSandboxPhoneNumber -> Bool
(VerifySMSSandboxPhoneNumber
 -> VerifySMSSandboxPhoneNumber -> Bool)
-> (VerifySMSSandboxPhoneNumber
    -> VerifySMSSandboxPhoneNumber -> Bool)
-> Eq VerifySMSSandboxPhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VerifySMSSandboxPhoneNumber -> VerifySMSSandboxPhoneNumber -> Bool
$c/= :: VerifySMSSandboxPhoneNumber -> VerifySMSSandboxPhoneNumber -> Bool
== :: VerifySMSSandboxPhoneNumber -> VerifySMSSandboxPhoneNumber -> Bool
$c== :: VerifySMSSandboxPhoneNumber -> VerifySMSSandboxPhoneNumber -> Bool
Prelude.Eq, ReadPrec [VerifySMSSandboxPhoneNumber]
ReadPrec VerifySMSSandboxPhoneNumber
Int -> ReadS VerifySMSSandboxPhoneNumber
ReadS [VerifySMSSandboxPhoneNumber]
(Int -> ReadS VerifySMSSandboxPhoneNumber)
-> ReadS [VerifySMSSandboxPhoneNumber]
-> ReadPrec VerifySMSSandboxPhoneNumber
-> ReadPrec [VerifySMSSandboxPhoneNumber]
-> Read VerifySMSSandboxPhoneNumber
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VerifySMSSandboxPhoneNumber]
$creadListPrec :: ReadPrec [VerifySMSSandboxPhoneNumber]
readPrec :: ReadPrec VerifySMSSandboxPhoneNumber
$creadPrec :: ReadPrec VerifySMSSandboxPhoneNumber
readList :: ReadS [VerifySMSSandboxPhoneNumber]
$creadList :: ReadS [VerifySMSSandboxPhoneNumber]
readsPrec :: Int -> ReadS VerifySMSSandboxPhoneNumber
$creadsPrec :: Int -> ReadS VerifySMSSandboxPhoneNumber
Prelude.Read, Int -> VerifySMSSandboxPhoneNumber -> ShowS
[VerifySMSSandboxPhoneNumber] -> ShowS
VerifySMSSandboxPhoneNumber -> String
(Int -> VerifySMSSandboxPhoneNumber -> ShowS)
-> (VerifySMSSandboxPhoneNumber -> String)
-> ([VerifySMSSandboxPhoneNumber] -> ShowS)
-> Show VerifySMSSandboxPhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VerifySMSSandboxPhoneNumber] -> ShowS
$cshowList :: [VerifySMSSandboxPhoneNumber] -> ShowS
show :: VerifySMSSandboxPhoneNumber -> String
$cshow :: VerifySMSSandboxPhoneNumber -> String
showsPrec :: Int -> VerifySMSSandboxPhoneNumber -> ShowS
$cshowsPrec :: Int -> VerifySMSSandboxPhoneNumber -> ShowS
Prelude.Show, (forall x.
 VerifySMSSandboxPhoneNumber -> Rep VerifySMSSandboxPhoneNumber x)
-> (forall x.
    Rep VerifySMSSandboxPhoneNumber x -> VerifySMSSandboxPhoneNumber)
-> Generic VerifySMSSandboxPhoneNumber
forall x.
Rep VerifySMSSandboxPhoneNumber x -> VerifySMSSandboxPhoneNumber
forall x.
VerifySMSSandboxPhoneNumber -> Rep VerifySMSSandboxPhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VerifySMSSandboxPhoneNumber x -> VerifySMSSandboxPhoneNumber
$cfrom :: forall x.
VerifySMSSandboxPhoneNumber -> Rep VerifySMSSandboxPhoneNumber x
Prelude.Generic)

-- |
-- Create a value of 'VerifySMSSandboxPhoneNumber' 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:
--
-- 'phoneNumber', 'verifySMSSandboxPhoneNumber_phoneNumber' - The destination phone number to verify.
--
-- 'oneTimePassword', 'verifySMSSandboxPhoneNumber_oneTimePassword' - The OTP sent to the destination number from the
-- @CreateSMSSandBoxPhoneNumber@ call.
newVerifySMSSandboxPhoneNumber ::
  -- | 'phoneNumber'
  Prelude.Text ->
  -- | 'oneTimePassword'
  Prelude.Text ->
  VerifySMSSandboxPhoneNumber
newVerifySMSSandboxPhoneNumber :: Text -> Text -> VerifySMSSandboxPhoneNumber
newVerifySMSSandboxPhoneNumber
  Text
pPhoneNumber_
  Text
pOneTimePassword_ =
    VerifySMSSandboxPhoneNumber' :: Text -> Text -> VerifySMSSandboxPhoneNumber
VerifySMSSandboxPhoneNumber'
      { $sel:phoneNumber:VerifySMSSandboxPhoneNumber' :: Text
phoneNumber =
          Text
pPhoneNumber_,
        $sel:oneTimePassword:VerifySMSSandboxPhoneNumber' :: Text
oneTimePassword = Text
pOneTimePassword_
      }

-- | The destination phone number to verify.
verifySMSSandboxPhoneNumber_phoneNumber :: Lens.Lens' VerifySMSSandboxPhoneNumber Prelude.Text
verifySMSSandboxPhoneNumber_phoneNumber :: (Text -> f Text)
-> VerifySMSSandboxPhoneNumber -> f VerifySMSSandboxPhoneNumber
verifySMSSandboxPhoneNumber_phoneNumber = (VerifySMSSandboxPhoneNumber -> Text)
-> (VerifySMSSandboxPhoneNumber
    -> Text -> VerifySMSSandboxPhoneNumber)
-> Lens
     VerifySMSSandboxPhoneNumber VerifySMSSandboxPhoneNumber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifySMSSandboxPhoneNumber' {Text
phoneNumber :: Text
$sel:phoneNumber:VerifySMSSandboxPhoneNumber' :: VerifySMSSandboxPhoneNumber -> Text
phoneNumber} -> Text
phoneNumber) (\s :: VerifySMSSandboxPhoneNumber
s@VerifySMSSandboxPhoneNumber' {} Text
a -> VerifySMSSandboxPhoneNumber
s {$sel:phoneNumber:VerifySMSSandboxPhoneNumber' :: Text
phoneNumber = Text
a} :: VerifySMSSandboxPhoneNumber)

-- | The OTP sent to the destination number from the
-- @CreateSMSSandBoxPhoneNumber@ call.
verifySMSSandboxPhoneNumber_oneTimePassword :: Lens.Lens' VerifySMSSandboxPhoneNumber Prelude.Text
verifySMSSandboxPhoneNumber_oneTimePassword :: (Text -> f Text)
-> VerifySMSSandboxPhoneNumber -> f VerifySMSSandboxPhoneNumber
verifySMSSandboxPhoneNumber_oneTimePassword = (VerifySMSSandboxPhoneNumber -> Text)
-> (VerifySMSSandboxPhoneNumber
    -> Text -> VerifySMSSandboxPhoneNumber)
-> Lens
     VerifySMSSandboxPhoneNumber VerifySMSSandboxPhoneNumber Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VerifySMSSandboxPhoneNumber' {Text
oneTimePassword :: Text
$sel:oneTimePassword:VerifySMSSandboxPhoneNumber' :: VerifySMSSandboxPhoneNumber -> Text
oneTimePassword} -> Text
oneTimePassword) (\s :: VerifySMSSandboxPhoneNumber
s@VerifySMSSandboxPhoneNumber' {} Text
a -> VerifySMSSandboxPhoneNumber
s {$sel:oneTimePassword:VerifySMSSandboxPhoneNumber' :: Text
oneTimePassword = Text
a} :: VerifySMSSandboxPhoneNumber)

instance Core.AWSRequest VerifySMSSandboxPhoneNumber where
  type
    AWSResponse VerifySMSSandboxPhoneNumber =
      VerifySMSSandboxPhoneNumberResponse
  request :: VerifySMSSandboxPhoneNumber -> Request VerifySMSSandboxPhoneNumber
request = Service
-> VerifySMSSandboxPhoneNumber
-> Request VerifySMSSandboxPhoneNumber
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy VerifySMSSandboxPhoneNumber
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse VerifySMSSandboxPhoneNumber)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse VerifySMSSandboxPhoneNumber))
-> Logger
-> Service
-> Proxy VerifySMSSandboxPhoneNumber
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse VerifySMSSandboxPhoneNumber)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"VerifySMSSandboxPhoneNumberResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> VerifySMSSandboxPhoneNumberResponse
VerifySMSSandboxPhoneNumberResponse'
            (Int -> VerifySMSSandboxPhoneNumberResponse)
-> Either String Int
-> Either String VerifySMSSandboxPhoneNumberResponse
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 VerifySMSSandboxPhoneNumber

instance Prelude.NFData VerifySMSSandboxPhoneNumber

instance Core.ToHeaders VerifySMSSandboxPhoneNumber where
  toHeaders :: VerifySMSSandboxPhoneNumber -> ResponseHeaders
toHeaders = ResponseHeaders -> VerifySMSSandboxPhoneNumber -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery VerifySMSSandboxPhoneNumber where
  toQuery :: VerifySMSSandboxPhoneNumber -> QueryString
toQuery VerifySMSSandboxPhoneNumber' {Text
oneTimePassword :: Text
phoneNumber :: Text
$sel:oneTimePassword:VerifySMSSandboxPhoneNumber' :: VerifySMSSandboxPhoneNumber -> Text
$sel:phoneNumber:VerifySMSSandboxPhoneNumber' :: VerifySMSSandboxPhoneNumber -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"VerifySMSSandboxPhoneNumber" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
        ByteString
"PhoneNumber" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
phoneNumber,
        ByteString
"OneTimePassword" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
oneTimePassword
      ]

-- | The destination phone number\'s verification status.
--
-- /See:/ 'newVerifySMSSandboxPhoneNumberResponse' smart constructor.
data VerifySMSSandboxPhoneNumberResponse = VerifySMSSandboxPhoneNumberResponse'
  { -- | The response's http status code.
    VerifySMSSandboxPhoneNumberResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (VerifySMSSandboxPhoneNumberResponse
-> VerifySMSSandboxPhoneNumberResponse -> Bool
(VerifySMSSandboxPhoneNumberResponse
 -> VerifySMSSandboxPhoneNumberResponse -> Bool)
-> (VerifySMSSandboxPhoneNumberResponse
    -> VerifySMSSandboxPhoneNumberResponse -> Bool)
-> Eq VerifySMSSandboxPhoneNumberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VerifySMSSandboxPhoneNumberResponse
-> VerifySMSSandboxPhoneNumberResponse -> Bool
$c/= :: VerifySMSSandboxPhoneNumberResponse
-> VerifySMSSandboxPhoneNumberResponse -> Bool
== :: VerifySMSSandboxPhoneNumberResponse
-> VerifySMSSandboxPhoneNumberResponse -> Bool
$c== :: VerifySMSSandboxPhoneNumberResponse
-> VerifySMSSandboxPhoneNumberResponse -> Bool
Prelude.Eq, ReadPrec [VerifySMSSandboxPhoneNumberResponse]
ReadPrec VerifySMSSandboxPhoneNumberResponse
Int -> ReadS VerifySMSSandboxPhoneNumberResponse
ReadS [VerifySMSSandboxPhoneNumberResponse]
(Int -> ReadS VerifySMSSandboxPhoneNumberResponse)
-> ReadS [VerifySMSSandboxPhoneNumberResponse]
-> ReadPrec VerifySMSSandboxPhoneNumberResponse
-> ReadPrec [VerifySMSSandboxPhoneNumberResponse]
-> Read VerifySMSSandboxPhoneNumberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VerifySMSSandboxPhoneNumberResponse]
$creadListPrec :: ReadPrec [VerifySMSSandboxPhoneNumberResponse]
readPrec :: ReadPrec VerifySMSSandboxPhoneNumberResponse
$creadPrec :: ReadPrec VerifySMSSandboxPhoneNumberResponse
readList :: ReadS [VerifySMSSandboxPhoneNumberResponse]
$creadList :: ReadS [VerifySMSSandboxPhoneNumberResponse]
readsPrec :: Int -> ReadS VerifySMSSandboxPhoneNumberResponse
$creadsPrec :: Int -> ReadS VerifySMSSandboxPhoneNumberResponse
Prelude.Read, Int -> VerifySMSSandboxPhoneNumberResponse -> ShowS
[VerifySMSSandboxPhoneNumberResponse] -> ShowS
VerifySMSSandboxPhoneNumberResponse -> String
(Int -> VerifySMSSandboxPhoneNumberResponse -> ShowS)
-> (VerifySMSSandboxPhoneNumberResponse -> String)
-> ([VerifySMSSandboxPhoneNumberResponse] -> ShowS)
-> Show VerifySMSSandboxPhoneNumberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VerifySMSSandboxPhoneNumberResponse] -> ShowS
$cshowList :: [VerifySMSSandboxPhoneNumberResponse] -> ShowS
show :: VerifySMSSandboxPhoneNumberResponse -> String
$cshow :: VerifySMSSandboxPhoneNumberResponse -> String
showsPrec :: Int -> VerifySMSSandboxPhoneNumberResponse -> ShowS
$cshowsPrec :: Int -> VerifySMSSandboxPhoneNumberResponse -> ShowS
Prelude.Show, (forall x.
 VerifySMSSandboxPhoneNumberResponse
 -> Rep VerifySMSSandboxPhoneNumberResponse x)
-> (forall x.
    Rep VerifySMSSandboxPhoneNumberResponse x
    -> VerifySMSSandboxPhoneNumberResponse)
-> Generic VerifySMSSandboxPhoneNumberResponse
forall x.
Rep VerifySMSSandboxPhoneNumberResponse x
-> VerifySMSSandboxPhoneNumberResponse
forall x.
VerifySMSSandboxPhoneNumberResponse
-> Rep VerifySMSSandboxPhoneNumberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VerifySMSSandboxPhoneNumberResponse x
-> VerifySMSSandboxPhoneNumberResponse
$cfrom :: forall x.
VerifySMSSandboxPhoneNumberResponse
-> Rep VerifySMSSandboxPhoneNumberResponse x
Prelude.Generic)

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

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

instance
  Prelude.NFData
    VerifySMSSandboxPhoneNumberResponse