{-# 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.Group
-- 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.Group 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.ExternalId
import qualified Amazonka.Prelude as Prelude

-- | A group object that contains a specified group’s metadata and
-- attributes.
--
-- /See:/ 'newGroup' smart constructor.
data Group = Group'
  { -- | A string containing a description of the specified group.
    Group -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The group’s display name value. The length limit is 1,024 characters.
    -- This value can consist of letters, accented characters, symbols,
    -- numbers, punctuation, tab, new line, carriage return, space, and
    -- nonbreaking space in this attribute. This value is specified at the time
    -- the group is created and stored as an attribute of the group object in
    -- the identity store.
    Group -> Maybe (Sensitive Text)
displayName :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | A list of @ExternalId@ objects that contains the identifiers issued to
    -- this resource by an external identity provider.
    Group -> Maybe (NonEmpty ExternalId)
externalIds :: Prelude.Maybe (Prelude.NonEmpty ExternalId),
    -- | The identifier for a group in the identity store.
    Group -> Text
groupId :: Prelude.Text,
    -- | The globally unique identifier for the identity store.
    Group -> Text
identityStoreId :: Prelude.Text
  }
  deriving (Group -> Group -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Group -> Group -> Bool
$c/= :: Group -> Group -> Bool
== :: Group -> Group -> Bool
$c== :: Group -> Group -> Bool
Prelude.Eq, Int -> Group -> ShowS
[Group] -> ShowS
Group -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Group] -> ShowS
$cshowList :: [Group] -> ShowS
show :: Group -> String
$cshow :: Group -> String
showsPrec :: Int -> Group -> ShowS
$cshowsPrec :: Int -> Group -> ShowS
Prelude.Show, forall x. Rep Group x -> Group
forall x. Group -> Rep Group x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Group x -> Group
$cfrom :: forall x. Group -> Rep Group x
Prelude.Generic)

-- |
-- Create a value of 'Group' 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:
--
-- 'description', 'group_description' - A string containing a description of the specified group.
--
-- 'displayName', 'group_displayName' - The group’s display name value. The length limit is 1,024 characters.
-- This value can consist of letters, accented characters, symbols,
-- numbers, punctuation, tab, new line, carriage return, space, and
-- nonbreaking space in this attribute. This value is specified at the time
-- the group is created and stored as an attribute of the group object in
-- the identity store.
--
-- 'externalIds', 'group_externalIds' - A list of @ExternalId@ objects that contains the identifiers issued to
-- this resource by an external identity provider.
--
-- 'groupId', 'group_groupId' - The identifier for a group in the identity store.
--
-- 'identityStoreId', 'group_identityStoreId' - The globally unique identifier for the identity store.
newGroup ::
  -- | 'groupId'
  Prelude.Text ->
  -- | 'identityStoreId'
  Prelude.Text ->
  Group
newGroup :: Text -> Text -> Group
newGroup Text
pGroupId_ Text
pIdentityStoreId_ =
  Group'
    { $sel:description:Group' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:Group' :: Maybe (Sensitive Text)
displayName = forall a. Maybe a
Prelude.Nothing,
      $sel:externalIds:Group' :: Maybe (NonEmpty ExternalId)
externalIds = forall a. Maybe a
Prelude.Nothing,
      $sel:groupId:Group' :: Text
groupId = Text
pGroupId_,
      $sel:identityStoreId:Group' :: Text
identityStoreId = Text
pIdentityStoreId_
    }

-- | A string containing a description of the specified group.
group_description :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_description :: Lens' Group (Maybe Text)
group_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:Group' :: Group -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: Group
s@Group' {} Maybe (Sensitive Text)
a -> Group
s {$sel:description:Group' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: Group) 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

-- | The group’s display name value. The length limit is 1,024 characters.
-- This value can consist of letters, accented characters, symbols,
-- numbers, punctuation, tab, new line, carriage return, space, and
-- nonbreaking space in this attribute. This value is specified at the time
-- the group is created and stored as an attribute of the group object in
-- the identity store.
group_displayName :: Lens.Lens' Group (Prelude.Maybe Prelude.Text)
group_displayName :: Lens' Group (Maybe Text)
group_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe (Sensitive Text)
displayName :: Maybe (Sensitive Text)
$sel:displayName:Group' :: Group -> Maybe (Sensitive Text)
displayName} -> Maybe (Sensitive Text)
displayName) (\s :: Group
s@Group' {} Maybe (Sensitive Text)
a -> Group
s {$sel:displayName:Group' :: Maybe (Sensitive Text)
displayName = Maybe (Sensitive Text)
a} :: Group) 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

-- | A list of @ExternalId@ objects that contains the identifiers issued to
-- this resource by an external identity provider.
group_externalIds :: Lens.Lens' Group (Prelude.Maybe (Prelude.NonEmpty ExternalId))
group_externalIds :: Lens' Group (Maybe (NonEmpty ExternalId))
group_externalIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Maybe (NonEmpty ExternalId)
externalIds :: Maybe (NonEmpty ExternalId)
$sel:externalIds:Group' :: Group -> Maybe (NonEmpty ExternalId)
externalIds} -> Maybe (NonEmpty ExternalId)
externalIds) (\s :: Group
s@Group' {} Maybe (NonEmpty ExternalId)
a -> Group
s {$sel:externalIds:Group' :: Maybe (NonEmpty ExternalId)
externalIds = Maybe (NonEmpty ExternalId)
a} :: Group) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The globally unique identifier for the identity store.
group_identityStoreId :: Lens.Lens' Group Prelude.Text
group_identityStoreId :: Lens' Group Text
group_identityStoreId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Text
identityStoreId :: Text
$sel:identityStoreId:Group' :: Group -> Text
identityStoreId} -> Text
identityStoreId) (\s :: Group
s@Group' {} Text
a -> Group
s {$sel:identityStoreId:Group' :: Text
identityStoreId = Text
a} :: Group)

instance Data.FromJSON Group where
  parseJSON :: Value -> Parser Group
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Group"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe (NonEmpty ExternalId)
-> Text
-> Text
-> Group
Group'
            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
"Description")
            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
"DisplayName")
            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
"ExternalIds")
            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
"GroupId")
            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
"IdentityStoreId")
      )

instance Prelude.Hashable Group where
  hashWithSalt :: Int -> Group -> Int
hashWithSalt Int
_salt Group' {Maybe (NonEmpty ExternalId)
Maybe (Sensitive Text)
Text
identityStoreId :: Text
groupId :: Text
externalIds :: Maybe (NonEmpty ExternalId)
displayName :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:identityStoreId:Group' :: Group -> Text
$sel:groupId:Group' :: Group -> Text
$sel:externalIds:Group' :: Group -> Maybe (NonEmpty ExternalId)
$sel:displayName:Group' :: Group -> Maybe (Sensitive Text)
$sel:description:Group' :: Group -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
displayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty ExternalId)
externalIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identityStoreId

instance Prelude.NFData Group where
  rnf :: Group -> ()
rnf Group' {Maybe (NonEmpty ExternalId)
Maybe (Sensitive Text)
Text
identityStoreId :: Text
groupId :: Text
externalIds :: Maybe (NonEmpty ExternalId)
displayName :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:identityStoreId:Group' :: Group -> Text
$sel:groupId:Group' :: Group -> Text
$sel:externalIds:Group' :: Group -> Maybe (NonEmpty ExternalId)
$sel:displayName:Group' :: Group -> Maybe (Sensitive Text)
$sel:description:Group' :: Group -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
displayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty ExternalId)
externalIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
groupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identityStoreId