{-# 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.IdentityStore.Types.GroupMembershipExistenceResult
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IdentityStore.Types.GroupMembershipExistenceResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IdentityStore.Types.MemberId
import qualified Amazonka.Prelude as Prelude

-- | Indicates whether a resource is a member of a group in the identity
-- store.
--
-- /See:/ 'newGroupMembershipExistenceResult' smart constructor.
data GroupMembershipExistenceResult = GroupMembershipExistenceResult'
  { -- | The identifier for a group in the identity store.
    GroupMembershipExistenceResult -> Maybe Text
groupId :: Prelude.Maybe Prelude.Text,
    -- | An object that contains the identifier of a group member. Setting the
    -- @UserID@ field to the specific identifier for a user indicates that the
    -- user is a member of the group.
    GroupMembershipExistenceResult -> Maybe MemberId
memberId :: Prelude.Maybe MemberId,
    -- | Indicates whether a membership relation exists or not.
    GroupMembershipExistenceResult -> Maybe (Sensitive Bool)
membershipExists :: Prelude.Maybe (Data.Sensitive Prelude.Bool)
  }
  deriving (GroupMembershipExistenceResult
-> GroupMembershipExistenceResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupMembershipExistenceResult
-> GroupMembershipExistenceResult -> Bool
$c/= :: GroupMembershipExistenceResult
-> GroupMembershipExistenceResult -> Bool
== :: GroupMembershipExistenceResult
-> GroupMembershipExistenceResult -> Bool
$c== :: GroupMembershipExistenceResult
-> GroupMembershipExistenceResult -> Bool
Prelude.Eq, Int -> GroupMembershipExistenceResult -> ShowS
[GroupMembershipExistenceResult] -> ShowS
GroupMembershipExistenceResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupMembershipExistenceResult] -> ShowS
$cshowList :: [GroupMembershipExistenceResult] -> ShowS
show :: GroupMembershipExistenceResult -> String
$cshow :: GroupMembershipExistenceResult -> String
showsPrec :: Int -> GroupMembershipExistenceResult -> ShowS
$cshowsPrec :: Int -> GroupMembershipExistenceResult -> ShowS
Prelude.Show, forall x.
Rep GroupMembershipExistenceResult x
-> GroupMembershipExistenceResult
forall x.
GroupMembershipExistenceResult
-> Rep GroupMembershipExistenceResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GroupMembershipExistenceResult x
-> GroupMembershipExistenceResult
$cfrom :: forall x.
GroupMembershipExistenceResult
-> Rep GroupMembershipExistenceResult x
Prelude.Generic)

-- |
-- Create a value of 'GroupMembershipExistenceResult' 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:
--
-- 'groupId', 'groupMembershipExistenceResult_groupId' - The identifier for a group in the identity store.
--
-- 'memberId', 'groupMembershipExistenceResult_memberId' - An object that contains the identifier of a group member. Setting the
-- @UserID@ field to the specific identifier for a user indicates that the
-- user is a member of the group.
--
-- 'membershipExists', 'groupMembershipExistenceResult_membershipExists' - Indicates whether a membership relation exists or not.
newGroupMembershipExistenceResult ::
  GroupMembershipExistenceResult
newGroupMembershipExistenceResult :: GroupMembershipExistenceResult
newGroupMembershipExistenceResult =
  GroupMembershipExistenceResult'
    { $sel:groupId:GroupMembershipExistenceResult' :: Maybe Text
groupId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:memberId:GroupMembershipExistenceResult' :: Maybe MemberId
memberId = forall a. Maybe a
Prelude.Nothing,
      $sel:membershipExists:GroupMembershipExistenceResult' :: Maybe (Sensitive Bool)
membershipExists = forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier for a group in the identity store.
groupMembershipExistenceResult_groupId :: Lens.Lens' GroupMembershipExistenceResult (Prelude.Maybe Prelude.Text)
groupMembershipExistenceResult_groupId :: Lens' GroupMembershipExistenceResult (Maybe Text)
groupMembershipExistenceResult_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupMembershipExistenceResult' {Maybe Text
groupId :: Maybe Text
$sel:groupId:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe Text
groupId} -> Maybe Text
groupId) (\s :: GroupMembershipExistenceResult
s@GroupMembershipExistenceResult' {} Maybe Text
a -> GroupMembershipExistenceResult
s {$sel:groupId:GroupMembershipExistenceResult' :: Maybe Text
groupId = Maybe Text
a} :: GroupMembershipExistenceResult)

