{-# 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-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)
--
-- Adds a destination phone number to an 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 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.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.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:/ '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
(CreateSMSSandboxPhoneNumber
 -> CreateSMSSandboxPhoneNumber -> Bool)
-> (CreateSMSSandboxPhoneNumber
    -> CreateSMSSandboxPhoneNumber -> Bool)
-> Eq CreateSMSSandboxPhoneNumber
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]
(Int -> ReadS CreateSMSSandboxPhoneNumber)
-> ReadS [CreateSMSSandboxPhoneNumber]
-> ReadPrec CreateSMSSandboxPhoneNumber
-> ReadPrec [CreateSMSSandboxPhoneNumber]
-> Read 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
(Int -> CreateSMSSandboxPhoneNumber -> ShowS)
-> (CreateSMSSandboxPhoneNumber -> String)
-> ([CreateSMSSandboxPhoneNumber] -> ShowS)
-> Show CreateSMSSandboxPhoneNumber
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.
 CreateSMSSandboxPhoneNumber -> Rep CreateSMSSandboxPhoneNumber x)
-> (forall x.
    Rep CreateSMSSandboxPhoneNumber x -> CreateSMSSandboxPhoneNumber)
-> Generic CreateSMSSandboxPhoneNumber
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' :: Maybe LanguageCodeString -> Text -> CreateSMSSandboxPhoneNumber
CreateSMSSandboxPhoneNumber'
    { $sel:languageCode:CreateSMSSandboxPhoneNumber' :: Maybe LanguageCodeString
languageCode =
        Maybe LanguageCodeString
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 :: (Maybe LanguageCodeString -> f (Maybe LanguageCodeString))
-> CreateSMSSandboxPhoneNumber -> f CreateSMSSandboxPhoneNumber
createSMSSandboxPhoneNumber_languageCode = (CreateSMSSandboxPhoneNumber -> Maybe LanguageCodeString)
-> (CreateSMSSandboxPhoneNumber
    -> Maybe LanguageCodeString -> CreateSMSSandboxPhoneNumber)
-> Lens
     CreateSMSSandboxPhoneNumber
     CreateSMSSandboxPhoneNumber
     (Maybe LanguageCodeString)
     (Maybe LanguageCodeString)
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 :: (Text -> f Text)
-> CreateSMSSandboxPhoneNumber -> f CreateSMSSandboxPhoneNumber
createSMSSandboxPhoneNumber_phoneNumber = (CreateSMSSandboxPhoneNumber -> Text)
-> (CreateSMSSandboxPhoneNumber
    -> Text -> CreateSMSSandboxPhoneNumber)
-> Lens
     CreateSMSSandboxPhoneNumber CreateSMSSandboxPhoneNumber Text Text
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 :: CreateSMSSandboxPhoneNumber -> Request CreateSMSSandboxPhoneNumber
request = Service
-> CreateSMSSandboxPhoneNumber
-> Request CreateSMSSandboxPhoneNumber
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateSMSSandboxPhoneNumber
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateSMSSandboxPhoneNumber)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateSMSSandboxPhoneNumber))
-> Logger
-> Service
-> Proxy CreateSMSSandboxPhoneNumber
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateSMSSandboxPhoneNumber)))
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
"CreateSMSSandboxPhoneNumberResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> CreateSMSSandboxPhoneNumberResponse
CreateSMSSandboxPhoneNumberResponse'
            (Int -> CreateSMSSandboxPhoneNumberResponse)
-> Either String Int
-> Either String CreateSMSSandboxPhoneNumberResponse
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 CreateSMSSandboxPhoneNumber

instance Prelude.NFData CreateSMSSandboxPhoneNumber

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

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

instance Core.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
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"CreateSMSSandboxPhoneNumber" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString),
        ByteString
"LanguageCode" ByteString -> Maybe LanguageCodeString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LanguageCodeString
languageCode,
        ByteString
"PhoneNumber" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
phoneNumber
      ]

-- | /See:/ 'newCreateSMSSandboxPhoneNumberResponse' smart constructor.
data CreateSMSSandboxPhoneNumberResponse = CreateSMSSandboxPhoneNumberResponse'
  { -- | The response's http status code.
    CreateSMSSandboxPhoneNumberResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSMSSandboxPhoneNumberResponse
-> CreateSMSSandboxPhoneNumberResponse -> Bool
(CreateSMSSandboxPhoneNumberResponse
 -> CreateSMSSandboxPhoneNumberResponse -> Bool)
-> (CreateSMSSandboxPhoneNumberResponse
    -> CreateSMSSandboxPhoneNumberResponse -> Bool)
-> Eq CreateSMSSandboxPhoneNumberResponse
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]
(Int -> ReadS CreateSMSSandboxPhoneNumberResponse)
-> ReadS [CreateSMSSandboxPhoneNumberResponse]
-> ReadPrec CreateSMSSandboxPhoneNumberResponse
-> ReadPrec [CreateSMSSandboxPhoneNumberResponse]
-> Read 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
(Int -> CreateSMSSandboxPhoneNumberResponse -> ShowS)
-> (CreateSMSSandboxPhoneNumberResponse -> String)
-> ([CreateSMSSandboxPhoneNumberResponse] -> ShowS)
-> Show CreateSMSSandboxPhoneNumberResponse
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.
 CreateSMSSandboxPhoneNumberResponse
 -> Rep CreateSMSSandboxPhoneNumberResponse x)
-> (forall x.
    Rep CreateSMSSandboxPhoneNumberResponse x
    -> CreateSMSSandboxPhoneNumberResponse)
-> Generic CreateSMSSandboxPhoneNumberResponse
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' :: Int -> CreateSMSSandboxPhoneNumberResponse
CreateSMSSandboxPhoneNumberResponse'
    { $sel:httpStatus:CreateSMSSandboxPhoneNumberResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
createSMSSandboxPhoneNumberResponse_httpStatus :: Lens.Lens' CreateSMSSandboxPhoneNumberResponse Prelude.Int
createSMSSandboxPhoneNumberResponse_httpStatus :: (Int -> f Int)
-> CreateSMSSandboxPhoneNumberResponse
-> f CreateSMSSandboxPhoneNumberResponse
createSMSSandboxPhoneNumberResponse_httpStatus = (CreateSMSSandboxPhoneNumberResponse -> Int)
-> (CreateSMSSandboxPhoneNumberResponse
    -> Int -> CreateSMSSandboxPhoneNumberResponse)
-> Lens
     CreateSMSSandboxPhoneNumberResponse
     CreateSMSSandboxPhoneNumberResponse
     Int
     Int
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