{-# 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.Grafana.Types.PermissionEntry where
import qualified Amazonka.Core as Core
import Amazonka.Grafana.Types.Role
import Amazonka.Grafana.Types.User
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PermissionEntry = PermissionEntry'
{
PermissionEntry -> Role
role' :: Role,
PermissionEntry -> User
user :: User
}
deriving (PermissionEntry -> PermissionEntry -> Bool
(PermissionEntry -> PermissionEntry -> Bool)
-> (PermissionEntry -> PermissionEntry -> Bool)
-> Eq PermissionEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PermissionEntry -> PermissionEntry -> Bool
$c/= :: PermissionEntry -> PermissionEntry -> Bool
== :: PermissionEntry -> PermissionEntry -> Bool
$c== :: PermissionEntry -> PermissionEntry -> Bool
Prelude.Eq, ReadPrec [PermissionEntry]
ReadPrec PermissionEntry
Int -> ReadS PermissionEntry
ReadS [PermissionEntry]
(Int -> ReadS PermissionEntry)
-> ReadS [PermissionEntry]
-> ReadPrec PermissionEntry
-> ReadPrec [PermissionEntry]
-> Read PermissionEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PermissionEntry]
$creadListPrec :: ReadPrec [PermissionEntry]
readPrec :: ReadPrec PermissionEntry
$creadPrec :: ReadPrec PermissionEntry
readList :: ReadS [PermissionEntry]
$creadList :: ReadS [PermissionEntry]
readsPrec :: Int -> ReadS PermissionEntry
$creadsPrec :: Int -> ReadS PermissionEntry
Prelude.Read, Int -> PermissionEntry -> ShowS
[PermissionEntry] -> ShowS
PermissionEntry -> String
(Int -> PermissionEntry -> ShowS)
-> (PermissionEntry -> String)
-> ([PermissionEntry] -> ShowS)
-> Show PermissionEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PermissionEntry] -> ShowS
$cshowList :: [PermissionEntry] -> ShowS
show :: PermissionEntry -> String
$cshow :: PermissionEntry -> String
showsPrec :: Int -> PermissionEntry -> ShowS
$cshowsPrec :: Int -> PermissionEntry -> ShowS
Prelude.Show, (forall x. PermissionEntry -> Rep PermissionEntry x)
-> (forall x. Rep PermissionEntry x -> PermissionEntry)
-> Generic PermissionEntry
forall x. Rep PermissionEntry x -> PermissionEntry
forall x. PermissionEntry -> Rep PermissionEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PermissionEntry x -> PermissionEntry
$cfrom :: forall x. PermissionEntry -> Rep PermissionEntry x
Prelude.Generic)
newPermissionEntry ::
Role ->
User ->
PermissionEntry
newPermissionEntry :: Role -> User -> PermissionEntry
newPermissionEntry Role
pRole_ User
pUser_ =
PermissionEntry' :: Role -> User -> PermissionEntry
PermissionEntry' {$sel:role':PermissionEntry' :: Role
role' = Role
pRole_, $sel:user:PermissionEntry' :: User
user = User
pUser_}
permissionEntry_role :: Lens.Lens' PermissionEntry Role
permissionEntry_role :: (Role -> f Role) -> PermissionEntry -> f PermissionEntry
permissionEntry_role = (PermissionEntry -> Role)
-> (PermissionEntry -> Role -> PermissionEntry)
-> Lens PermissionEntry PermissionEntry Role Role
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionEntry' {Role
role' :: Role
$sel:role':PermissionEntry' :: PermissionEntry -> Role
role'} -> Role
role') (\s :: PermissionEntry
s@PermissionEntry' {} Role
a -> PermissionEntry
s {$sel:role':PermissionEntry' :: Role
role' = Role
a} :: PermissionEntry)
permissionEntry_user :: Lens.Lens' PermissionEntry User
permissionEntry_user :: (User -> f User) -> PermissionEntry -> f PermissionEntry
permissionEntry_user = (PermissionEntry -> User)
-> (PermissionEntry -> User -> PermissionEntry)
-> Lens PermissionEntry PermissionEntry User User
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionEntry' {User
user :: User
$sel:user:PermissionEntry' :: PermissionEntry -> User
user} -> User
user) (\s :: PermissionEntry
s@PermissionEntry' {} User
a -> PermissionEntry
s {$sel:user:PermissionEntry' :: User
user = User
a} :: PermissionEntry)
instance Core.FromJSON PermissionEntry where
parseJSON :: Value -> Parser PermissionEntry
parseJSON =
String
-> (Object -> Parser PermissionEntry)
-> Value
-> Parser PermissionEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PermissionEntry"
( \Object
x ->
Role -> User -> PermissionEntry
PermissionEntry'
(Role -> User -> PermissionEntry)
-> Parser Role -> Parser (User -> PermissionEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Role
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"role") Parser (User -> PermissionEntry)
-> Parser User -> Parser PermissionEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser User
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"user")
)
instance Prelude.Hashable PermissionEntry
instance Prelude.NFData PermissionEntry