{-# 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.CreateSMSSandboxPhoneNumber
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Adds a destination phone number to an Amazon Web Services account in the
-- SMS sandbox and sends a one-time password (OTP) to that phone number.
--
-- When you start using Amazon SNS to send SMS messages, your Amazon Web
-- Services 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 Amazon Web Services 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.CreateSMSSandboxPhoneNumber
  ( -- * Creating a Request
    CreateSMSSandboxPhoneNumber (..),
    newCreateSMSSandboxPhoneNumber,

    -- * Request Lenses
    createSMSSandboxPhoneNumber_languageCode,
    createSMSSandboxPhoneNumber_phoneNumber,

    -- * Destructuring the Response
    CreateSMSSandboxPhoneNumberResponse (..),
    newCreateSMSSandboxPhoneNumberResponse,

    -- * Response Lenses
    createSMSSandboxPhoneNumberResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateSMSSandboxPhoneNumber' smart constructor.
data CreateSMSSandboxPhoneNumber = CreateSMSSandboxPhoneNumber'
  { -- | The language to use for sending the OTP. The default value is @en-US@.
    CreateSMSSandboxPhoneNumber -> Maybe LanguageCodeString
languageCode :: Prelude.Maybe LanguageCodeString,
    -- | The destination phone number to verify. On verification, Amazon SNS adds
    -- this phone number to the list of verified phone numbers that you can
    -- send SMS messages to.
    CreateSMSSandboxPhoneNumber -> Text
phoneNumber :: Prelude.Text
  }
  deriving (CreateSMSSandboxPhoneNumber -> CreateSMSSandboxPhoneNumber -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSMSSandboxPhoneNumber -> CreateSMSSandboxPhoneNumber -> Bool
$c/= :: CreateSMSSandboxPhoneNumber -> CreateSMSSandboxPhoneNumber -> Bool
== :: CreateSMSSandboxPhoneNumber -> CreateSMSSandboxPhoneNumber -> Bool
$c== :: CreateSMSSandboxPhoneNumber -> CreateSMSSandboxPhoneNumber -> Bool
Prelude.Eq, ReadPrec [CreateSMSSandboxPhoneNumber]
ReadPrec CreateSMSSandboxPhoneNumber
Int -> ReadS CreateSMSSandboxPhoneNumber
ReadS [CreateSMSSandboxPhoneNumber]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSMSSandboxPhoneNumber]
$creadListPrec :: ReadPrec [CreateSMSSandboxPhoneNumber]
readPrec :: ReadPrec CreateSMSSandboxPhoneNumber
$creadPrec :: ReadPrec CreateSMSSandboxPhoneNumber
readList :: ReadS [CreateSMSSandboxPhoneNumber]
$creadList :: ReadS [CreateSMSSandboxPhoneNumber]
readsPrec :: Int -> ReadS CreateSMSSandboxPhoneNumber
$creadsPrec :: Int -> ReadS CreateSMSSandboxPhoneNumber
Prelude.Read, Int -> CreateSMSSandboxPhoneNumber -> ShowS
[CreateSMSSandboxPhoneNumber] -> ShowS
CreateSMSSandboxPhoneNumber -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSMSSandboxPhoneNumber] -> ShowS
$cshowList :: [CreateSMSSandboxPhoneNumber] -> ShowS
show :: CreateSMSSandboxPhoneNumber -> String
$cshow :: CreateSMSSandboxPhoneNumber -> String
showsPrec :: Int -> CreateSMSSandboxPhoneNumber -> ShowS
$cshowsPrec :: Int -> CreateSMSSandboxPhoneNumber -> ShowS
Prelude.Show, forall x.
Rep CreateSMSSandboxPhoneNumber x -> CreateSMSSandboxPhoneNumber
forall x.
CreateSMSSandboxPhoneNumber -> Rep CreateSMSSandboxPhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSMSSandboxPhoneNumber x -> CreateSMSSandboxPhoneNumber
$cfrom :: forall x.
CreateSMSSandboxPhoneNumber -> Rep CreateSMSSandboxPhoneNumber x
Prelude.Generic)

-- |
-- Create a value of 'CreateSMSSandboxPhoneNumber' 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:
--
-- 'languageCode', 'createSMSSandboxPhoneNumber_languageCode' - The language to use for sending the OTP. The default value is @en-US@.
--
-- 'phoneNumber', 'createSMSSandboxPhoneNumber_phoneNumber' - The destination phone number to verify. On verification, Amazon SNS adds
-- this phone number to the list of verified phone numbers that you can
-- send SMS messages to.
newCreateSMSSandboxPhoneNumber ::
  -- | 'phoneNumber'
  Prelude.Text ->
  CreateSMSSandboxPhoneNumber
