{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:granteeId:Permission' :: Text
granteeId = Text
pGranteeId_,
$sel:granteeType:Permission' :: MemberType
granteeType = MemberType
pGranteeType_,
$sel:permissionValues:Permission' :: [PermissionType]
permissionValues = forall a. Monoid a => a
Prelude.mempty
}
permission_granteeId :: Lens.Lens' Permission Prelude.Text
permission_granteeId :: Lens' Permission Text
permission_granteeId = 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 :: Lens' Permission MemberType
permission_granteeType = 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 :: Lens' Permission [PermissionType]
permission_permissionValues = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Permission where
parseJSON :: Value -> Parser Permission
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Permission"
( \Object
x ->
Text -> MemberType -> [PermissionType] -> Permission
Permission'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"GranteeId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"GranteeType")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PermissionValues"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable Permission where
hashWithSalt :: Int -> Permission -> Int
hashWithSalt Int
_salt Permission' {[PermissionType]
Text
MemberType
permissionValues :: [PermissionType]
granteeType :: MemberType
granteeId :: Text
$sel:permissionValues:Permission' :: Permission -> [PermissionType]
$sel:granteeType:Permission' :: Permission -> MemberType
$sel:granteeId:Permission' :: Permission -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
granteeId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MemberType
granteeType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [PermissionType]
permissionValues
instance Prelude.NFData Permission where
rnf :: Permission -> ()
rnf Permission' {[PermissionType]
Text
MemberType
permissionValues :: [PermissionType]
granteeType :: MemberType
granteeId :: Text
$sel:permissionValues:Permission' :: Permission -> [PermissionType]
$sel:granteeType:Permission' :: Permission -> MemberType
$sel:granteeId:Permission' :: Permission -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
granteeId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MemberType
granteeType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [PermissionType]
permissionValues