{-# 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.WorkMail.UpdateMailboxQuota
-- 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 a user\'s current mailbox quota for a specified organization and
-- user.
module Amazonka.WorkMail.UpdateMailboxQuota
  ( -- * Creating a Request
    UpdateMailboxQuota (..),
    newUpdateMailboxQuota,

    -- * Request Lenses
    updateMailboxQuota_organizationId,
    updateMailboxQuota_userId,
    updateMailboxQuota_mailboxQuota,

    -- * Destructuring the Response
    UpdateMailboxQuotaResponse (..),
    newUpdateMailboxQuotaResponse,

    -- * Response Lenses
    updateMailboxQuotaResponse_httpStatus,
  )
where

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
import Amazonka.WorkMail.Types

-- | /See:/ 'newUpdateMailboxQuota' smart constructor.
data UpdateMailboxQuota = UpdateMailboxQuota'
  { -- | The identifier for the organization that contains the user for whom to
    -- update the mailbox quota.
    UpdateMailboxQuota -> Text
organizationId :: Prelude.Text,
    -- | The identifer for the user for whom to update the mailbox quota.
    UpdateMailboxQuota -> Text
userId :: Prelude.Text,
    -- | The updated mailbox quota, in MB, for the specified user.
    UpdateMailboxQuota -> Natural
mailboxQuota :: Prelude.Natural
  }
  deriving (UpdateMailboxQuota -> UpdateMailboxQuota -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateMailboxQuota -> UpdateMailboxQuota -> Bool
$c/= :: UpdateMailboxQuota -> UpdateMailboxQuota -> Bool
== :: UpdateMailboxQuota -> UpdateMailboxQuota -> Bool
$c== :: UpdateMailboxQuota -> UpdateMailboxQuota -> Bool
Prelude.Eq, ReadPrec [UpdateMailboxQuota]
ReadPrec UpdateMailboxQuota
Int -> ReadS UpdateMailboxQuota
ReadS [UpdateMailboxQuota]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateMailboxQuota]
$creadListPrec :: ReadPrec [UpdateMailboxQuota]
readPrec :: ReadPrec UpdateMailboxQuota
$creadPrec :: ReadPrec UpdateMailboxQuota
readList :: ReadS [UpdateMailboxQuota]
$creadList :: ReadS [UpdateMailboxQuota]
readsPrec :: Int -> ReadS UpdateMailboxQuota
$creadsPrec :: Int -> ReadS UpdateMailboxQuota
Prelude.Read, Int -> UpdateMailboxQuota -> ShowS
[UpdateMailboxQuota] -> ShowS
UpdateMailboxQuota -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateMailboxQuota] -> ShowS
$cshowList :: [UpdateMailboxQuota] -> ShowS
show :: UpdateMailboxQuota -> String
$cshow :: UpdateMailboxQuota -> String
showsPrec :: Int -> UpdateMailboxQuota -> ShowS
$cshowsPrec :: Int -> UpdateMailboxQuota -> ShowS
Prelude.Show, forall x. Rep UpdateMailboxQuota x -> UpdateMailboxQuota
forall x. UpdateMailboxQuota -> Rep UpdateMailboxQuota x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateMailboxQuota x -> UpdateMailboxQuota
$cfrom :: forall x. UpdateMailboxQuota -> Rep UpdateMailboxQuota x
Prelude.Generic)

-- |
-- Create a value of 'UpdateMailboxQuota' 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:
--
-- 'organizationId', 'updateMailboxQuota_organizationId' - The identifier for the organization that contains the user for whom to
-- update the mailbox quota.
--
-- 'userId', 'updateMailboxQuota_userId' - The identifer for the user for whom to update the mailbox quota.
--
-- 'mailboxQuota', 'updateMailboxQuota_mailboxQuota' - The updated mailbox quota, in MB, for the specified user.
newUpdateMailboxQuota ::
  -- | 'organizationId'
  Prelude.Text ->
  -- | 'userId'
  Prelude.Text ->
  -- | 'mailboxQuota'
  Prelude.Natural ->
  UpdateMailboxQuota
newUpdateMailboxQuota :: Text -> Text -> Natural -> UpdateMailboxQuota
newUpdateMailboxQuota
  Text
pOrganizationId_
  Text
pUserId_
  Natural
pMailboxQuota_ =
    UpdateMailboxQuota'
      { $sel:organizationId:UpdateMailboxQuota' :: Text
organizationId =
          Text
pOrganizationId_,
        $sel:userId:UpdateMailboxQuota' :: Text
userId = Text
pUserId_,
        $sel:mailboxQuota:UpdateMailboxQuota' :: Natural
mailboxQuota = Natural
pMailboxQuota_
      }

