{-# 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.UpdateAccountSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the settings for the specified Amazon Chime account. You can
-- update settings for remote control of shared screens, or for the
-- dial-out option. 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.UpdateAccountSettings
  ( -- * Creating a Request
    UpdateAccountSettings (..),
    newUpdateAccountSettings,

    -- * Request Lenses
    updateAccountSettings_accountId,
    updateAccountSettings_accountSettings,

    -- * Destructuring the Response
    UpdateAccountSettingsResponse (..),
    newUpdateAccountSettingsResponse,

    -- * Response Lenses
    updateAccountSettingsResponse_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:/ 'newUpdateAccountSettings' smart constructor.
data UpdateAccountSettings = UpdateAccountSettings'
  { -- | The Amazon Chime account ID.
    UpdateAccountSettings -> Text
accountId :: Prelude.Text,
    -- | The Amazon Chime account settings to update.
    UpdateAccountSettings -> AccountSettings
accountSettings :: AccountSettings
  }
  deriving (UpdateAccountSettings -> UpdateAccountSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
$c/= :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
== :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
$c== :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
Prelude.Eq, ReadPrec [UpdateAccountSettings]
ReadPrec UpdateAccountSettings
Int -> ReadS UpdateAccountSettings
ReadS [UpdateAccountSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAccountSettings]
$creadListPrec :: ReadPrec [UpdateAccountSettings]
readPrec :: ReadPrec UpdateAccountSettings
$creadPrec :: ReadPrec UpdateAccountSettings
readList :: ReadS [UpdateAccountSettings]
$creadList :: ReadS [UpdateAccountSettings]
readsPrec :: Int -> ReadS UpdateAccountSettings
$creadsPrec :: Int -> ReadS UpdateAccountSettings
Prelude.Read, Int -> UpdateAccountSettings -> ShowS
[UpdateAccountSettings] -> ShowS
UpdateAccountSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAccountSettings] -> ShowS
$cshowList :: [UpdateAccountSettings] -> ShowS
show :: UpdateAccountSettings -> String
$cshow :: UpdateAccountSettings -> String
showsPrec :: Int -> UpdateAccountSettings -> ShowS
$cshowsPrec :: Int -> UpdateAccountSettings -> ShowS
Prelude.Show, forall x. Rep UpdateAccountSettings x -> UpdateAccountSettings
forall x. UpdateAccountSettings -> Rep UpdateAccountSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAccountSettings x -> UpdateAccountSettings
$cfrom :: forall x. UpdateAccountSettings -> Rep UpdateAccountSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAccountSettings' 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', 'updateAccountSettings_accountId' - The Amazon Chime account ID.
--
-- 'accountSettings', 'updateAccountSettings_accountSettings' - The Amazon Chime account settings to update.
newUpdateAccountSettings ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'accountSettings'
  AccountSettings ->
  UpdateAccountSettings
newUpdateAccountSettings :: Text -> AccountSettings -> UpdateAccountSettings
newUpdateAccountSettings
  Text
pAccountId_
  AccountSettings
pAccountSettings_ =
    UpdateAccountSettings'
      { $sel:accountId:UpdateAccountSettings' :: Text
accountId = Text
pAccountId_,
        $sel:accountSettings:UpdateAccountSettings' :: AccountSettings
accountSettings = AccountSettings
pAccountSettings_
      }

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

-- | The Amazon Chime account settings to update.
updateAccountSettings_accountSettings :: Lens.Lens' UpdateAccountSettings AccountSettings
updateAccountSettings_accountSettings :: Lens' UpdateAccountSettings AccountSettings
updateAccountSettings_accountSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccountSettings' {AccountSettings
accountSettings :: AccountSettings
$sel:accountSettings:UpdateAccountSettings' :: UpdateAccountSettings -> AccountSettings
accountSettings} -> AccountSettings
accountSettings) (\s :: UpdateAccountSettings
s@UpdateAccountSettings' {} AccountSettings
a -> UpdateAccountSettings
s {$sel:accountSettings:UpdateAccountSettings' :: AccountSettings
accountSettings = AccountSettings
a} :: UpdateAccountSettings)

instance Core.AWSRequest UpdateAccountSettings where
  type
    AWSResponse UpdateAccountSettings =
      UpdateAccountSettingsResponse
  request :: (Service -> Service)
-> UpdateAccountSettings -> Request UpdateAccountSettings
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAccountSettings)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateAccountSettingsResponse
UpdateAccountSettingsResponse'
            forall (f :: * -> *) a b. Functor 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 UpdateAccountSettings where
  hashWithSalt :: Int -> UpdateAccountSettings -> Int
hashWithSalt Int
_salt UpdateAccountSettings' {Text
AccountSettings
accountSettings :: AccountSettings
accountId :: Text
$sel:accountSettings:UpdateAccountSettings' :: UpdateAccountSettings -> AccountSettings
$sel:accountId:UpdateAccountSettings' :: UpdateAccountSettings -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AccountSettings
accountSettings

instance Prelude.NFData UpdateAccountSettings where
  rnf :: UpdateAccountSettings -> ()
rnf UpdateAccountSettings' {Text
AccountSettings
accountSettings :: AccountSettings
accountId :: Text
$sel:accountSettings:UpdateAccountSettings' :: UpdateAccountSettings -> AccountSettings
$sel:accountId:UpdateAccountSettings' :: UpdateAccountSettings -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AccountSettings
accountSettings

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

instance Data.ToJSON UpdateAccountSettings where
  toJSON :: UpdateAccountSettings -> Value
toJSON UpdateAccountSettings' {Text
AccountSettings
accountSettings :: AccountSettings
accountId :: Text
$sel:accountSettings:UpdateAccountSettings' :: UpdateAccountSettings -> AccountSettings
$sel:accountId:UpdateAccountSettings' :: UpdateAccountSettings -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"AccountSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AccountSettings
accountSettings)
          ]
      )

instance Data.ToPath UpdateAccountSettings where
  toPath :: UpdateAccountSettings -> ByteString
toPath UpdateAccountSettings' {Text
AccountSettings
accountSettings :: AccountSettings
accountId :: Text
$sel:accountSettings:UpdateAccountSettings' :: UpdateAccountSettings -> AccountSettings
$sel:accountId:UpdateAccountSettings' :: UpdateAccountSettings -> 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 UpdateAccountSettings where
  toQuery :: UpdateAccountSettings -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'UpdateAccountSettingsResponse' 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:
--
-- 'httpStatus', 'updateAccountSettingsResponse_httpStatus' - The response's http status code.
newUpdateAccountSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAccountSettingsResponse
newUpdateAccountSettingsResponse :: Int -> UpdateAccountSettingsResponse
newUpdateAccountSettingsResponse Int
pHttpStatus_ =
  UpdateAccountSettingsResponse'
    { $sel:httpStatus:UpdateAccountSettingsResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UpdateAccountSettingsResponse where
  rnf :: UpdateAccountSettingsResponse -> ()
rnf UpdateAccountSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateAccountSettingsResponse' :: UpdateAccountSettingsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus