{-# 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.UpdatePhoneNumberSettings
-- 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)
--
-- Updates the phone number settings for the administrator\'s AWS account,
-- such as the default outbound calling name. You can update the default
-- outbound calling name once every seven days. Outbound calling names can
-- take up to 72 hours to update.
module Amazonka.Chime.UpdatePhoneNumberSettings
  ( -- * Creating a Request
    UpdatePhoneNumberSettings (..),
    newUpdatePhoneNumberSettings,

    -- * Request Lenses
    updatePhoneNumberSettings_callingName,

    -- * Destructuring the Response
    UpdatePhoneNumberSettingsResponse (..),
    newUpdatePhoneNumberSettingsResponse,
  )
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:/ 'newUpdatePhoneNumberSettings' smart constructor.
data UpdatePhoneNumberSettings = UpdatePhoneNumberSettings'
  { -- | The default outbound calling name for the account.
    UpdatePhoneNumberSettings -> Sensitive Text
callingName :: Core.Sensitive Prelude.Text
  }
  deriving (UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool
(UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool)
-> (UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool)
-> Eq UpdatePhoneNumberSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool
$c/= :: UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool
== :: UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool
$c== :: UpdatePhoneNumberSettings -> UpdatePhoneNumberSettings -> Bool
Prelude.Eq, Int -> UpdatePhoneNumberSettings -> ShowS
[UpdatePhoneNumberSettings] -> ShowS
UpdatePhoneNumberSettings -> String
(Int -> UpdatePhoneNumberSettings -> ShowS)
-> (UpdatePhoneNumberSettings -> String)
-> ([UpdatePhoneNumberSettings] -> ShowS)
-> Show UpdatePhoneNumberSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePhoneNumberSettings] -> ShowS
$cshowList :: [UpdatePhoneNumberSettings] -> ShowS
show :: UpdatePhoneNumberSettings -> String
$cshow :: UpdatePhoneNumberSettings -> String
showsPrec :: Int -> UpdatePhoneNumberSettings -> ShowS
$cshowsPrec :: Int -> UpdatePhoneNumberSettings -> ShowS
Prelude.Show, (forall x.
 UpdatePhoneNumberSettings -> Rep UpdatePhoneNumberSettings x)
-> (forall x.
    Rep UpdatePhoneNumberSettings x -> UpdatePhoneNumberSettings)
-> Generic UpdatePhoneNumberSettings
forall x.
Rep UpdatePhoneNumberSettings x -> UpdatePhoneNumberSettings
forall x.
UpdatePhoneNumberSettings -> Rep UpdatePhoneNumberSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdatePhoneNumberSettings x -> UpdatePhoneNumberSettings
$cfrom :: forall x.
UpdatePhoneNumberSettings -> Rep UpdatePhoneNumberSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdatePhoneNumberSettings' 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:
--
-- 'callingName', 'updatePhoneNumberSettings_callingName' - The default outbound calling name for the account.
newUpdatePhoneNumberSettings ::
  -- | 'callingName'
  Prelude.Text ->
  UpdatePhoneNumberSettings
newUpdatePhoneNumberSettings :: Text -> UpdatePhoneNumberSettings
newUpdatePhoneNumberSettings Text
pCallingName_ =
  UpdatePhoneNumberSettings' :: Sensitive Text -> UpdatePhoneNumberSettings
UpdatePhoneNumberSettings'
    { $sel:callingName:UpdatePhoneNumberSettings' :: Sensitive Text
callingName =
        Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pCallingName_
    }

-- | The default outbound calling name for the account.
updatePhoneNumberSettings_callingName :: Lens.Lens' UpdatePhoneNumberSettings Prelude.Text
updatePhoneNumberSettings_callingName :: (Text -> f Text)
-> UpdatePhoneNumberSettings -> f UpdatePhoneNumberSettings
updatePhoneNumberSettings_callingName = (UpdatePhoneNumberSettings -> Sensitive Text)
-> (UpdatePhoneNumberSettings
    -> Sensitive Text -> UpdatePhoneNumberSettings)
-> Lens
     UpdatePhoneNumberSettings
     UpdatePhoneNumberSettings
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePhoneNumberSettings' {Sensitive Text
callingName :: Sensitive Text
$sel:callingName:UpdatePhoneNumberSettings' :: UpdatePhoneNumberSettings -> Sensitive Text
callingName} -> Sensitive Text
callingName) (\s :: UpdatePhoneNumberSettings
s@UpdatePhoneNumberSettings' {} Sensitive Text
a -> UpdatePhoneNumberSettings
s {$sel:callingName:UpdatePhoneNumberSettings' :: Sensitive Text
callingName = Sensitive Text
a} :: UpdatePhoneNumberSettings) ((Sensitive Text -> f (Sensitive Text))
 -> UpdatePhoneNumberSettings -> f UpdatePhoneNumberSettings)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> UpdatePhoneNumberSettings
-> f UpdatePhoneNumberSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSRequest UpdatePhoneNumberSettings where
  type
    AWSResponse UpdatePhoneNumberSettings =
      UpdatePhoneNumberSettingsResponse
  request :: UpdatePhoneNumberSettings -> Request UpdatePhoneNumberSettings
request = Service
-> UpdatePhoneNumberSettings -> Request UpdatePhoneNumberSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdatePhoneNumberSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdatePhoneNumberSettings)))
response =
    AWSResponse UpdatePhoneNumberSettings
-> Logger
-> Service
-> Proxy UpdatePhoneNumberSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdatePhoneNumberSettings)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse UpdatePhoneNumberSettings
UpdatePhoneNumberSettingsResponse
UpdatePhoneNumberSettingsResponse'

instance Prelude.Hashable UpdatePhoneNumberSettings

instance Prelude.NFData UpdatePhoneNumberSettings

instance Core.ToHeaders UpdatePhoneNumberSettings where
  toHeaders :: UpdatePhoneNumberSettings -> [Header]
toHeaders = [Header] -> UpdatePhoneNumberSettings -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON UpdatePhoneNumberSettings where
  toJSON :: UpdatePhoneNumberSettings -> Value
toJSON UpdatePhoneNumberSettings' {Sensitive Text
callingName :: Sensitive Text
$sel:callingName:UpdatePhoneNumberSettings' :: UpdatePhoneNumberSettings -> Sensitive Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"CallingName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
callingName)]
      )

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

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

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

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

instance
  Prelude.NFData
    UpdatePhoneNumberSettingsResponse