{-# 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-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.IdentityStore.Types.Group where

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

-- | A group object, which contains a specified group’s metadata and
-- attributes.
--
-- /See:/ 'newGroup' smart constructor.
data Group = Group'
  { -- | The identifier for a group in the identity store.
    Group -> Text
groupId :: Prelude.Text,
    -- | Contains 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. The characters @\<>;:%@ are
    -- excluded. 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 -> Text
displayName :: Prelude.Text
  }
  deriving (Group -> Group -> Bool
(Group -> Group -> Bool) -> (Group -> Group -> Bool) -> Eq Group
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, ReadPrec [Group]
ReadPrec Group
Int -> ReadS Group
ReadS [Group]
(Int -> ReadS Group)
-> ReadS [Group]
-> ReadPrec Group
-> ReadPrec [Group]
-> Read Group
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Group]
$creadListPrec :: ReadPrec [Group]
readPrec :: ReadPrec Group
$creadPrec :: ReadPrec Group
readList :: ReadS [Group]
$creadList :: ReadS [Group]
readsPrec :: Int -> ReadS Group
$creadsPrec :: Int -> ReadS Group
Prelude.Read, Int -> Group -> ShowS
[Group] -> ShowS
Group -> String
(Int -> Group -> ShowS)
-> (Group -> String) -> ([Group] -> ShowS) -> Show Group
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. Group -> Rep Group x)
-> (forall x. Rep Group x -> Group) -> Generic Group
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:
--
-- 'groupId', 'group_groupId' - The identifier for a group in the identity store.
--
-- 'displayName', 'group_displayName' - Contains 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. The characters @\<>;:%@ are
-- excluded. This value is specified at the time the group is created and
-- stored as an attribute of the group object in the identity store.
newGroup ::
  -- | 'groupId'
  Prelude.Text ->
  -- | 'displayName'
  Prelude.Text ->
  Group
newGroup :: Text -> Text -> Group
newGroup Text
pGroupId_ Text
pDisplayName_ =
  Group' :: Text -> Text -> Group
Group'
    { $sel:groupId:Group' :: Text
groupId = Text
pGroupId_,
      $sel:displayName:Group' :: Text
displayName = Text
pDisplayName_
    }

-- | The identifier for a group in the identity store.
group_groupId :: Lens.Lens' Group Prelude.Text
group_groupId :: (Text -> f Text) -> Group -> f Group
group_groupId = (Group -> Text)
-> (Group -> Text -> Group) -> Lens Group Group Text Text
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)

-- | Contains 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. The characters @\<>;:%@ are
-- excluded. 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.Text
group_displayName :: (Text -> f Text) -> Group -> f Group
group_displayName = (Group -> Text)
-> (Group -> Text -> Group) -> Lens Group Group Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Text
displayName :: Text
$sel:displayName:Group' :: Group -> Text
displayName} -> Text
displayName) (\s :: Group
s@Group' {} Text
a -> Group
s {$sel:displayName:Group' :: Text
displayName = Text
a} :: Group)

instance Core.FromJSON Group where
  parseJSON :: Value -> Parser Group
parseJSON =
    String -> (Object -> Parser Group) -> Value -> Parser Group
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Group"
      ( \Object
x ->
          Text -> Text -> Group
Group'
            (Text -> Text -> Group) -> Parser Text -> Parser (Text -> Group)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GroupId")
            Parser (Text -> Group) -> Parser Text -> Parser Group
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DisplayName")
      )

instance Prelude.Hashable Group

instance Prelude.NFData Group