{-# 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.AccessAnalyzer.Types.AclGrantee where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AclGrantee = AclGrantee'
{
AclGrantee -> Maybe Text
uri :: Prelude.Maybe Prelude.Text,
AclGrantee -> Maybe Text
id :: Prelude.Maybe Prelude.Text
}
deriving (AclGrantee -> AclGrantee -> Bool
(AclGrantee -> AclGrantee -> Bool)
-> (AclGrantee -> AclGrantee -> Bool) -> Eq AclGrantee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AclGrantee -> AclGrantee -> Bool
$c/= :: AclGrantee -> AclGrantee -> Bool
== :: AclGrantee -> AclGrantee -> Bool
$c== :: AclGrantee -> AclGrantee -> Bool
Prelude.Eq, ReadPrec [AclGrantee]
ReadPrec AclGrantee
Int -> ReadS AclGrantee
ReadS [AclGrantee]
(Int -> ReadS AclGrantee)
-> ReadS [AclGrantee]
-> ReadPrec AclGrantee
-> ReadPrec [AclGrantee]
-> Read AclGrantee
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AclGrantee]
$creadListPrec :: ReadPrec [AclGrantee]
readPrec :: ReadPrec AclGrantee
$creadPrec :: ReadPrec AclGrantee
readList :: ReadS [AclGrantee]
$creadList :: ReadS [AclGrantee]
readsPrec :: Int -> ReadS AclGrantee
$creadsPrec :: Int -> ReadS AclGrantee
Prelude.Read, Int -> AclGrantee -> ShowS
[AclGrantee] -> ShowS
AclGrantee -> String
(Int -> AclGrantee -> ShowS)
-> (AclGrantee -> String)
-> ([AclGrantee] -> ShowS)
-> Show AclGrantee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AclGrantee] -> ShowS
$cshowList :: [AclGrantee] -> ShowS
show :: AclGrantee -> String
$cshow :: AclGrantee -> String
showsPrec :: Int -> AclGrantee -> ShowS
$cshowsPrec :: Int -> AclGrantee -> ShowS
Prelude.Show, (forall x. AclGrantee -> Rep AclGrantee x)
-> (forall x. Rep AclGrantee x -> AclGrantee) -> Generic AclGrantee
forall x. Rep AclGrantee x -> AclGrantee
forall x. AclGrantee -> Rep AclGrantee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AclGrantee x -> AclGrantee
$cfrom :: forall x. AclGrantee -> Rep AclGrantee x
Prelude.Generic)
newAclGrantee ::
AclGrantee
newAclGrantee :: AclGrantee
newAclGrantee =
AclGrantee' :: Maybe Text -> Maybe Text -> AclGrantee
AclGrantee'
{ $sel:uri:AclGrantee' :: Maybe Text
uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:AclGrantee' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
aclGrantee_uri :: Lens.Lens' AclGrantee (Prelude.Maybe Prelude.Text)
aclGrantee_uri :: (Maybe Text -> f (Maybe Text)) -> AclGrantee -> f AclGrantee
aclGrantee_uri = (AclGrantee -> Maybe Text)
-> (AclGrantee -> Maybe Text -> AclGrantee)
-> Lens AclGrantee AclGrantee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AclGrantee' {Maybe Text
uri :: Maybe Text
$sel:uri:AclGrantee' :: AclGrantee -> Maybe Text
uri} -> Maybe Text
uri) (\s :: AclGrantee
s@AclGrantee' {} Maybe Text
a -> AclGrantee
s {$sel:uri:AclGrantee' :: Maybe Text
uri = Maybe Text
a} :: AclGrantee)
aclGrantee_id :: Lens.Lens' AclGrantee (Prelude.Maybe Prelude.Text)
aclGrantee_id :: (Maybe Text -> f (Maybe Text)) -> AclGrantee -> f AclGrantee
aclGrantee_id = (AclGrantee -> Maybe Text)
-> (AclGrantee -> Maybe Text -> AclGrantee)
-> Lens AclGrantee AclGrantee (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AclGrantee' {Maybe Text
id :: Maybe Text
$sel:id:AclGrantee' :: AclGrantee -> Maybe Text
id} -> Maybe Text
id) (\s :: AclGrantee
s@AclGrantee' {} Maybe Text
a -> AclGrantee
s {$sel:id:AclGrantee' :: Maybe Text
id = Maybe Text
a} :: AclGrantee)
instance Core.FromJSON AclGrantee where
parseJSON :: Value -> Parser AclGrantee
parseJSON =
String
-> (Object -> Parser AclGrantee) -> Value -> Parser AclGrantee
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AclGrantee"
( \Object
x ->
Maybe Text -> Maybe Text -> AclGrantee
AclGrantee'
(Maybe Text -> Maybe Text -> AclGrantee)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AclGrantee)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"uri") Parser (Maybe Text -> AclGrantee)
-> Parser (Maybe Text) -> Parser AclGrantee
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
)
instance Prelude.Hashable AclGrantee
instance Prelude.NFData AclGrantee
instance Core.ToJSON AclGrantee where
toJSON :: AclGrantee -> Value
toJSON AclGrantee' {Maybe Text
id :: Maybe Text
uri :: Maybe Text
$sel:id:AclGrantee' :: AclGrantee -> Maybe Text
$sel:uri:AclGrantee' :: AclGrantee -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
uri,
(Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id
]
)