{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QuickSight.Types.GroupMember
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QuickSight.Types.GroupMember where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A member of an Amazon QuickSight group. Currently, group members must be
-- users. Groups can\'t be members of another group. .
--
-- /See:/ 'newGroupMember' smart constructor.
data GroupMember = GroupMember'
  { -- | The name of the group member (user).
    GroupMember -> Maybe Text
memberName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the group member (user).
    GroupMember -> Maybe Text
arn :: Prelude.Maybe Prelude.Text
  }
  deriving (GroupMember -> GroupMember -> Bool
(GroupMember -> GroupMember -> Bool)
-> (GroupMember -> GroupMember -> Bool) -> Eq GroupMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupMember -> GroupMember -> Bool
$c/= :: GroupMember -> GroupMember -> Bool
== :: GroupMember -> GroupMember -> Bool
$c== :: GroupMember -> GroupMember -> Bool
Prelude.Eq, ReadPrec [GroupMember]
ReadPrec GroupMember
Int -> ReadS GroupMember
ReadS [GroupMember]
(Int -> ReadS GroupMember)
-> ReadS [GroupMember]
-> ReadPrec GroupMember
-> ReadPrec [GroupMember]
-> Read GroupMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupMember]
$creadListPrec :: ReadPrec [GroupMember]
readPrec :: ReadPrec GroupMember
$creadPrec :: ReadPrec GroupMember
readList :: ReadS [GroupMember]
$creadList :: ReadS [GroupMember]
readsPrec :: Int -> ReadS GroupMember
$creadsPrec :: Int -> ReadS GroupMember
Prelude.Read, Int -> GroupMember -> ShowS
[GroupMember] -> ShowS
GroupMember -> String
(Int -> GroupMember -> ShowS)
-> (GroupMember -> String)
-> ([GroupMember] -> ShowS)
-> Show GroupMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupMember] -> ShowS
$cshowList :: [GroupMember] -> ShowS
show :: GroupMember -> String
$cshow :: GroupMember -> String
showsPrec :: Int -> GroupMember -> ShowS
$cshowsPrec :: Int -> GroupMember -> ShowS
Prelude.Show, (forall x. GroupMember -> Rep GroupMember x)
-> (forall x. Rep GroupMember x -> GroupMember)
-> Generic GroupMember
forall x. Rep GroupMember x -> GroupMember
forall x. GroupMember -> Rep GroupMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GroupMember x -> GroupMember
$cfrom :: forall x. GroupMember -> Rep GroupMember x
Prelude.Generic)

-- |
-- Create a value of 'GroupMember' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'memberName', 'groupMember_memberName' - The name of the group member (user).
--
-- 'arn', 'groupMember_arn' - The Amazon Resource Name (ARN) for the group member (user).
newGroupMember ::
  GroupMember
newGroupMember :: GroupMember
newGroupMember =
  GroupMember' :: Maybe Text -> Maybe Text -> GroupMember
GroupMember'
    { $sel:memberName:GroupMember' :: Maybe Text
memberName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:GroupMember' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the group member (user).
groupMember_memberName :: Lens.Lens' GroupMember (Prelude.Maybe Prelude.Text)
groupMember_memberName :: (Maybe Text -> f (Maybe Text)) -> GroupMember -> f GroupMember
groupMember_memberName = (GroupMember -> Maybe Text)
-> (GroupMember -> Maybe Text -> GroupMember)
-> Lens GroupMember GroupMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupMember' {Maybe Text
memberName :: Maybe Text
$sel:memberName:GroupMember' :: GroupMember -> Maybe Text
memberName} -> Maybe Text
memberName) (\s :: GroupMember
s@GroupMember' {} Maybe Text
a -> GroupMember
s {$sel:memberName:GroupMember' :: Maybe Text
memberName = Maybe Text
a} :: GroupMember)

-- | The Amazon Resource Name (ARN) for the group member (user).
groupMember_arn :: Lens.Lens' GroupMember (Prelude.Maybe Prelude.Text)
groupMember_arn :: (Maybe Text -> f (Maybe Text)) -> GroupMember -> f GroupMember
groupMember_arn = (GroupMember -> Maybe Text)
-> (GroupMember -> Maybe Text -> GroupMember)
-> Lens GroupMember GroupMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupMember' {Maybe Text
arn :: Maybe Text
$sel:arn:GroupMember' :: GroupMember -> Maybe Text
arn} -> Maybe Text
arn) (\s :: GroupMember
s@GroupMember' {} Maybe Text
a -> GroupMember
s {$sel:arn:GroupMember' :: Maybe Text
arn = Maybe Text
a} :: GroupMember)

instance Core.FromJSON GroupMember where
  parseJSON :: Value -> Parser GroupMember
parseJSON =
    String
-> (Object -> Parser GroupMember) -> Value -> Parser GroupMember
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GroupMember"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> GroupMember
GroupMember'
            (Maybe Text -> Maybe Text -> GroupMember)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GroupMember)
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
"MemberName")
            Parser (Maybe Text -> GroupMember)
-> Parser (Maybe Text) -> Parser GroupMember
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
"Arn")
      )

instance Prelude.Hashable GroupMember

instance Prelude.NFData GroupMember