newCreateSMSSandboxPhoneNumber :: Text -> CreateSMSSandboxPhoneNumber
newCreateSMSSandboxPhoneNumber Text
pPhoneNumber_ =
  CreateSMSSandboxPhoneNumber'
    { $sel:languageCode:CreateSMSSandboxPhoneNumber' :: Maybe LanguageCodeString
languageCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:CreateSMSSandboxPhoneNumber' :: Text
phoneNumber = Text
pPhoneNumber_
    }

-- | The language to use for sending the OTP. The default value is @en-US@.
createSMSSandboxPhoneNumber_languageCode :: Lens.Lens' CreateSMSSandboxPhoneNumber (Prelude.Maybe LanguageCodeString)
createSMSSandboxPhoneNumber_languageCode :: Lens' CreateSMSSandboxPhoneNumber (Maybe LanguageCodeString)
createSMSSandboxPhoneNumber_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSMSSandboxPhoneNumber' {Maybe LanguageCodeString
languageCode :: Maybe LanguageCodeString
$sel:languageCode:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Maybe LanguageCodeString
languageCode} -> Maybe LanguageCodeString
languageCode) (\s :: CreateSMSSandboxPhoneNumber
s@CreateSMSSandboxPhoneNumber' {} Maybe LanguageCodeString
a -> CreateSMSSandboxPhoneNumber
s {$sel:languageCode:CreateSMSSandboxPhoneNumber' :: Maybe LanguageCodeString
languageCode = Maybe LanguageCodeString
a} :: CreateSMSSandboxPhoneNumber)

-- | The destination phone number to verify. On verification, Amazon SNS adds
-- this phone number to the list of verified phone numbers that you can
-- send SMS messages to.
createSMSSandboxPhoneNumber_phoneNumber :: Lens.Lens' CreateSMSSandboxPhoneNumber Prelude.Text
createSMSSandboxPhoneNumber_phoneNumber :: Lens' CreateSMSSandboxPhoneNumber Text
createSMSSandboxPhoneNumber_phoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSMSSandboxPhoneNumber' {Text
phoneNumber :: Text
$sel:phoneNumber:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Text
phoneNumber} -> Text
phoneNumber) (\s :: CreateSMSSandboxPhoneNumber
s@CreateSMSSandboxPhoneNumber' {} Text
a -> CreateSMSSandboxPhoneNumber
s {$sel:phoneNumber:CreateSMSSandboxPhoneNumber' :: Text
phoneNumber = Text
a} :: CreateSMSSandboxPhoneNumber)

instance Core.AWSRequest CreateSMSSandboxPhoneNumber where
  type
    AWSResponse CreateSMSSandboxPhoneNumber =
      CreateSMSSandboxPhoneNumberResponse
  request :: (Service -> Service)
-> CreateSMSSandboxPhoneNumber
-> Request CreateSMSSandboxPhoneNumber
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSMSSandboxPhoneNumber
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateSMSSandboxPhoneNumber)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateSMSSandboxPhoneNumberResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> CreateSMSSandboxPhoneNumberResponse
CreateSMSSandboxPhoneNumberResponse'
            forall (f :: * -> *) a b. Functor 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 CreateSMSSandboxPhoneNumber where
  hashWithSalt :: Int -> CreateSMSSandboxPhoneNumber -> Int
hashWithSalt Int
_salt CreateSMSSandboxPhoneNumber' {Maybe LanguageCodeString
Text
phoneNumber :: Text
languageCode :: Maybe LanguageCodeString
$sel:phoneNumber:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Text
$sel:languageCode:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Maybe LanguageCodeString
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LanguageCodeString
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
phoneNumber

instance Prelude.NFData CreateSMSSandboxPhoneNumber where
  rnf :: CreateSMSSandboxPhoneNumber -> ()
rnf CreateSMSSandboxPhoneNumber' {Maybe LanguageCodeString
Text
phoneNumber :: Text
languageCode :: Maybe LanguageCodeString
$sel:phoneNumber:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Text
$sel:languageCode:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Maybe LanguageCodeString
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LanguageCodeString
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
phoneNumber

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

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

instance Data.ToQuery CreateSMSSandboxPhoneNumber where
  toQuery :: CreateSMSSandboxPhoneNumber -> QueryString
toQuery CreateSMSSandboxPhoneNumber' {Maybe LanguageCodeString
Text
phoneNumber :: Text
languageCode :: Maybe LanguageCodeString
$sel:phoneNumber:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Text
$sel:languageCode:CreateSMSSandboxPhoneNumber' :: CreateSMSSandboxPhoneNumber -> Maybe LanguageCodeString
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"CreateSMSSandboxPhoneNumber" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
        ByteString
"LanguageCode" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe LanguageCodeString
languageCode,
        ByteString
"PhoneNumber" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
phoneNumber
      ]

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

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

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

instance
  Prelude.NFData
    CreateSMSSandboxPhoneNumberResponse
  where
  rnf :: CreateSMSSandboxPhoneNumberResponse -> ()
rnf CreateSMSSandboxPhoneNumberResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSMSSandboxPhoneNumberResponse' :: CreateSMSSandboxPhoneNumberResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus