{-# 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.UpdateGlobalSettings
-- 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 global settings for the administrator\'s AWS account, such as
-- Amazon Chime Business Calling and Amazon Chime Voice Connector settings.
module Amazonka.Chime.UpdateGlobalSettings
  ( -- * Creating a Request
    UpdateGlobalSettings (..),
    newUpdateGlobalSettings,

    -- * Request Lenses
    updateGlobalSettings_businessCalling,
    updateGlobalSettings_voiceConnector,

    -- * Destructuring the Response
    UpdateGlobalSettingsResponse (..),
    newUpdateGlobalSettingsResponse,
  )
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:/ 'newUpdateGlobalSettings' smart constructor.
data UpdateGlobalSettings = UpdateGlobalSettings'
  { -- | The Amazon Chime Business Calling settings.
    UpdateGlobalSettings -> Maybe BusinessCallingSettings
businessCalling :: Prelude.Maybe BusinessCallingSettings,
    -- | The Amazon Chime Voice Connector settings.
    UpdateGlobalSettings -> Maybe VoiceConnectorSettings
voiceConnector :: Prelude.Maybe VoiceConnectorSettings
  }
  deriving (UpdateGlobalSettings -> UpdateGlobalSettings -> Bool
(UpdateGlobalSettings -> UpdateGlobalSettings -> Bool)
-> (UpdateGlobalSettings -> UpdateGlobalSettings -> Bool)
-> Eq UpdateGlobalSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGlobalSettings -> UpdateGlobalSettings -> Bool
$c/= :: UpdateGlobalSettings -> UpdateGlobalSettings -> Bool
== :: UpdateGlobalSettings -> UpdateGlobalSettings -> Bool
$c== :: UpdateGlobalSettings -> UpdateGlobalSettings -> Bool
Prelude.Eq, ReadPrec [UpdateGlobalSettings]
ReadPrec UpdateGlobalSettings
Int -> ReadS UpdateGlobalSettings
ReadS [UpdateGlobalSettings]
(Int -> ReadS UpdateGlobalSettings)
-> ReadS [UpdateGlobalSettings]
-> ReadPrec UpdateGlobalSettings
-> ReadPrec [UpdateGlobalSettings]
-> Read UpdateGlobalSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGlobalSettings]
$creadListPrec :: ReadPrec [UpdateGlobalSettings]
readPrec :: ReadPrec UpdateGlobalSettings
$creadPrec :: ReadPrec UpdateGlobalSettings
readList :: ReadS [UpdateGlobalSettings]
$creadList :: ReadS [UpdateGlobalSettings]
readsPrec :: Int -> ReadS UpdateGlobalSettings
$creadsPrec :: Int -> ReadS UpdateGlobalSettings
Prelude.Read, Int -> UpdateGlobalSettings -> ShowS
[UpdateGlobalSettings] -> ShowS
UpdateGlobalSettings -> String
(Int -> UpdateGlobalSettings -> ShowS)
-> (UpdateGlobalSettings -> String)
-> ([UpdateGlobalSettings] -> ShowS)
-> Show UpdateGlobalSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGlobalSettings] -> ShowS
$cshowList :: [UpdateGlobalSettings] -> ShowS
show :: UpdateGlobalSettings -> String
$cshow :: UpdateGlobalSettings -> String
showsPrec :: Int -> UpdateGlobalSettings -> ShowS
$cshowsPrec :: Int -> UpdateGlobalSettings -> ShowS
Prelude.Show, (forall x. UpdateGlobalSettings -> Rep UpdateGlobalSettings x)
-> (forall x. Rep UpdateGlobalSettings x -> UpdateGlobalSettings)
-> Generic UpdateGlobalSettings
forall x. Rep UpdateGlobalSettings x -> UpdateGlobalSettings
forall x. UpdateGlobalSettings -> Rep UpdateGlobalSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGlobalSettings x -> UpdateGlobalSettings
$cfrom :: forall x. UpdateGlobalSettings -> Rep UpdateGlobalSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGlobalSettings' 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:
--
-- 'businessCalling', 'updateGlobalSettings_businessCalling' - The Amazon Chime Business Calling settings.
--
-- 'voiceConnector', 'updateGlobalSettings_voiceConnector' - The Amazon Chime Voice Connector settings.
newUpdateGlobalSettings ::
  UpdateGlobalSettings
newUpdateGlobalSettings :: UpdateGlobalSettings
newUpdateGlobalSettings =
  UpdateGlobalSettings' :: Maybe BusinessCallingSettings
