{-# 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.PutMailboxPermissions
(
PutMailboxPermissions (..),
newPutMailboxPermissions,
putMailboxPermissions_organizationId,
putMailboxPermissions_entityId,
putMailboxPermissions_granteeId,
putMailboxPermissions_permissionValues,
PutMailboxPermissionsResponse (..),
newPutMailboxPermissionsResponse,
putMailboxPermissionsResponse_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 PutMailboxPermissions = PutMailboxPermissions'
{
PutMailboxPermissions -> Text
organizationId :: Prelude.Text,
PutMailboxPermissions -> Text
entityId :: Prelude.Text,
PutMailboxPermissions -> Text
granteeId :: Prelude.Text,
PutMailboxPermissions -> [PermissionType]
permissionValues :: [PermissionType]
}
deriving (PutMailboxPermissions -> PutMailboxPermissions -> Bool
(PutMailboxPermissions -> PutMailboxPermissions -> Bool)
-> (PutMailboxPermissions -> PutMailboxPermissions -> Bool)
-> Eq PutMailboxPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutMailboxPermissions -> PutMailboxPermissions -> Bool
$c/= :: PutMailboxPermissions -> PutMailboxPermissions -> Bool
== :: PutMailboxPermissions -> PutMailboxPermissions -> Bool
$c== :: PutMailboxPermissions -> PutMailboxPermissions -> Bool
Prelude.Eq, ReadPrec [PutMailboxPermissions]
ReadPrec PutMailboxPermissions
Int -> ReadS PutMailboxPermissions
ReadS [PutMailboxPermissions]
(Int -> ReadS PutMailboxPermissions)
-> ReadS [PutMailboxPermissions]
-> ReadPrec PutMailboxPermissions
-> ReadPrec [PutMailboxPermissions]
-> Read PutMailboxPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutMailboxPermissions]
$creadListPrec :: ReadPrec [PutMailboxPermissions]
readPrec :: ReadPrec PutMailboxPermissions
$creadPrec :: ReadPrec PutMailboxPermissions
readList :: ReadS [PutMailboxPermissions]
$creadList :: ReadS [PutMailboxPermissions]
readsPrec :: Int -> ReadS PutMailboxPermissions
$creadsPrec :: Int -> ReadS PutMailboxPermissions
Prelude.Read, Int -> PutMailboxPermissions -> ShowS
[PutMailboxPermissions] -> ShowS
PutMailboxPermissions -> String
(Int -> PutMailboxPermissions -> ShowS)
-> (PutMailboxPermissions -> String)
-> ([PutMailboxPermissions] -> ShowS)
-> Show PutMailboxPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutMailboxPermissions] -> ShowS
$cshowList :: [PutMailboxPermissions] -> ShowS
show :: PutMailboxPermissions -> String
$cshow :: PutMailboxPermissions -> String
showsPrec :: Int -> PutMailboxPermissions -> ShowS
$cshowsPrec :: Int -> PutMailboxPermissions -> ShowS
Prelude.Show, (forall x. PutMailboxPermissions -> Rep PutMailboxPermissions x)
-> (forall x. Rep PutMailboxPermissions x -> PutMailboxPermissions)
-> Generic PutMailboxPermissions
forall x. Rep PutMailboxPermissions x -> PutMailboxPermissions
forall x. PutMailboxPermissions -> Rep PutMailboxPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutMailboxPermissions x -> PutMailboxPermissions
$cfrom :: forall x. PutMailboxPermissions -> Rep PutMailboxPermissions x
Prelude.Generic)
newPutMailboxPermissions ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
PutMailboxPermissions
newPutMailboxPermissions :: Text -> Text -> Text -> PutMailboxPermissions
newPutMailboxPermissions
Text
pOrganizationId_
Text
pEntityId_
Text
pGranteeId_ =
PutMailboxPermissions' :: Text -> Text -> Text -> [PermissionType] -> PutMailboxPermissions
PutMailboxPermissions'
{ $sel:organizationId:PutMailboxPermissions' :: Text
organizationId =
Text
pOrganizationId_,
$sel:entityId:PutMailboxPermissions' :: Text
entityId = Text
pEntityId_,
$sel:granteeId:PutMailboxPermissions' :: Text
granteeId = Text
pGranteeId_,
$sel:permissionValues:PutMailboxPermissions' :: [PermissionType]
permissionValues = [PermissionType]
forall a. Monoid a => a
Prelude.mempty
}
putMailboxPermissions_organizationId :: Lens.Lens' PutMailboxPermissions Prelude.Text
putMailboxPermissions_organizationId :: (Text -> f Text)
-> PutMailboxPermissions -> f PutMailboxPermissions
putMailboxPermissions_organizationId = (PutMailboxPermissions -> Text)
-> (PutMailboxPermissions -> Text -> PutMailboxPermissions)
-> Lens PutMailboxPermissions PutMailboxPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMailboxPermissions' {Text
organizationId :: Text
$sel:organizationId:PutMailboxPermissions' :: PutMailboxPermissions -> Text
organizationId} -> Text
organizationId) (\s :: PutMailboxPermissions
s@PutMailboxPermissions' {} Text
a -> PutMailboxPermissions
s {$sel:organizationId:PutMailboxPermissions' :: Text
organizationId = Text
a} :: PutMailboxPermissions)
putMailboxPermissions_entityId :: Lens.Lens' PutMailboxPermissions Prelude.Text
putMailboxPermissions_entityId :: (Text -> f Text)
-> PutMailboxPermissions -> f PutMailboxPermissions
putMailboxPermissions_entityId = (PutMailboxPermissions -> Text)
-> (PutMailboxPermissions -> Text -> PutMailboxPermissions)
-> Lens PutMailboxPermissions PutMailboxPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMailboxPermissions' {Text
entityId :: Text
$sel:entityId:PutMailboxPermissions' :: PutMailboxPermissions -> Text
entityId} -> Text
entityId) (\s :: PutMailboxPermissions
s@PutMailboxPermissions' {} Text
a -> PutMailboxPermissions
s {$sel:entityId:PutMailboxPermissions' :: Text
entityId = Text
a} :: PutMailboxPermissions)
putMailboxPermissions_granteeId :: Lens.Lens' PutMailboxPermissions Prelude.Text
putMailboxPermissions_granteeId :: (Text -> f Text)
-> PutMailboxPermissions -> f PutMailboxPermissions
putMailboxPermissions_granteeId = (PutMailboxPermissions -> Text)
-> (PutMailboxPermissions -> Text -> PutMailboxPermissions)
-> Lens PutMailboxPermissions PutMailboxPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMailboxPermissions' {Text
granteeId :: Text
$sel:granteeId:PutMailboxPermissions' :: PutMailboxPermissions -> Text
granteeId} -> Text
granteeId) (\s :: PutMailboxPermissions
s@PutMailboxPermissions' {} Text
a -> PutMailboxPermissions
s {$sel:granteeId:PutMailboxPermissions' :: Text
granteeId = Text
a} :: PutMailboxPermissions)
putMailboxPermissions_permissionValues :: Lens.Lens' PutMailboxPermissions [PermissionType]
putMailboxPermissions_permissionValues :: ([PermissionType] -> f [PermissionType])
-> PutMailboxPermissions -> f PutMailboxPermissions
putMailboxPermissions_permissionValues = (PutMailboxPermissions -> [PermissionType])
-> (PutMailboxPermissions
-> [PermissionType] -> PutMailboxPermissions)
-> Lens
PutMailboxPermissions
PutMailboxPermissions
[PermissionType]
[PermissionType]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMailboxPermissions' {[PermissionType]
permissionValues :: [PermissionType]
$sel:permissionValues:PutMailboxPermissions' :: PutMailboxPermissions -> [PermissionType]
permissionValues} -> [PermissionType]
permissionValues) (\s :: PutMailboxPermissions
s@PutMailboxPermissions' {} [PermissionType]
a -> PutMailboxPermissions
s {$sel:permissionValues:PutMailboxPermissions' :: [PermissionType]
permissionValues = [PermissionType]
a} :: PutMailboxPermissions) (([PermissionType] -> f [PermissionType])
-> PutMailboxPermissions -> f PutMailboxPermissions)
-> (([PermissionType] -> f [PermissionType])
-> [PermissionType] -> f [PermissionType])
-> ([PermissionType] -> f [PermissionType])
-> PutMailboxPermissions
-> f PutMailboxPermissions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PermissionType] -> f [PermissionType])
-> [PermissionType] -> f [PermissionType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutMailboxPermissions where
type
AWSResponse PutMailboxPermissions =
PutMailboxPermissionsResponse
request :: PutMailboxPermissions -> Request PutMailboxPermissions
request = Service -> PutMailboxPermissions -> Request PutMailboxPermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutMailboxPermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutMailboxPermissions)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutMailboxPermissions))
-> Logger
-> Service
-> Proxy PutMailboxPermissions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutMailboxPermissions)))
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 -> PutMailboxPermissionsResponse
PutMailboxPermissionsResponse'
(Int -> PutMailboxPermissionsResponse)
-> Either String Int -> Either String PutMailboxPermissionsResponse
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 PutMailboxPermissions
instance Prelude.NFData PutMailboxPermissions
instance Core.ToHeaders PutMailboxPermissions where
toHeaders :: PutMailboxPermissions -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutMailboxPermissions -> 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.PutMailboxPermissions" ::
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 PutMailboxPermissions where
toJSON :: PutMailboxPermissions -> Value
toJSON PutMailboxPermissions' {[PermissionType]
Text
permissionValues :: [PermissionType]
granteeId :: Text
entityId :: Text
organizationId :: Text
$sel:permissionValues:PutMailboxPermissions' :: PutMailboxPermissions -> [PermissionType]
$sel:granteeId:PutMailboxPermissions' :: PutMailboxPermissions -> Text
$sel:entityId:PutMailboxPermissions' :: PutMailboxPermissions -> Text
$sel:organizationId:PutMailboxPermissions' :: PutMailboxPermissions -> 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
"EntityId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
entityId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GranteeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
granteeId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PermissionValues" Text -> [PermissionType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [PermissionType]
permissionValues)
]
)
instance Core.ToPath PutMailboxPermissions where
toPath :: PutMailboxPermissions -> ByteString
toPath = ByteString -> PutMailboxPermissions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutMailboxPermissions where
toQuery :: PutMailboxPermissions -> QueryString
toQuery = QueryString -> PutMailboxPermissions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutMailboxPermissionsResponse = PutMailboxPermissionsResponse'
{
PutMailboxPermissionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool
(PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool)
-> (PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool)
-> Eq PutMailboxPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool
$c/= :: PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool
== :: PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool
$c== :: PutMailboxPermissionsResponse
-> PutMailboxPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [PutMailboxPermissionsResponse]
ReadPrec PutMailboxPermissionsResponse
Int -> ReadS PutMailboxPermissionsResponse
ReadS [PutMailboxPermissionsResponse]
(Int -> ReadS PutMailboxPermissionsResponse)
-> ReadS [PutMailboxPermissionsResponse]
-> ReadPrec PutMailboxPermissionsResponse
-> ReadPrec [PutMailboxPermissionsResponse]
-> Read PutMailboxPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutMailboxPermissionsResponse]
$creadListPrec :: ReadPrec [PutMailboxPermissionsResponse]
readPrec :: ReadPrec PutMailboxPermissionsResponse
$creadPrec :: ReadPrec PutMailboxPermissionsResponse
readList :: ReadS [PutMailboxPermissionsResponse]
$creadList :: ReadS [PutMailboxPermissionsResponse]
readsPrec :: Int -> ReadS PutMailboxPermissionsResponse
$creadsPrec :: Int -> ReadS PutMailboxPermissionsResponse
Prelude.Read, Int -> PutMailboxPermissionsResponse -> ShowS
[PutMailboxPermissionsResponse] -> ShowS
PutMailboxPermissionsResponse -> String
(Int -> PutMailboxPermissionsResponse -> ShowS)
-> (PutMailboxPermissionsResponse -> String)
-> ([PutMailboxPermissionsResponse] -> ShowS)
-> Show PutMailboxPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutMailboxPermissionsResponse] -> ShowS
$cshowList :: [PutMailboxPermissionsResponse] -> ShowS
show :: PutMailboxPermissionsResponse -> String
$cshow :: PutMailboxPermissionsResponse -> String
showsPrec :: Int -> PutMailboxPermissionsResponse -> ShowS
$cshowsPrec :: Int -> PutMailboxPermissionsResponse -> ShowS
Prelude.Show, (forall x.
PutMailboxPermissionsResponse
-> Rep PutMailboxPermissionsResponse x)
-> (forall x.
Rep PutMailboxPermissionsResponse x
-> PutMailboxPermissionsResponse)
-> Generic PutMailboxPermissionsResponse
forall x.
Rep PutMailboxPermissionsResponse x
-> PutMailboxPermissionsResponse
forall x.
PutMailboxPermissionsResponse
-> Rep PutMailboxPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutMailboxPermissionsResponse x
-> PutMailboxPermissionsResponse
$cfrom :: forall x.
PutMailboxPermissionsResponse
-> Rep PutMailboxPermissionsResponse x
Prelude.Generic)
newPutMailboxPermissionsResponse ::
Prelude.Int ->
PutMailboxPermissionsResponse
newPutMailboxPermissionsResponse :: Int -> PutMailboxPermissionsResponse
newPutMailboxPermissionsResponse Int
pHttpStatus_ =
PutMailboxPermissionsResponse' :: Int -> PutMailboxPermissionsResponse
PutMailboxPermissionsResponse'
{ $sel:httpStatus:PutMailboxPermissionsResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putMailboxPermissionsResponse_httpStatus :: Lens.Lens' PutMailboxPermissionsResponse Prelude.Int
putMailboxPermissionsResponse_httpStatus :: (Int -> f Int)
-> PutMailboxPermissionsResponse -> f PutMailboxPermissionsResponse
putMailboxPermissionsResponse_httpStatus = (PutMailboxPermissionsResponse -> Int)
-> (PutMailboxPermissionsResponse
-> Int -> PutMailboxPermissionsResponse)
-> Lens
PutMailboxPermissionsResponse PutMailboxPermissionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMailboxPermissionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutMailboxPermissionsResponse' :: PutMailboxPermissionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutMailboxPermissionsResponse
s@PutMailboxPermissionsResponse' {} Int
a -> PutMailboxPermissionsResponse
s {$sel:httpStatus:PutMailboxPermissionsResponse' :: Int
httpStatus = Int
a} :: PutMailboxPermissionsResponse)
instance Prelude.NFData PutMailboxPermissionsResponse