{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.WorkMail.Types.Permission where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkMail.Types.MemberType
import Amazonka.WorkMail.Types.PermissionType
data Permission = Permission'
{
Permission -> Text
granteeId :: Prelude.Text,
Permission -> MemberType
granteeType :: MemberType,
Permission -> [PermissionType]
permissionValues :: [PermissionType]
}
deriving (Permission -> Permission -> Bool
(Permission -> Permission -> Bool)
-> (Permission -> Permission -> Bool) -> Eq Permission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Permission -> Permission -> Bool
$c/= :: Permission -> Permission -> Bool
== :: Permission -> Permission -> Bool
$c== :: Permission -> Permission -> Bool
Prelude.Eq, ReadPrec [Permission]
ReadPrec Permission
Int -> ReadS Permission
ReadS [Permission]
(Int -> ReadS Permission)
-> ReadS [Permission]
-> ReadPrec Permission
-> ReadPrec [Permission]
-> Read Permission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Permission]
$creadListPrec :: ReadPrec [Permission]
readPrec :: ReadPrec Permission
$creadPrec :: ReadPrec Permission
readList :: ReadS [Permission]
$creadList :: ReadS [Permission]
readsPrec :: Int -> ReadS Permission
$creadsPrec :: Int -> ReadS Permission
Prelude.Read, Int -> Permission -> ShowS
[Permission] -> ShowS
Permission -> String
(Int -> Permission -> ShowS)
-> (Permission -> String)
-> ([Permission] -> ShowS)
-> Show Permission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Permission] -> ShowS
$cshowList :: [Permission] -> ShowS
show :: Permission -> String
$cshow :: Permission -> String
showsPrec :: Int -> Permission -> ShowS
$cshowsPrec :: Int -> Permission -> ShowS
Prelude.Show, (forall x. Permission -> Rep Permission x)
-> (forall x. Rep Permission x -> Permission) -> Generic Permission
forall x. Rep Permission x -> Permission
forall x. Permission -> Rep Permission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Permission x -> Permission
$cfrom :: forall x. Permission -> Rep Permission x
Prelude.Generic)
newPermission ::
Prelude.Text ->
MemberType ->
Permission
newPermission :: Text -> MemberType -> Permission
newPermission Text
pGranteeId_ MemberType
pGranteeType_ =
Permission' :: Text -> MemberType -> [PermissionType] -> Permission
Permission'
{ $sel:granteeId:Permission' :: Text
granteeId = Text
pGranteeId_,
$sel:granteeType:Permission' :: MemberType
granteeType = MemberType
pGranteeType_,
$sel:permissionValues:Permission' :: [PermissionType]
permissionValues = [PermissionType]
forall a. Monoid a => a
Prelude.mempty
}
permission_granteeId :: Lens.Lens' Permission Prelude.Text
permission_granteeId :: (Text -> f Text) -> Permission -> f Permission
permission_granteeId = (Permission -> Text)
-> (Permission -> Text -> Permission)
-> Lens Permission Permission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Permission' {Text
granteeId :: Text
$sel:granteeId:Permission' :: Permission -> Text
granteeId} -> Text
granteeId) (\s :: Permission
s@Permission' {} Text
a -> Permission
s {$sel:granteeId:Permission' :: Text
granteeId = Text
a} :: Permission)
permission_granteeType :: Lens.Lens' Permission MemberType
permission_granteeType :: (MemberType -> f MemberType) -> Permission -> f Permission
permission_granteeType = (Permission -> MemberType)
-> (Permission -> MemberType -> Permission)
-> Lens Permission Permission MemberType MemberType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Permission' {MemberType
granteeType :: MemberType
$sel:granteeType:Permission' :: Permission -> MemberType
granteeType} -> MemberType
granteeType) (\s :: Permission
s@Permission' {} MemberType
a -> Permission
s {$sel:granteeType:Permission' :: MemberType
granteeType = MemberType
a} :: Permission)
permission_permissionValues :: Lens.Lens' Permission [PermissionType]
permission_permissionValues :: ([PermissionType] -> f [PermissionType])
-> Permission -> f Permission
permission_permissionValues = (Permission -> [PermissionType])
-> (Permission -> [PermissionType] -> Permission)
-> Lens Permission Permission [PermissionType] [PermissionType]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Permission' {[PermissionType]
permissionValues :: [PermissionType]
$sel:permissionValues:Permission' :: Permission -> [PermissionType]
permissionValues} -> [PermissionType]
permissionValues) (\s :: Permission
s@Permission' {} [PermissionType]
a -> Permission
s {$sel:permissionValues:Permission' :: [PermissionType]
permissionValues = [PermissionType]
a} :: Permission) (([PermissionType] -> f [PermissionType])
-> Permission -> f Permission)
-> (([PermissionType] -> f [PermissionType])
-> [PermissionType] -> f [PermissionType])
-> ([PermissionType] -> f [PermissionType])
-> Permission
-> f Permission
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.FromJSON Permission where
parseJSON :: Value -> Parser Permission
parseJSON =
String
-> (Object -> Parser Permission) -> Value -> Parser Permission
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Permission"
( \Object
x ->
Text -> MemberType -> [PermissionType] -> Permission
Permission'
(Text -> MemberType -> [PermissionType] -> Permission)
-> Parser Text
-> Parser (MemberType -> [PermissionType] -> Permission)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GranteeId")
Parser (MemberType -> [PermissionType] -> Permission)
-> Parser MemberType -> Parser ([PermissionType] -> Permission)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser MemberType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GranteeType")
Parser ([PermissionType] -> Permission)
-> Parser [PermissionType] -> Parser Permission
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [PermissionType])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PermissionValues"
Parser (Maybe [PermissionType])
-> [PermissionType] -> Parser [PermissionType]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [PermissionType]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Permission
instance Prelude.NFData Permission