{-# 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.GetSMSSandboxAccountStatus
-- 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)
--
-- Retrieves the SMS sandbox status for the calling account in the target
-- Region.
--
-- 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.GetSMSSandboxAccountStatus
  ( -- * Creating a Request
    GetSMSSandboxAccountStatus (..),
    newGetSMSSandboxAccountStatus,

    -- * Destructuring the Response
    GetSMSSandboxAccountStatusResponse (..),
    newGetSMSSandboxAccountStatusResponse,

    -- * Response Lenses
    getSMSSandboxAccountStatusResponse_httpStatus,
    getSMSSandboxAccountStatusResponse_isInSandbox,
  )
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:/ 'newGetSMSSandboxAccountStatus' smart constructor.
data GetSMSSandboxAccountStatus = GetSMSSandboxAccountStatus'
  {
  }
  deriving (GetSMSSandboxAccountStatus -> GetSMSSandboxAccountStatus -> Bool
(GetSMSSandboxAccountStatus -> GetSMSSandboxAccountStatus -> Bool)
-> (GetSMSSandboxAccountStatus
    -> GetSMSSandboxAccountStatus -> Bool)
-> Eq GetSMSSandboxAccountStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSMSSandboxAccountStatus -> GetSMSSandboxAccountStatus -> Bool
$c/= :: GetSMSSandboxAccountStatus -> GetSMSSandboxAccountStatus -> Bool
== :: GetSMSSandboxAccountStatus -> GetSMSSandboxAccountStatus -> Bool
$c== :: GetSMSSandboxAccountStatus -> GetSMSSandboxAccountStatus -> Bool
Prelude.Eq, ReadPrec [GetSMSSandboxAccountStatus]
ReadPrec GetSMSSandboxAccountStatus
Int -> ReadS GetSMSSandboxAccountStatus
ReadS [GetSMSSandboxAccountStatus]
(Int -> ReadS GetSMSSandboxAccountStatus)
-> ReadS [GetSMSSandboxAccountStatus]
-> ReadPrec GetSMSSandboxAccountStatus
-> ReadPrec [GetSMSSandboxAccountStatus]
-> Read GetSMSSandboxAccountStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSMSSandboxAccountStatus]
$creadListPrec :: ReadPrec [GetSMSSandboxAccountStatus]
readPrec :: ReadPrec GetSMSSandboxAccountStatus
$creadPrec :: ReadPrec GetSMSSandboxAccountStatus
readList :: ReadS [GetSMSSandboxAccountStatus]
$creadList :: ReadS [GetSMSSandboxAccountStatus]
readsPrec :: Int -> ReadS GetSMSSandboxAccountStatus
$creadsPrec :: Int -> ReadS GetSMSSandboxAccountStatus
Prelude.Read, Int -> GetSMSSandboxAccountStatus -> ShowS
[GetSMSSandboxAccountStatus] -> ShowS
GetSMSSandboxAccountStatus -> String
(Int -> GetSMSSandboxAccountStatus -> ShowS)
-> (GetSMSSandboxAccountStatus -> String)
-> ([GetSMSSandboxAccountStatus] -> ShowS)
-> Show GetSMSSandboxAccountStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSMSSandboxAccountStatus] -> ShowS
$cshowList :: [GetSMSSandboxAccountStatus] -> ShowS
show :: GetSMSSandboxAccountStatus -> String
$cshow :: GetSMSSandboxAccountStatus -> String
showsPrec :: Int -> GetSMSSandboxAccountStatus -> ShowS
$cshowsPrec :: Int -> GetSMSSandboxAccountStatus -> ShowS
Prelude.Show, (forall x.
 GetSMSSandboxAccountStatus -> Rep GetSMSSandboxAccountStatus x)
-> (forall x.
    Rep GetSMSSandboxAccountStatus x -> GetSMSSandboxAccountStatus)
-> Generic GetSMSSandboxAccountStatus
forall x.
Rep GetSMSSandboxAccountStatus x -> GetSMSSandboxAccountStatus
forall x.
GetSMSSandboxAccountStatus -> Rep GetSMSSandboxAccountStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSMSSandboxAccountStatus x -> GetSMSSandboxAccountStatus
$cfrom :: forall x.
GetSMSSandboxAccountStatus -> Rep GetSMSSandboxAccountStatus x
Prelude.Generic)

-- |
-- Create a value of 'GetSMSSandboxAccountStatus' 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.
newGetSMSSandboxAccountStatus ::
  GetSMSSandboxAccountStatus
