{-# 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.GetAccountSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves account settings for the specified Amazon Chime account ID,
-- such as remote control and dialout settings. For more information about
-- these settings, see
-- <https://docs.aws.amazon.com/chime/latest/ag/policies.html Use the Policies Page>
-- in the /Amazon Chime Administration Guide/.
module Amazonka.Chime.GetAccountSettings
  ( -- * Creating a Request
    GetAccountSettings (..),
    newGetAccountSettings,

    -- * Request Lenses
    getAccountSettings_accountId,

    -- * Destructuring the Response
    GetAccountSettingsResponse (..),
    newGetAccountSettingsResponse,

    -- * Response Lenses
    getAccountSettingsResponse_accountSettings,
    getAccountSettingsResponse_httpStatus,
  )
where

import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'GetAccountSettings' 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:
--
-- 'accountId', 'getAccountSettings_accountId' - The Amazon Chime account ID.
newGetAccountSettings ::
  -- | 'accountId'
  Prelude.Text ->
  GetAccountSettings
newGetAccountSettings :: Text -> GetAccountSettings
newGetAccountSettings Text
pAccountId_ =
  GetAccountSettings' {$sel:accountId:GetAccountSettings' :: Text
accountId = Text
pAccountId_}

-- | The Amazon Chime account ID.
getAccountSettings_accountId :: Lens.Lens' GetAccountSettings Prelude.Text
getAccountSettings_accountId :: Lens' GetAccountSettings Text
getAccountSettings_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSettings' {Text
accountId :: Text
$sel:accountId:GetAccountSettings' :: GetAccountSettings -> Text
accountId} -> Text
accountId) (\s :: GetAccountSettings
s@GetAccountSettings' {} Text
a -> GetAccountSettings
s {$sel:accountId:GetAccountSettings' :: Text
accountId = Text
a} :: GetAccountSettings)

instance Core.AWSRequest GetAccountSettings where
  type
    AWSResponse GetAccountSettings =
      GetAccountSettingsResponse
  request :: (Service -> Service)
-> GetAccountSettings -> Request GetAccountSettings
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountSettings)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe AccountSettings -> Int -> GetAccountSettingsResponse
GetAccountSettingsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AccountSettings")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetAccountSettings where
  hashWithSalt :: Int -> GetAccountSettings -> Int
hashWithSalt Int
_salt GetAccountSettings' {Text
accountId :: Text
$sel:accountId:GetAccountSettings' :: GetAccountSettings -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId

instance Prelude.NFData GetAccountSettings where
  rnf :: GetAccountSettings -> ()
rnf GetAccountSettings' {Text
accountId :: Text
$sel:accountId:GetAccountSettings' :: GetAccountSettings -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
accountId

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

instance Data.ToPath GetAccountSettings where
  toPath :: GetAccountSettings -> ByteString
toPath GetAccountSettings' {Text
accountId :: Text
$sel:accountId:GetAccountSettings' :: GetAccountSettings -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/accounts/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
accountId, ByteString
"/settings"]

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

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

-- |
-- Create a value of 'GetAccountSettingsResponse' 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:
--
-- 'accountSettings', 'getAccountSettingsResponse_accountSettings' - The Amazon Chime account settings.
--
-- 'httpStatus', 'getAccountSettingsResponse_httpStatus' - The response's http status code.
newGetAccountSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAccountSettingsResponse
newGetAccountSettingsResponse :: Int -> GetAccountSettingsResponse
newGetAccountSettingsResponse Int
pHttpStatus_ =
  GetAccountSettingsResponse'
    { $sel:accountSettings:GetAccountSettingsResponse' :: Maybe AccountSettings
accountSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAccountSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Chime account settings.
getAccountSettingsResponse_accountSettings :: Lens.Lens' GetAccountSettingsResponse (Prelude.Maybe AccountSettings)
getAccountSettingsResponse_accountSettings :: Lens' GetAccountSettingsResponse (Maybe AccountSettings)
getAccountSettingsResponse_accountSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountSettingsResponse' {Maybe AccountSettings
accountSettings :: Maybe AccountSettings
$sel:accountSettings:GetAccountSettingsResponse' :: GetAccountSettingsResponse -> Maybe AccountSettings
accountSettings} -> Maybe AccountSettings
accountSettings) (\s :: GetAccountSettingsResponse
s@GetAccountSettingsResponse' {} Maybe AccountSettings
a -> GetAccountSettingsResponse
s {$sel:accountSettings:GetAccountSettingsResponse' :: Maybe AccountSettings
accountSettings = Maybe AccountSettings
a} :: GetAccountSettingsResponse)

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

instance Prelude.NFData GetAccountSettingsResponse where
  rnf :: GetAccountSettingsResponse -> ()
rnf GetAccountSettingsResponse' {Int
Maybe AccountSettings
httpStatus :: Int
accountSettings :: Maybe AccountSettings
$sel:httpStatus:GetAccountSettingsResponse' :: GetAccountSettingsResponse -> Int
$sel:accountSettings:GetAccountSettingsResponse' :: GetAccountSettingsResponse -> Maybe AccountSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AccountSettings
accountSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus