{-# 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-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 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.Lens as Lens
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
(UpdateMailboxQuota -> UpdateMailboxQuota -> Bool)
-> (UpdateMailboxQuota -> UpdateMailboxQuota -> Bool)
-> Eq UpdateMailboxQuota
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]
(Int -> ReadS UpdateMailboxQuota)
-> ReadS [UpdateMailboxQuota]
-> ReadPrec UpdateMailboxQuota
-> ReadPrec [UpdateMailboxQuota]
-> Read 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
(Int -> UpdateMailboxQuota -> ShowS)
-> (UpdateMailboxQuota -> String)
-> ([UpdateMailboxQuota] -> ShowS)
-> Show UpdateMailboxQuota
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. UpdateMailboxQuota -> Rep UpdateMailboxQuota x)
-> (forall x. Rep UpdateMailboxQuota x -> UpdateMailboxQuota)
-> Generic UpdateMailboxQuota
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' :: Text -> Text -> Natural -> UpdateMailboxQuota
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 :: (Text -> f Text) -> UpdateMailboxQuota -> f UpdateMailboxQuota
updateMailboxQuota_organizationId = (UpdateMailboxQuota -> Text)
-> (UpdateMailboxQuota -> Text -> UpdateMailboxQuota)
-> Lens UpdateMailboxQuota UpdateMailboxQuota Text Text
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 :: (Text -> f Text) -> UpdateMailboxQuota -> f UpdateMailboxQuota
updateMailboxQuota_userId = (UpdateMailboxQuota -> Text)
-> (UpdateMailboxQuota -> Text -> UpdateMailboxQuota)
-> Lens UpdateMailboxQuota UpdateMailboxQuota Text Text
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 :: (Natural -> f Natural)
-> UpdateMailboxQuota -> f UpdateMailboxQuota
updateMailboxQuota_mailboxQuota = (UpdateMailboxQuota -> Natural)
-> (UpdateMailboxQuota -> Natural -> UpdateMailboxQuota)
-> Lens UpdateMailboxQuota UpdateMailboxQuota Natural Natural
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 :: UpdateMailboxQuota -> Request UpdateMailboxQuota
request = Service -> UpdateMailboxQuota -> Request UpdateMailboxQuota
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateMailboxQuota
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateMailboxQuota)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateMailboxQuota))
-> Logger
-> Service
-> Proxy UpdateMailboxQuota
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateMailboxQuota)))
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 -> UpdateMailboxQuotaResponse
UpdateMailboxQuotaResponse'
            (Int -> UpdateMailboxQuotaResponse)
-> Either String Int -> Either String UpdateMailboxQuotaResponse
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 UpdateMailboxQuota

instance Prelude.NFData UpdateMailboxQuota

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MailboxQuota" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
mailboxQuota)
          ]
      )

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

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

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