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

    -- * Destructuring the Response
    GetGlobalSettingsResponse (..),
    newGetGlobalSettingsResponse,

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

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

instance Core.AWSRequest GetGlobalSettings where
  type
    AWSResponse GetGlobalSettings =
      GetGlobalSettingsResponse
  request :: GetGlobalSettings -> Request GetGlobalSettings
request = Service -> GetGlobalSettings -> Request GetGlobalSettings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetGlobalSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetGlobalSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetGlobalSettings))
-> Logger
-> Service
-> Proxy GetGlobalSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetGlobalSettings)))
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 BusinessCallingSettings
-> Maybe VoiceConnectorSettings -> Int -> GetGlobalSettingsResponse
GetGlobalSettingsResponse'
            (Maybe BusinessCallingSettings
 -> Maybe VoiceConnectorSettings
 -> Int
 -> GetGlobalSettingsResponse)
-> Either String (Maybe BusinessCallingSettings)
-> Either
     String
     (Maybe VoiceConnectorSettings -> Int -> GetGlobalSettingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe BusinessCallingSettings)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"BusinessCalling")
            Either
  String
  (Maybe VoiceConnectorSettings -> Int -> GetGlobalSettingsResponse)
-> Either String (Maybe VoiceConnectorSettings)
-> Either String (Int -> GetGlobalSettingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe VoiceConnectorSettings)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"VoiceConnector")
            Either String (Int -> GetGlobalSettingsResponse)
-> Either String Int -> Either String GetGlobalSettingsResponse
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 GetGlobalSettings

instance Prelude.NFData GetGlobalSettings

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

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

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

-- | /See:/ 'newGetGlobalSettingsResponse' smart constructor.
data GetGlobalSettingsResponse = GetGlobalSettingsResponse'
  { -- | The Amazon Chime Business Calling settings.
    GetGlobalSettingsResponse -> Maybe BusinessCallingSettings
businessCalling :: Prelude.Maybe BusinessCallingSettings,
    -- | The Amazon Chime Voice Connector settings.
    GetGlobalSettingsResponse -> Maybe VoiceConnectorSettings
voiceConnector :: Prelude.Maybe VoiceConnectorSettings,
    -- | The response's http status code.
    GetGlobalSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool
(GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool)
-> (GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool)
-> Eq GetGlobalSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool
$c/= :: GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool
== :: GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool
$c== :: GetGlobalSettingsResponse -> GetGlobalSettingsResponse -> Bool
Prelude.Eq, ReadPrec [GetGlobalSettingsResponse]
ReadPrec GetGlobalSettingsResponse
Int -> ReadS GetGlobalSettingsResponse
ReadS [GetGlobalSettingsResponse]
(Int -> ReadS GetGlobalSettingsResponse)
-> ReadS [GetGlobalSettingsResponse]
-> ReadPrec GetGlobalSettingsResponse
-> ReadPrec [GetGlobalSettingsResponse]
-> Read GetGlobalSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGlobalSettingsResponse]
$creadListPrec :: ReadPrec [GetGlobalSettingsResponse]
readPrec :: ReadPrec GetGlobalSettingsResponse
$creadPrec :: ReadPrec GetGlobalSettingsResponse
readList :: ReadS [GetGlobalSettingsResponse]
$creadList :: ReadS [GetGlobalSettingsResponse]
readsPrec :: Int -> ReadS GetGlobalSettingsResponse
$creadsPrec :: Int -> ReadS GetGlobalSettingsResponse
Prelude.Read, Int -> GetGlobalSettingsResponse -> ShowS
[GetGlobalSettingsResponse] -> ShowS
GetGlobalSettingsResponse -> String
(Int -> GetGlobalSettingsResponse -> ShowS)
-> (GetGlobalSettingsResponse -> String)
-> ([GetGlobalSettingsResponse] -> ShowS)
-> Show GetGlobalSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGlobalSettingsResponse] -> ShowS
$cshowList :: [GetGlobalSettingsResponse] -> ShowS
show :: GetGlobalSettingsResponse -> String
$cshow :: GetGlobalSettingsResponse -> String
showsPrec :: Int -> GetGlobalSettingsResponse -> ShowS
$cshowsPrec :: Int -> GetGlobalSettingsResponse -> ShowS
Prelude.Show, (forall x.
 GetGlobalSettingsResponse -> Rep GetGlobalSettingsResponse x)
-> (forall x.
    Rep GetGlobalSettingsResponse x -> GetGlobalSettingsResponse)
-> Generic GetGlobalSettingsResponse
forall x.
Rep GetGlobalSettingsResponse x -> GetGlobalSettingsResponse
forall x.
GetGlobalSettingsResponse -> Rep GetGlobalSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetGlobalSettingsResponse x -> GetGlobalSettingsResponse
$cfrom :: forall x.
GetGlobalSettingsResponse -> Rep GetGlobalSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetGlobalSettingsResponse' 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', 'getGlobalSettingsResponse_businessCalling' - The Amazon Chime Business Calling settings.
--
-- 'voiceConnector', 'getGlobalSettingsResponse_voiceConnector' - The Amazon Chime Voice Connector settings.
--
-- 'httpStatus', 'getGlobalSettingsResponse_httpStatus' - The response's http status code.
newGetGlobalSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetGlobalSettingsResponse
newGetGlobalSettingsResponse :: Int -> GetGlobalSettingsResponse
newGetGlobalSettingsResponse Int
pHttpStatus_ =
  GetGlobalSettingsResponse' :: Maybe BusinessCallingSettings
-> Maybe VoiceConnectorSettings -> Int -> GetGlobalSettingsResponse
GetGlobalSettingsResponse'
    { $sel:businessCalling:GetGlobalSettingsResponse' :: Maybe BusinessCallingSettings
businessCalling =
        Maybe BusinessCallingSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:voiceConnector:GetGlobalSettingsResponse' :: Maybe VoiceConnectorSettings
voiceConnector = Maybe VoiceConnectorSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetGlobalSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

instance Prelude.NFData GetGlobalSettingsResponse