{-# 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-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 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.Lens as Lens
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
(UpdateAccountSettings -> UpdateAccountSettings -> Bool)
-> (UpdateAccountSettings -> UpdateAccountSettings -> Bool)
-> Eq UpdateAccountSettings
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]
(Int -> ReadS UpdateAccountSettings)
-> ReadS [UpdateAccountSettings]
-> ReadPrec UpdateAccountSettings
-> ReadPrec [UpdateAccountSettings]
-> Read 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
(Int -> UpdateAccountSettings -> ShowS)
-> (UpdateAccountSettings -> String)
-> ([UpdateAccountSettings] -> ShowS)
-> Show UpdateAccountSettings
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. UpdateAccountSettings -> Rep UpdateAccountSettings x)
-> (forall x. Rep UpdateAccountSettings x -> UpdateAccountSettings)
-> Generic UpdateAccountSettings
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' :: Text -> AccountSettings -> UpdateAccountSettings
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 :: (Text -> f Text)
-> UpdateAccountSettings -> f UpdateAccountSettings
updateAccountSettings_accountId = (UpdateAccountSettings -> Text)
-> (UpdateAccountSettings -> Text -> UpdateAccountSettings)
-> Lens UpdateAccountSettings UpdateAccountSettings Text Text
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 :: (AccountSettings -> f AccountSettings)
-> UpdateAccountSettings -> f UpdateAccountSettings
updateAccountSettings_accountSettings = (UpdateAccountSettings -> AccountSettings)
-> (UpdateAccountSettings
    -> AccountSettings -> UpdateAccountSettings)
-> Lens
     UpdateAccountSettings
     UpdateAccountSettings
     AccountSettings
     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 :: UpdateAccountSettings -> Request UpdateAccountSettings
request = Service -> UpdateAccountSettings -> Request UpdateAccountSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAccountSettings)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateAccountSettings))
-> Logger
-> Service
-> Proxy UpdateAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAccountSettings)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateAccountSettingsResponse
UpdateAccountSettingsResponse'
            (Int -> UpdateAccountSettingsResponse)
-> Either String Int -> Either String UpdateAccountSettingsResponse
forall (f :: * -> *) a b. Functor 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 UpdateAccountSettings

instance Prelude.NFData UpdateAccountSettings

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AccountSettings" Text -> AccountSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AccountSettings
accountSettings)
          ]
      )

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

instance Core.ToQuery UpdateAccountSettings where
  toQuery :: UpdateAccountSettings -> QueryString
toQuery = QueryString -> UpdateAccountSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateAccountSettingsResponse
 -> UpdateAccountSettingsResponse -> Bool)
-> (UpdateAccountSettingsResponse
    -> UpdateAccountSettingsResponse -> Bool)
-> Eq UpdateAccountSettingsResponse
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]
(Int -> ReadS UpdateAccountSettingsResponse)
-> ReadS [UpdateAccountSettingsResponse]
-> ReadPrec UpdateAccountSettingsResponse
-> ReadPrec [UpdateAccountSettingsResponse]
-> Read 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
(Int -> UpdateAccountSettingsResponse -> ShowS)
-> (UpdateAccountSettingsResponse -> String)
-> ([UpdateAccountSettingsResponse] -> ShowS)
-> Show UpdateAccountSettingsResponse
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.
 UpdateAccountSettingsResponse
 -> Rep UpdateAccountSettingsResponse x)
-> (forall x.
    Rep UpdateAccountSettingsResponse x
    -> UpdateAccountSettingsResponse)
-> Generic UpdateAccountSettingsResponse
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' :: Int -> UpdateAccountSettingsResponse
UpdateAccountSettingsResponse'
    { $sel:httpStatus:UpdateAccountSettingsResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
updateAccountSettingsResponse_httpStatus :: Lens.Lens' UpdateAccountSettingsResponse Prelude.Int
updateAccountSettingsResponse_httpStatus :: (Int -> f Int)
-> UpdateAccountSettingsResponse -> f UpdateAccountSettingsResponse
updateAccountSettingsResponse_httpStatus = (UpdateAccountSettingsResponse -> Int)
-> (UpdateAccountSettingsResponse
    -> Int -> UpdateAccountSettingsResponse)
-> Lens
     UpdateAccountSettingsResponse UpdateAccountSettingsResponse Int Int
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