-- | An object that contains the identifier of a group member. Setting the
-- @UserID@ field to the specific identifier for a user indicates that the
-- user is a member of the group.
groupMembershipExistenceResult_memberId :: Lens.Lens' GroupMembershipExistenceResult (Prelude.Maybe MemberId)
groupMembershipExistenceResult_memberId :: Lens' GroupMembershipExistenceResult (Maybe MemberId)
groupMembershipExistenceResult_memberId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupMembershipExistenceResult' {Maybe MemberId
memberId :: Maybe MemberId
$sel:memberId:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe MemberId
memberId} -> Maybe MemberId
memberId) (\s :: GroupMembershipExistenceResult
s@GroupMembershipExistenceResult' {} Maybe MemberId
a -> GroupMembershipExistenceResult
s {$sel:memberId:GroupMembershipExistenceResult' :: Maybe MemberId
memberId = Maybe MemberId
a} :: GroupMembershipExistenceResult)

-- | Indicates whether a membership relation exists or not.
groupMembershipExistenceResult_membershipExists :: Lens.Lens' GroupMembershipExistenceResult (Prelude.Maybe Prelude.Bool)
groupMembershipExistenceResult_membershipExists :: Lens' GroupMembershipExistenceResult (Maybe Bool)
groupMembershipExistenceResult_membershipExists = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupMembershipExistenceResult' {Maybe (Sensitive Bool)
membershipExists :: Maybe (Sensitive Bool)
$sel:membershipExists:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe (Sensitive Bool)
membershipExists} -> Maybe (Sensitive Bool)
membershipExists) (\s :: GroupMembershipExistenceResult
s@GroupMembershipExistenceResult' {} Maybe (Sensitive Bool)
a -> GroupMembershipExistenceResult
s {$sel:membershipExists:GroupMembershipExistenceResult' :: Maybe (Sensitive Bool)
membershipExists = Maybe (Sensitive Bool)
a} :: GroupMembershipExistenceResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON GroupMembershipExistenceResult where
  parseJSON :: Value -> Parser GroupMembershipExistenceResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GroupMembershipExistenceResult"
      ( \Object
x ->
          Maybe Text
-> Maybe MemberId
-> Maybe (Sensitive Bool)
-> GroupMembershipExistenceResult
GroupMembershipExistenceResult'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GroupId")
            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
"MemberId")
            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
"MembershipExists")
      )

instance
  Prelude.Hashable
    GroupMembershipExistenceResult
  where
  hashWithSalt :: Int -> GroupMembershipExistenceResult -> Int
hashWithSalt
    Int
_salt
    GroupMembershipExistenceResult' {Maybe Text
Maybe (Sensitive Bool)
Maybe MemberId
membershipExists :: Maybe (Sensitive Bool)
memberId :: Maybe MemberId
groupId :: Maybe Text
$sel:membershipExists:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe (Sensitive Bool)
$sel:memberId:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe MemberId
$sel:groupId:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MemberId
memberId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Bool)
membershipExists

instance
  Prelude.NFData
    GroupMembershipExistenceResult
  where
  rnf :: GroupMembershipExistenceResult -> ()
rnf GroupMembershipExistenceResult' {Maybe Text
Maybe (Sensitive Bool)
Maybe MemberId
membershipExists :: Maybe (Sensitive Bool)
memberId :: Maybe MemberId
groupId :: Maybe Text
$sel:membershipExists:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe (Sensitive Bool)
$sel:memberId:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe MemberId
$sel:groupId:GroupMembershipExistenceResult' :: GroupMembershipExistenceResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MemberId
memberId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Bool)
membershipExists