{-# 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 #-}
module Amazonka.WorkMail.GetMailboxDetails
(
GetMailboxDetails (..),
newGetMailboxDetails,
getMailboxDetails_organizationId,
getMailboxDetails_userId,
GetMailboxDetailsResponse (..),
newGetMailboxDetailsResponse,
getMailboxDetailsResponse_mailboxQuota,
getMailboxDetailsResponse_mailboxSize,
getMailboxDetailsResponse_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
data GetMailboxDetails = GetMailboxDetails'
{
GetMailboxDetails -> Text
organizationId :: Prelude.Text,
GetMailboxDetails -> Text
userId :: Prelude.Text
}
deriving (GetMailboxDetails -> GetMailboxDetails -> Bool
(GetMailboxDetails -> GetMailboxDetails -> Bool)
-> (GetMailboxDetails -> GetMailboxDetails -> Bool)
-> Eq GetMailboxDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMailboxDetails -> GetMailboxDetails -> Bool
$c/= :: GetMailboxDetails -> GetMailboxDetails -> Bool
== :: GetMailboxDetails -> GetMailboxDetails -> Bool
$c== :: GetMailboxDetails -> GetMailboxDetails -> Bool
Prelude.Eq, ReadPrec [GetMailboxDetails]
ReadPrec GetMailboxDetails
Int -> ReadS GetMailboxDetails
ReadS [GetMailboxDetails]
(Int -> ReadS GetMailboxDetails)
-> ReadS [GetMailboxDetails]
-> ReadPrec GetMailboxDetails
-> ReadPrec [GetMailboxDetails]
-> Read GetMailboxDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMailboxDetails]
$creadListPrec :: ReadPrec [GetMailboxDetails]
readPrec :: ReadPrec GetMailboxDetails
$creadPrec :: ReadPrec GetMailboxDetails
readList :: ReadS [GetMailboxDetails]
$creadList :: ReadS [GetMailboxDetails]
readsPrec :: Int -> ReadS GetMailboxDetails
$creadsPrec :: Int -> ReadS GetMailboxDetails
Prelude.Read, Int -> GetMailboxDetails -> ShowS
[GetMailboxDetails] -> ShowS
GetMailboxDetails -> String
(Int -> GetMailboxDetails -> ShowS)
-> (GetMailboxDetails -> String)
-> ([GetMailboxDetails] -> ShowS)
-> Show GetMailboxDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMailboxDetails] -> ShowS
$cshowList :: [GetMailboxDetails] -> ShowS
show :: GetMailboxDetails -> String
$cshow :: GetMailboxDetails -> String
showsPrec :: Int -> GetMailboxDetails -> ShowS
$cshowsPrec :: Int -> GetMailboxDetails -> ShowS
Prelude.Show, (forall x. GetMailboxDetails -> Rep GetMailboxDetails x)
-> (forall x. Rep GetMailboxDetails x -> GetMailboxDetails)
-> Generic GetMailboxDetails
forall x. Rep GetMailboxDetails x -> GetMailboxDetails
forall x. GetMailboxDetails -> Rep GetMailboxDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMailboxDetails x -> GetMailboxDetails
$cfrom :: forall x. GetMailboxDetails -> Rep GetMailboxDetails x
Prelude.Generic)
newGetMailboxDetails ::
Prelude.Text ->
Prelude.Text ->
GetMailboxDetails
newGetMailboxDetails :: Text -> Text -> GetMailboxDetails
newGetMailboxDetails Text
pOrganizationId_ Text
pUserId_ =
GetMailboxDetails' :: Text -> Text -> GetMailboxDetails
GetMailboxDetails'
{ $sel:organizationId:GetMailboxDetails' :: Text
organizationId =
Text
pOrganizationId_,
$sel:userId:GetMailboxDetails' :: Text
userId = Text
pUserId_
}
getMailboxDetails_organizationId :: Lens.Lens' GetMailboxDetails Prelude.Text
getMailboxDetails_organizationId :: (Text -> f Text) -> GetMailboxDetails -> f GetMailboxDetails
getMailboxDetails_organizationId = (GetMailboxDetails -> Text)
-> (GetMailboxDetails -> Text -> GetMailboxDetails)
-> Lens GetMailboxDetails GetMailboxDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMailboxDetails' {Text
organizationId :: Text
$sel:organizationId:GetMailboxDetails' :: GetMailboxDetails -> Text
organizationId} -> Text
organizationId) (\s :: GetMailboxDetails
s@GetMailboxDetails' {} Text
a -> GetMailboxDetails
s {$sel:organizationId:GetMailboxDetails' :: Text
organizationId = Text
a} :: GetMailboxDetails)
getMailboxDetails_userId :: Lens.Lens' GetMailboxDetails Prelude.Text
getMailboxDetails_userId :: (Text -> f Text) -> GetMailboxDetails -> f GetMailboxDetails
getMailboxDetails_userId = (GetMailboxDetails -> Text)
-> (GetMailboxDetails -> Text -> GetMailboxDetails)
-> Lens GetMailboxDetails GetMailboxDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMailboxDetails' {Text
userId :: Text
$sel:userId:GetMailboxDetails' :: GetMailboxDetails -> Text
userId} -> Text
userId) (\s :: GetMailboxDetails
s@GetMailboxDetails' {} Text
a -> GetMailboxDetails
s {$sel:userId:GetMailboxDetails' :: Text
userId = Text
a} :: GetMailboxDetails)
instance Core.AWSRequest GetMailboxDetails where
type
AWSResponse GetMailboxDetails =
GetMailboxDetailsResponse
request :: GetMailboxDetails -> Request GetMailboxDetails
request = Service -> GetMailboxDetails -> Request GetMailboxDetails
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetMailboxDetails
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMailboxDetails)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMailboxDetails))
-> Logger
-> Service
-> Proxy GetMailboxDetails
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetMailboxDetails)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Natural -> Maybe Double -> Int -> GetMailboxDetailsResponse
GetMailboxDetailsResponse'
(Maybe Natural -> Maybe Double -> Int -> GetMailboxDetailsResponse)
-> Either String (Maybe Natural)
-> Either String (Maybe Double -> Int -> GetMailboxDetailsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MailboxQuota")
Either String (Maybe Double -> Int -> GetMailboxDetailsResponse)
-> Either String (Maybe Double)
-> Either String (Int -> GetMailboxDetailsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Double)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MailboxSize")
Either String (Int -> GetMailboxDetailsResponse)
-> Either String Int -> Either String GetMailboxDetailsResponse
forall (f :: * -> *) a b. Applicative f => 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 GetMailboxDetails
instance Prelude.NFData GetMailboxDetails
instance Core.ToHeaders GetMailboxDetails where
toHeaders :: GetMailboxDetails -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMailboxDetails -> 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.GetMailboxDetails" ::
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 GetMailboxDetails where
toJSON :: GetMailboxDetails -> Value
toJSON GetMailboxDetails' {Text
userId :: Text
organizationId :: Text
$sel:userId:GetMailboxDetails' :: GetMailboxDetails -> Text
$sel:organizationId:GetMailboxDetails' :: GetMailboxDetails -> 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)
]
)
instance Core.ToPath GetMailboxDetails where
toPath :: GetMailboxDetails -> ByteString
toPath = ByteString -> GetMailboxDetails -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetMailboxDetails where
toQuery :: GetMailboxDetails -> QueryString
toQuery = QueryString -> GetMailboxDetails -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMailboxDetailsResponse = GetMailboxDetailsResponse'
{
GetMailboxDetailsResponse -> Maybe Natural
mailboxQuota :: Prelude.Maybe Prelude.Natural,
GetMailboxDetailsResponse -> Maybe Double
mailboxSize :: Prelude.Maybe Prelude.Double,
GetMailboxDetailsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool
(GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool)
-> (GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool)
-> Eq GetMailboxDetailsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool
$c/= :: GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool
== :: GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool
$c== :: GetMailboxDetailsResponse -> GetMailboxDetailsResponse -> Bool
Prelude.Eq, ReadPrec [GetMailboxDetailsResponse]
ReadPrec GetMailboxDetailsResponse
Int -> ReadS GetMailboxDetailsResponse
ReadS [GetMailboxDetailsResponse]
(Int -> ReadS GetMailboxDetailsResponse)
-> ReadS [GetMailboxDetailsResponse]
-> ReadPrec GetMailboxDetailsResponse
-> ReadPrec [GetMailboxDetailsResponse]
-> Read GetMailboxDetailsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMailboxDetailsResponse]
$creadListPrec :: ReadPrec [GetMailboxDetailsResponse]
readPrec :: ReadPrec GetMailboxDetailsResponse
$creadPrec :: ReadPrec GetMailboxDetailsResponse
readList :: ReadS [GetMailboxDetailsResponse]
$creadList :: ReadS [GetMailboxDetailsResponse]
readsPrec :: Int -> ReadS GetMailboxDetailsResponse
$creadsPrec :: Int -> ReadS GetMailboxDetailsResponse
Prelude.Read, Int -> GetMailboxDetailsResponse -> ShowS
[GetMailboxDetailsResponse] -> ShowS
GetMailboxDetailsResponse -> String
(Int -> GetMailboxDetailsResponse -> ShowS)
-> (GetMailboxDetailsResponse -> String)
-> ([GetMailboxDetailsResponse] -> ShowS)
-> Show GetMailboxDetailsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMailboxDetailsResponse] -> ShowS
$cshowList :: [GetMailboxDetailsResponse] -> ShowS
show :: GetMailboxDetailsResponse -> String
$cshow :: GetMailboxDetailsResponse -> String
showsPrec :: Int -> GetMailboxDetailsResponse -> ShowS
$cshowsPrec :: Int -> GetMailboxDetailsResponse -> ShowS
Prelude.Show, (forall x.
GetMailboxDetailsResponse -> Rep GetMailboxDetailsResponse x)
-> (forall x.
Rep GetMailboxDetailsResponse x -> GetMailboxDetailsResponse)
-> Generic GetMailboxDetailsResponse
forall x.
Rep GetMailboxDetailsResponse x -> GetMailboxDetailsResponse
forall x.
GetMailboxDetailsResponse -> Rep GetMailboxDetailsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMailboxDetailsResponse x -> GetMailboxDetailsResponse
$cfrom :: forall x.
GetMailboxDetailsResponse -> Rep GetMailboxDetailsResponse x
Prelude.Generic)
newGetMailboxDetailsResponse ::
Prelude.Int ->
GetMailboxDetailsResponse
newGetMailboxDetailsResponse :: Int -> GetMailboxDetailsResponse
newGetMailboxDetailsResponse Int
pHttpStatus_ =
GetMailboxDetailsResponse' :: Maybe Natural -> Maybe Double -> Int -> GetMailboxDetailsResponse
GetMailboxDetailsResponse'
{ $sel:mailboxQuota:GetMailboxDetailsResponse' :: Maybe Natural
mailboxQuota =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:mailboxSize:GetMailboxDetailsResponse' :: Maybe Double
mailboxSize = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMailboxDetailsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMailboxDetailsResponse_mailboxQuota :: Lens.Lens' GetMailboxDetailsResponse (Prelude.Maybe Prelude.Natural)
getMailboxDetailsResponse_mailboxQuota :: (Maybe Natural -> f (Maybe Natural))
-> GetMailboxDetailsResponse -> f GetMailboxDetailsResponse
getMailboxDetailsResponse_mailboxQuota = (GetMailboxDetailsResponse -> Maybe Natural)
-> (GetMailboxDetailsResponse
-> Maybe Natural -> GetMailboxDetailsResponse)
-> Lens
GetMailboxDetailsResponse
GetMailboxDetailsResponse
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMailboxDetailsResponse' {Maybe Natural
mailboxQuota :: Maybe Natural
$sel:mailboxQuota:GetMailboxDetailsResponse' :: GetMailboxDetailsResponse -> Maybe Natural
mailboxQuota} -> Maybe Natural
mailboxQuota) (\s :: GetMailboxDetailsResponse
s@GetMailboxDetailsResponse' {} Maybe Natural
a -> GetMailboxDetailsResponse
s {$sel:mailboxQuota:GetMailboxDetailsResponse' :: Maybe Natural
mailboxQuota = Maybe Natural
a} :: GetMailboxDetailsResponse)
getMailboxDetailsResponse_mailboxSize :: Lens.Lens' GetMailboxDetailsResponse (Prelude.Maybe Prelude.Double)
getMailboxDetailsResponse_mailboxSize :: (Maybe Double -> f (Maybe Double))
-> GetMailboxDetailsResponse -> f GetMailboxDetailsResponse
getMailboxDetailsResponse_mailboxSize = (GetMailboxDetailsResponse -> Maybe Double)
-> (GetMailboxDetailsResponse
-> Maybe Double -> GetMailboxDetailsResponse)
-> Lens
GetMailboxDetailsResponse
GetMailboxDetailsResponse
(Maybe Double)
(Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMailboxDetailsResponse' {Maybe Double
mailboxSize :: Maybe Double
$sel:mailboxSize:GetMailboxDetailsResponse' :: GetMailboxDetailsResponse -> Maybe Double
mailboxSize} -> Maybe Double
mailboxSize) (\s :: GetMailboxDetailsResponse
s@GetMailboxDetailsResponse' {} Maybe Double
a -> GetMailboxDetailsResponse
s {$sel:mailboxSize:GetMailboxDetailsResponse' :: Maybe Double
mailboxSize = Maybe Double
a} :: GetMailboxDetailsResponse)
getMailboxDetailsResponse_httpStatus :: Lens.Lens' GetMailboxDetailsResponse Prelude.Int
getMailboxDetailsResponse_httpStatus :: (Int -> f Int)
-> GetMailboxDetailsResponse -> f GetMailboxDetailsResponse
getMailboxDetailsResponse_httpStatus = (GetMailboxDetailsResponse -> Int)
-> (GetMailboxDetailsResponse -> Int -> GetMailboxDetailsResponse)
-> Lens GetMailboxDetailsResponse GetMailboxDetailsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMailboxDetailsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMailboxDetailsResponse' :: GetMailboxDetailsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMailboxDetailsResponse
s@GetMailboxDetailsResponse' {} Int
a -> GetMailboxDetailsResponse
s {$sel:httpStatus:GetMailboxDetailsResponse' :: Int
httpStatus = Int
a} :: GetMailboxDetailsResponse)
instance Prelude.NFData GetMailboxDetailsResponse