newGetSMSSandboxAccountStatus :: GetSMSSandboxAccountStatus
newGetSMSSandboxAccountStatus =
  GetSMSSandboxAccountStatus
GetSMSSandboxAccountStatus'

instance Core.AWSRequest GetSMSSandboxAccountStatus where
  type
    AWSResponse GetSMSSandboxAccountStatus =
      GetSMSSandboxAccountStatusResponse
  request :: GetSMSSandboxAccountStatus -> Request GetSMSSandboxAccountStatus
request = Service
-> GetSMSSandboxAccountStatus -> Request GetSMSSandboxAccountStatus
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSMSSandboxAccountStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSMSSandboxAccountStatus)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse GetSMSSandboxAccountStatus))
-> Logger
-> Service
-> Proxy GetSMSSandboxAccountStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSMSSandboxAccountStatus)))
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
"GetSMSSandboxAccountStatusResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> Bool -> GetSMSSandboxAccountStatusResponse
GetSMSSandboxAccountStatusResponse'
            (Int -> Bool -> GetSMSSandboxAccountStatusResponse)
-> Either String Int
-> Either String (Bool -> GetSMSSandboxAccountStatusResponse)
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))
            Either String (Bool -> GetSMSSandboxAccountStatusResponse)
-> Either String Bool
-> Either String GetSMSSandboxAccountStatusResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"IsInSandbox")
      )

instance Prelude.Hashable GetSMSSandboxAccountStatus

instance Prelude.NFData GetSMSSandboxAccountStatus

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

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

instance Core.ToQuery GetSMSSandboxAccountStatus where
  toQuery :: GetSMSSandboxAccountStatus -> QueryString
toQuery =
    QueryString -> GetSMSSandboxAccountStatus -> QueryString
forall a b. a -> b -> a
Prelude.const
      ( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetSMSSandboxAccountStatus" :: Prelude.ByteString),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-03-31" :: Prelude.ByteString)
          ]
      )

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

-- |
-- Create a value of 'GetSMSSandboxAccountStatusResponse' 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', 'getSMSSandboxAccountStatusResponse_httpStatus' - The response's http status code.
--
-- 'isInSandbox', 'getSMSSandboxAccountStatusResponse_isInSandbox' - Indicates whether the calling account is in the SMS sandbox.
newGetSMSSandboxAccountStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'isInSandbox'
  Prelude.Bool ->
  GetSMSSandboxAccountStatusResponse
newGetSMSSandboxAccountStatusResponse :: Int -> Bool -> GetSMSSandboxAccountStatusResponse
newGetSMSSandboxAccountStatusResponse
  Int
pHttpStatus_
  Bool
pIsInSandbox_ =
    GetSMSSandboxAccountStatusResponse' :: Int -> Bool -> GetSMSSandboxAccountStatusResponse
GetSMSSandboxAccountStatusResponse'
      { $sel:httpStatus:GetSMSSandboxAccountStatusResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:isInSandbox:GetSMSSandboxAccountStatusResponse' :: Bool
isInSandbox = Bool
pIsInSandbox_
      }

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

-- | Indicates whether the calling account is in the SMS sandbox.
getSMSSandboxAccountStatusResponse_isInSandbox :: Lens.Lens' GetSMSSandboxAccountStatusResponse Prelude.Bool
getSMSSandboxAccountStatusResponse_isInSandbox :: (Bool -> f Bool)
-> GetSMSSandboxAccountStatusResponse
-> f GetSMSSandboxAccountStatusResponse
getSMSSandboxAccountStatusResponse_isInSandbox = (GetSMSSandboxAccountStatusResponse -> Bool)
-> (GetSMSSandboxAccountStatusResponse
    -> Bool -> GetSMSSandboxAccountStatusResponse)
-> Lens
     GetSMSSandboxAccountStatusResponse
     GetSMSSandboxAccountStatusResponse
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSMSSandboxAccountStatusResponse' {Bool
isInSandbox :: Bool
$sel:isInSandbox:GetSMSSandboxAccountStatusResponse' :: GetSMSSandboxAccountStatusResponse -> Bool
isInSandbox} -> Bool
isInSandbox) (\s :: GetSMSSandboxAccountStatusResponse
s@GetSMSSandboxAccountStatusResponse' {} Bool
a -> GetSMSSandboxAccountStatusResponse
s {$sel:isInSandbox:GetSMSSandboxAccountStatusResponse' :: Bool
isInSandbox = Bool
a} :: GetSMSSandboxAccountStatusResponse)

instance
  Prelude.NFData
    GetSMSSandboxAccountStatusResponse