{-# 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.Chime.GetPhoneNumberSettings
-- 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 phone number settings for the administrator\'s AWS
-- account, such as the default outbound calling name.
module Amazonka.Chime.GetPhoneNumberSettings
  ( -- * Creating a Request
    GetPhoneNumberSettings (..),
    newGetPhoneNumberSettings,

    -- * Destructuring the Response
    GetPhoneNumberSettingsResponse (..),
    newGetPhoneNumberSettingsResponse,

    -- * Response Lenses
    getPhoneNumberSettingsResponse_callingNameUpdatedTimestamp,
    getPhoneNumberSettingsResponse_callingName,
    getPhoneNumberSettingsResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetPhoneNumberSettings where
  type
    AWSResponse GetPhoneNumberSettings =
      GetPhoneNumberSettingsResponse
  request :: GetPhoneNumberSettings -> Request GetPhoneNumberSettings
request = Service -> GetPhoneNumberSettings -> Request GetPhoneNumberSettings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetPhoneNumberSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetPhoneNumberSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetPhoneNumberSettings))
-> Logger
-> Service
-> Proxy GetPhoneNumberSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetPhoneNumberSettings)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe POSIX
-> Maybe (Sensitive Text) -> Int -> GetPhoneNumberSettingsResponse
GetPhoneNumberSettingsResponse'
            (Maybe POSIX
 -> Maybe (Sensitive Text) -> Int -> GetPhoneNumberSettingsResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe (Sensitive Text) -> Int -> GetPhoneNumberSettingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CallingNameUpdatedTimestamp")
            Either
  String
  (Maybe (Sensitive Text) -> Int -> GetPhoneNumberSettingsResponse)
-> Either String (Maybe (Sensitive Text))
-> Either String (Int -> GetPhoneNumberSettingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CallingName")
            Either String (Int -> GetPhoneNumberSettingsResponse)
-> Either String Int
-> Either String GetPhoneNumberSettingsResponse
forall (f :: * -> *) a b. Applicative f => 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 GetPhoneNumberSettings

instance Prelude.NFData GetPhoneNumberSettings

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

instance Core.ToPath GetPhoneNumberSettings where
  toPath :: GetPhoneNumberSettings -> ByteString
toPath = ByteString -> GetPhoneNumberSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/settings/phone-number"

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

-- | /See:/ 'newGetPhoneNumberSettingsResponse' smart constructor.
data GetPhoneNumberSettingsResponse = GetPhoneNumberSettingsResponse'
  { -- | The updated outbound calling name timestamp, in ISO 8601 format.
    GetPhoneNumberSettingsResponse -> Maybe POSIX
callingNameUpdatedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The default outbound calling name for the account.
    GetPhoneNumberSettingsResponse -> Maybe (Sensitive Text)
callingName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The response's http status code.
    GetPhoneNumberSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetPhoneNumberSettingsResponse
-> GetPhoneNumberSettingsResponse -> Bool
(GetPhoneNumberSettingsResponse
 -> GetPhoneNumberSettingsResponse -> Bool)
-> (GetPhoneNumberSettingsResponse
    -> GetPhoneNumberSettingsResponse -> Bool)
-> Eq GetPhoneNumberSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPhoneNumberSettingsResponse
-> GetPhoneNumberSettingsResponse -> Bool
$c/= :: GetPhoneNumberSettingsResponse
-> GetPhoneNumberSettingsResponse -> Bool
== :: GetPhoneNumberSettingsResponse
-> GetPhoneNumberSettingsResponse -> Bool
$c== :: GetPhoneNumberSettingsResponse
-> GetPhoneNumberSettingsResponse -> Bool
Prelude.Eq, Int -> GetPhoneNumberSettingsResponse -> ShowS
[GetPhoneNumberSettingsResponse] -> ShowS
GetPhoneNumberSettingsResponse -> String
(Int -> GetPhoneNumberSettingsResponse -> ShowS)
-> (GetPhoneNumberSettingsResponse -> String)
-> ([GetPhoneNumberSettingsResponse] -> ShowS)
-> Show GetPhoneNumberSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPhoneNumberSettingsResponse] -> ShowS
$cshowList :: [GetPhoneNumberSettingsResponse] -> ShowS
show :: GetPhoneNumberSettingsResponse -> String
$cshow :: GetPhoneNumberSettingsResponse -> String
showsPrec :: Int -> GetPhoneNumberSettingsResponse -> ShowS
$cshowsPrec :: Int -> GetPhoneNumberSettingsResponse -> ShowS
Prelude.Show, (forall x.
 GetPhoneNumberSettingsResponse
 -> Rep GetPhoneNumberSettingsResponse x)
-> (forall x.
    Rep GetPhoneNumberSettingsResponse x
    -> GetPhoneNumberSettingsResponse)
-> Generic GetPhoneNumberSettingsResponse
forall x.
Rep GetPhoneNumberSettingsResponse x
-> GetPhoneNumberSettingsResponse
forall x.
GetPhoneNumberSettingsResponse
-> Rep GetPhoneNumberSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPhoneNumberSettingsResponse x
-> GetPhoneNumberSettingsResponse
$cfrom :: forall x.
GetPhoneNumberSettingsResponse
-> Rep GetPhoneNumberSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetPhoneNumberSettingsResponse' 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:
--
-- 'callingNameUpdatedTimestamp', 'getPhoneNumberSettingsResponse_callingNameUpdatedTimestamp' - The updated outbound calling name timestamp, in ISO 8601 format.
--
-- 'callingName', 'getPhoneNumberSettingsResponse_callingName' - The default outbound calling name for the account.
--
-- 'httpStatus', 'getPhoneNumberSettingsResponse_httpStatus' - The response's http status code.
newGetPhoneNumberSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetPhoneNumberSettingsResponse
newGetPhoneNumberSettingsResponse :: Int -> GetPhoneNumberSettingsResponse
newGetPhoneNumberSettingsResponse Int
pHttpStatus_ =
  GetPhoneNumberSettingsResponse' :: Maybe POSIX
-> Maybe (Sensitive Text) -> Int -> GetPhoneNumberSettingsResponse
GetPhoneNumberSettingsResponse'
    { $sel:callingNameUpdatedTimestamp:GetPhoneNumberSettingsResponse' :: Maybe POSIX
callingNameUpdatedTimestamp =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:callingName:GetPhoneNumberSettingsResponse' :: Maybe (Sensitive Text)
callingName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetPhoneNumberSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The updated outbound calling name timestamp, in ISO 8601 format.
getPhoneNumberSettingsResponse_callingNameUpdatedTimestamp :: Lens.Lens' GetPhoneNumberSettingsResponse (Prelude.Maybe Prelude.UTCTime)
getPhoneNumberSettingsResponse_callingNameUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetPhoneNumberSettingsResponse
-> f GetPhoneNumberSettingsResponse
getPhoneNumberSettingsResponse_callingNameUpdatedTimestamp = (GetPhoneNumberSettingsResponse -> Maybe POSIX)
-> (GetPhoneNumberSettingsResponse
    -> Maybe POSIX -> GetPhoneNumberSettingsResponse)
-> Lens
     GetPhoneNumberSettingsResponse
     GetPhoneNumberSettingsResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPhoneNumberSettingsResponse' {Maybe POSIX
callingNameUpdatedTimestamp :: Maybe POSIX
$sel:callingNameUpdatedTimestamp:GetPhoneNumberSettingsResponse' :: GetPhoneNumberSettingsResponse -> Maybe POSIX
callingNameUpdatedTimestamp} -> Maybe POSIX
callingNameUpdatedTimestamp) (\s :: GetPhoneNumberSettingsResponse
s@GetPhoneNumberSettingsResponse' {} Maybe POSIX
a -> GetPhoneNumberSettingsResponse
s {$sel:callingNameUpdatedTimestamp:GetPhoneNumberSettingsResponse' :: Maybe POSIX
callingNameUpdatedTimestamp = Maybe POSIX
a} :: GetPhoneNumberSettingsResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetPhoneNumberSettingsResponse
 -> f GetPhoneNumberSettingsResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetPhoneNumberSettingsResponse
-> f GetPhoneNumberSettingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The default outbound calling name for the account.
getPhoneNumberSettingsResponse_callingName :: Lens.Lens' GetPhoneNumberSettingsResponse (Prelude.Maybe Prelude.Text)
getPhoneNumberSettingsResponse_callingName :: (Maybe Text -> f (Maybe Text))
-> GetPhoneNumberSettingsResponse
-> f GetPhoneNumberSettingsResponse
getPhoneNumberSettingsResponse_callingName = (GetPhoneNumberSettingsResponse -> Maybe (Sensitive Text))
-> (GetPhoneNumberSettingsResponse
    -> Maybe (Sensitive Text) -> GetPhoneNumberSettingsResponse)
-> Lens
     GetPhoneNumberSettingsResponse
     GetPhoneNumberSettingsResponse
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPhoneNumberSettingsResponse' {Maybe (Sensitive Text)
callingName :: Maybe (Sensitive Text)
$sel:callingName:GetPhoneNumberSettingsResponse' :: GetPhoneNumberSettingsResponse -> Maybe (Sensitive Text)
callingName} -> Maybe (Sensitive Text)
callingName) (\s :: GetPhoneNumberSettingsResponse
s@GetPhoneNumberSettingsResponse' {} Maybe (Sensitive Text)
a -> GetPhoneNumberSettingsResponse
s {$sel:callingName:GetPhoneNumberSettingsResponse' :: Maybe (Sensitive Text)
callingName = Maybe (Sensitive Text)
a} :: GetPhoneNumberSettingsResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> GetPhoneNumberSettingsResponse
 -> f GetPhoneNumberSettingsResponse)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> GetPhoneNumberSettingsResponse
-> f GetPhoneNumberSettingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

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

instance
  Prelude.NFData
    GetPhoneNumberSettingsResponse