-- | The identifier for the organization that contains the user for whom to
-- update the mailbox quota.
updateMailboxQuota_organizationId :: Lens.Lens' UpdateMailboxQuota Prelude.Text
updateMailboxQuota_organizationId :: Lens' UpdateMailboxQuota Text
updateMailboxQuota_organizationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMailboxQuota' {Text
organizationId :: Text
$sel:organizationId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
organizationId} -> Text
organizationId) (\s :: UpdateMailboxQuota
s@UpdateMailboxQuota' {} Text
a -> UpdateMailboxQuota
s {$sel:organizationId:UpdateMailboxQuota' :: Text
organizationId = Text
a} :: UpdateMailboxQuota)

-- | The identifer for the user for whom to update the mailbox quota.
updateMailboxQuota_userId :: Lens.Lens' UpdateMailboxQuota Prelude.Text
updateMailboxQuota_userId :: Lens' UpdateMailboxQuota Text
updateMailboxQuota_userId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMailboxQuota' {Text
userId :: Text
$sel:userId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
userId} -> Text
userId) (\s :: UpdateMailboxQuota
s@UpdateMailboxQuota' {} Text
a -> UpdateMailboxQuota
s {$sel:userId:UpdateMailboxQuota' :: Text
userId = Text
a} :: UpdateMailboxQuota)

-- | The updated mailbox quota, in MB, for the specified user.
updateMailboxQuota_mailboxQuota :: Lens.Lens' UpdateMailboxQuota Prelude.Natural
updateMailboxQuota_mailboxQuota :: Lens' UpdateMailboxQuota Natural
updateMailboxQuota_mailboxQuota = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateMailboxQuota' {Natural
mailboxQuota :: Natural
$sel:mailboxQuota:UpdateMailboxQuota' :: UpdateMailboxQuota -> Natural
mailboxQuota} -> Natural
mailboxQuota) (\s :: UpdateMailboxQuota
s@UpdateMailboxQuota' {} Natural
a -> UpdateMailboxQuota
s {$sel:mailboxQuota:UpdateMailboxQuota' :: Natural
mailboxQuota = Natural
a} :: UpdateMailboxQuota)

instance Core.AWSRequest UpdateMailboxQuota where
  type
    AWSResponse UpdateMailboxQuota =
      UpdateMailboxQuotaResponse
  request :: (Service -> Service)
-> UpdateMailboxQuota -> Request UpdateMailboxQuota
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateMailboxQuota
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateMailboxQuota)))
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 -> UpdateMailboxQuotaResponse
UpdateMailboxQuotaResponse'
            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 UpdateMailboxQuota where
  hashWithSalt :: Int -> UpdateMailboxQuota -> Int
hashWithSalt Int
_salt UpdateMailboxQuota' {Natural
Text
mailboxQuota :: Natural
userId :: Text
organizationId :: Text
$sel:mailboxQuota:UpdateMailboxQuota' :: UpdateMailboxQuota -> Natural
$sel:userId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
$sel:organizationId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
mailboxQuota

instance Prelude.NFData UpdateMailboxQuota where
  rnf :: UpdateMailboxQuota -> ()
rnf UpdateMailboxQuota' {Natural
Text
mailboxQuota :: Natural
userId :: Text
organizationId :: Text
$sel:mailboxQuota:UpdateMailboxQuota' :: UpdateMailboxQuota -> Natural
$sel:userId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
$sel:organizationId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
organizationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
mailboxQuota

instance Data.ToHeaders UpdateMailboxQuota where
  toHeaders :: UpdateMailboxQuota -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"WorkMailService.UpdateMailboxQuota" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateMailboxQuota where
  toJSON :: UpdateMailboxQuota -> Value
toJSON UpdateMailboxQuota' {Natural
Text
mailboxQuota :: Natural
userId :: Text
organizationId :: Text
$sel:mailboxQuota:UpdateMailboxQuota' :: UpdateMailboxQuota -> Natural
$sel:userId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
$sel:organizationId:UpdateMailboxQuota' :: UpdateMailboxQuota -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"OrganizationId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
organizationId),
            forall a. a -> Maybe a
Prelude.Just (Key
"UserId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userId),
            forall a. a -> Maybe a
Prelude.Just (Key
"MailboxQuota" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
mailboxQuota)
          ]
      )

instance Data.ToPath UpdateMailboxQuota where
  toPath :: UpdateMailboxQuota -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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