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

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

-- | Contains information about an IAM group entity.
--
-- This data type is used as a response element in the following
-- operations:
--
-- -   CreateGroup
--
-- -   GetGroup
--
-- -   ListGroups
--
-- /See:/ 'newGroup' smart constructor.
data Group = Group'
  { -- | The path to the group. For more information about paths, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    Group -> Text
path :: Prelude.Text,
    -- | The friendly name that identifies the group.
    Group -> Text
groupName :: Prelude.Text,
    -- | The stable and unique string identifying the group. For more information
    -- about IDs, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    Group -> Text
groupId :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) specifying the group. For more
    -- information about ARNs and how to use them in policies, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    Group -> Text
arn :: Prelude.Text,
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
    -- group was created.
    Group -> ISO8601
createDate :: Data.ISO8601
  }
  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, ReadPrec [Group]
ReadPrec Group
Int -> ReadS Group
ReadS [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
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:
--
-- 'path', 'group_path' - The path to the group. For more information about paths, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'groupName', 'group_groupName' - The friendly name that identifies the group.
--
-- 'groupId', 'group_groupId' - The stable and unique string identifying the group. For more information
-- about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'arn', 'group_arn' - The Amazon Resource Name (ARN) specifying the group. For more
-- information about ARNs and how to use them in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'createDate', 'group_createDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- group was created.
newGroup ::
  -- | 'path'
  Prelude.Text ->
  -- | 'groupName'
  Prelude.Text ->
  -- | 'groupId'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'createDate'
  Prelude.UTCTime ->
  Group
newGroup :: Text -> Text -> Text -> Text -> UTCTime -> Group
newGroup
  Text
pPath_
  Text
pGroupName_
  Text
pGroupId_
  Text
pArn_
  UTCTime
pCreateDate_ =
    Group'
      { $sel:path:Group' :: Text
path = Text
pPath_,
        $sel:groupName:Group' :: Text
groupName = Text
pGroupName_,
        $sel:groupId:Group' :: Text
groupId = Text
pGroupId_,
        $sel:arn:Group' :: Text
arn = Text
pArn_,
        $sel:createDate:Group' :: ISO8601
createDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateDate_
      }

-- | The path to the group. For more information about paths, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
group_path :: Lens.Lens' Group Prelude.Text
group_path :: Lens' Group Text
group_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Text
path :: Text
$sel:path:Group' :: Group -> Text
path} -> Text
path) (\s :: Group
s@Group' {} Text
a -> Group
s {$sel:path:Group' :: Text
path = Text
a} :: Group)

-- | The friendly name that identifies the group.
group_groupName :: Lens.Lens' Group Prelude.Text
group_groupName :: Lens' Group Text
group_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Text
groupName :: Text
$sel:groupName:Group' :: Group -> Text
groupName} -> Text
groupName) (\s :: Group
s@Group' {} Text
a -> Group
s {$sel:groupName:Group' :: Text
groupName = Text
a} :: Group)

-- | The stable and unique string identifying the group. For more information
-- about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
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 Amazon Resource Name (ARN) specifying the group. For more
-- information about ARNs and how to use them in policies, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
group_arn :: Lens.Lens' Group Prelude.Text
group_arn :: Lens' Group Text
group_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {Text
arn :: Text
$sel:arn:Group' :: Group -> Text
arn} -> Text
arn) (\s :: Group
s@Group' {} Text
a -> Group
s {$sel:arn:Group' :: Text
arn = Text
a} :: Group)

-- | The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- group was created.
group_createDate :: Lens.Lens' Group Prelude.UTCTime
group_createDate :: Lens' Group UTCTime
group_createDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Group' {ISO8601
createDate :: ISO8601
$sel:createDate:Group' :: Group -> ISO8601
createDate} -> ISO8601
createDate) (\s :: Group
s@Group' {} ISO8601
a -> Group
s {$sel:createDate:Group' :: ISO8601
createDate = ISO8601
a} :: Group) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromXML Group where
  parseXML :: [Node] -> Either String Group
parseXML [Node]
x =
    Text -> Text -> Text -> Text -> ISO8601 -> Group
Group'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Path")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"GroupName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"GroupId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Arn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"CreateDate")

instance Prelude.Hashable Group where
  hashWithSalt :: Int -> Group -> Int
hashWithSalt Int
_salt Group' {Text
ISO8601
createDate :: ISO8601
arn :: Text
groupId :: Text
groupName :: Text
path :: Text
$sel:createDate:Group' :: Group -> ISO8601
$sel:arn:Group' :: Group -> Text
$sel:groupId:Group' :: Group -> Text
$sel:groupName:Group' :: Group -> Text
$sel:path:Group' :: Group -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
path
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
createDate

instance Prelude.NFData Group where
  rnf :: Group -> ()
rnf Group' {Text
ISO8601
createDate :: ISO8601
arn :: Text
groupId :: Text
groupName :: Text
path :: Text
$sel:createDate:Group' :: Group -> ISO8601
$sel:arn:Group' :: Group -> Text
$sel:groupId:Group' :: Group -> Text
$sel:groupName:Group' :: Group -> Text
$sel:path:Group' :: Group -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
path
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
groupName
      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
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
createDate