-> Maybe VoiceConnectorSettings -> UpdateGlobalSettings
UpdateGlobalSettings'
    { $sel:businessCalling:UpdateGlobalSettings' :: Maybe BusinessCallingSettings
businessCalling =
        Maybe BusinessCallingSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:voiceConnector:UpdateGlobalSettings' :: Maybe VoiceConnectorSettings
voiceConnector = Maybe VoiceConnectorSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Chime Business Calling settings.
updateGlobalSettings_businessCalling :: Lens.Lens' UpdateGlobalSettings (Prelude.Maybe BusinessCallingSettings)
updateGlobalSettings_businessCalling :: (Maybe BusinessCallingSettings
 -> f (Maybe BusinessCallingSettings))
-> UpdateGlobalSettings -> f UpdateGlobalSettings
updateGlobalSettings_businessCalling = (UpdateGlobalSettings -> Maybe BusinessCallingSettings)
-> (UpdateGlobalSettings
    -> Maybe BusinessCallingSettings -> UpdateGlobalSettings)
-> Lens
     UpdateGlobalSettings
     UpdateGlobalSettings
     (Maybe BusinessCallingSettings)
     (Maybe BusinessCallingSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalSettings' {Maybe BusinessCallingSettings
businessCalling :: Maybe BusinessCallingSettings
$sel:businessCalling:UpdateGlobalSettings' :: UpdateGlobalSettings -> Maybe BusinessCallingSettings
businessCalling} -> Maybe BusinessCallingSettings
businessCalling) (\s :: UpdateGlobalSettings
s@UpdateGlobalSettings' {} Maybe BusinessCallingSettings
a -> UpdateGlobalSettings
s {$sel:businessCalling:UpdateGlobalSettings' :: Maybe BusinessCallingSettings
businessCalling = Maybe BusinessCallingSettings
a} :: UpdateGlobalSettings)

-- | The Amazon Chime Voice Connector settings.
updateGlobalSettings_voiceConnector :: Lens.Lens' UpdateGlobalSettings (Prelude.Maybe VoiceConnectorSettings)
updateGlobalSettings_voiceConnector :: (Maybe VoiceConnectorSettings -> f (Maybe VoiceConnectorSettings))
-> UpdateGlobalSettings -> f UpdateGlobalSettings
updateGlobalSettings_voiceConnector = (UpdateGlobalSettings -> Maybe VoiceConnectorSettings)
-> (UpdateGlobalSettings
    -> Maybe VoiceConnectorSettings -> UpdateGlobalSettings)
-> Lens
     UpdateGlobalSettings
     UpdateGlobalSettings
     (Maybe VoiceConnectorSettings)
     (Maybe VoiceConnectorSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGlobalSettings' {Maybe VoiceConnectorSettings
voiceConnector :: Maybe VoiceConnectorSettings
$sel:voiceConnector:UpdateGlobalSettings' :: UpdateGlobalSettings -> Maybe VoiceConnectorSettings
voiceConnector} -> Maybe VoiceConnectorSettings
voiceConnector) (\s :: UpdateGlobalSettings
s@UpdateGlobalSettings' {} Maybe VoiceConnectorSettings
a -> UpdateGlobalSettings
s {$sel:voiceConnector:UpdateGlobalSettings' :: Maybe VoiceConnectorSettings
voiceConnector = Maybe VoiceConnectorSettings
a} :: UpdateGlobalSettings)

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

instance Prelude.Hashable UpdateGlobalSettings

instance Prelude.NFData UpdateGlobalSettings

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

instance Core.ToJSON UpdateGlobalSettings where
  toJSON :: UpdateGlobalSettings -> Value
toJSON UpdateGlobalSettings' {Maybe BusinessCallingSettings
Maybe VoiceConnectorSettings
voiceConnector :: Maybe VoiceConnectorSettings
businessCalling :: Maybe BusinessCallingSettings
$sel:voiceConnector:UpdateGlobalSettings' :: UpdateGlobalSettings -> Maybe VoiceConnectorSettings
$sel:businessCalling:UpdateGlobalSettings' :: UpdateGlobalSettings -> Maybe BusinessCallingSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BusinessCalling" Text -> BusinessCallingSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (BusinessCallingSettings -> Pair)
-> Maybe BusinessCallingSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BusinessCallingSettings
businessCalling,
            (Text
"VoiceConnector" Text -> VoiceConnectorSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (VoiceConnectorSettings -> Pair)
-> Maybe VoiceConnectorSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VoiceConnectorSettings
voiceConnector
          ]
      )

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

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

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

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

instance Prelude.NFData UpdateGlobalSettingsResponse