{-# 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.Kendra.Types.PersonasSummary
-- 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.Kendra.Types.PersonasSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.Persona
import qualified Amazonka.Prelude as Prelude

-- | Summary information for users or groups in your IAM Identity Center
-- identity source. This applies to users and groups with specific
-- permissions that define their level of access to your Amazon Kendra
-- experience. You can create an Amazon Kendra experience such as a search
-- application. For more information on creating a search application
-- experience, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/deploying-search-experience-no-code.html Building a search experience with no code>.
--
-- /See:/ 'newPersonasSummary' smart constructor.
data PersonasSummary = PersonasSummary'
  { -- | The date-time the summary information was created.
    PersonasSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The identifier of a user or group in your IAM Identity Center identity
    -- source. For example, a user ID could be an email.
    PersonasSummary -> Maybe Text
entityId :: Prelude.Maybe Prelude.Text,
    -- | The persona that defines the specific permissions of the user or group
    -- in your IAM Identity Center identity source. The available personas or
    -- access roles are @Owner@ and @Viewer@. For more information on these
    -- personas, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/deploying-search-experience-no-code.html#access-search-experience Providing access to your search page>.
    PersonasSummary -> Maybe Persona
persona :: Prelude.Maybe Persona,
    -- | The date-time the summary information was last updated.
    PersonasSummary -> Maybe POSIX
updatedAt :: Prelude.Maybe Data.POSIX
  }
  deriving (PersonasSummary -> PersonasSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PersonasSummary -> PersonasSummary -> Bool
$c/= :: PersonasSummary -> PersonasSummary -> Bool
== :: PersonasSummary -> PersonasSummary -> Bool
$c== :: PersonasSummary -> PersonasSummary -> Bool
Prelude.Eq, ReadPrec [PersonasSummary]
ReadPrec PersonasSummary
Int -> ReadS PersonasSummary
ReadS [PersonasSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PersonasSummary]
$creadListPrec :: ReadPrec [PersonasSummary]
readPrec :: ReadPrec PersonasSummary
$creadPrec :: ReadPrec PersonasSummary
readList :: ReadS [PersonasSummary]
$creadList :: ReadS [PersonasSummary]
readsPrec :: Int -> ReadS PersonasSummary
$creadsPrec :: Int -> ReadS PersonasSummary
Prelude.Read, Int -> PersonasSummary -> ShowS
[PersonasSummary] -> ShowS
PersonasSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PersonasSummary] -> ShowS
$cshowList :: [PersonasSummary] -> ShowS
show :: PersonasSummary -> String
$cshow :: PersonasSummary -> String
showsPrec :: Int -> PersonasSummary -> ShowS
$cshowsPrec :: Int -> PersonasSummary -> ShowS
Prelude.Show, forall x. Rep PersonasSummary x -> PersonasSummary
forall x. PersonasSummary -> Rep PersonasSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PersonasSummary x -> PersonasSummary
$cfrom :: forall x. PersonasSummary -> Rep PersonasSummary x
Prelude.Generic)

-- |
-- Create a value of 'PersonasSummary' 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:
--
-- 'createdAt', 'personasSummary_createdAt' - The date-time the summary information was created.
--
-- 'entityId', 'personasSummary_entityId' - The identifier of a user or group in your IAM Identity Center identity
-- source. For example, a user ID could be an email.
--
-- 'persona', 'personasSummary_persona' - The persona that defines the specific permissions of the user or group
-- in your IAM Identity Center identity source. The available personas or
-- access roles are @Owner@ and @Viewer@. For more information on these
-- personas, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/deploying-search-experience-no-code.html#access-search-experience Providing access to your search page>.
--
-- 'updatedAt', 'personasSummary_updatedAt' - The date-time the summary information was last updated.
newPersonasSummary ::
  PersonasSummary
newPersonasSummary :: PersonasSummary
newPersonasSummary =
  PersonasSummary'
    { $sel:createdAt:PersonasSummary' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:entityId:PersonasSummary' :: Maybe Text
entityId = forall a. Maybe a
Prelude.Nothing,
      $sel:persona:PersonasSummary' :: Maybe Persona
persona = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:PersonasSummary' :: Maybe POSIX
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The date-time the summary information was created.
personasSummary_createdAt :: Lens.Lens' PersonasSummary (Prelude.Maybe Prelude.UTCTime)
personasSummary_createdAt :: Lens' PersonasSummary (Maybe UTCTime)
personasSummary_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonasSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:PersonasSummary' :: PersonasSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: PersonasSummary
s@PersonasSummary' {} Maybe POSIX
a -> PersonasSummary
s {$sel:createdAt:PersonasSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: PersonasSummary) 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 :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The identifier of a user or group in your IAM Identity Center identity
-- source. For example, a user ID could be an email.
personasSummary_entityId :: Lens.Lens' PersonasSummary (Prelude.Maybe Prelude.Text)
personasSummary_entityId :: Lens' PersonasSummary (Maybe Text)
personasSummary_entityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonasSummary' {Maybe Text
entityId :: Maybe Text
$sel:entityId:PersonasSummary' :: PersonasSummary -> Maybe Text
entityId} -> Maybe Text
entityId) (\s :: PersonasSummary
s@PersonasSummary' {} Maybe Text
a -> PersonasSummary
s {$sel:entityId:PersonasSummary' :: Maybe Text
entityId = Maybe Text
a} :: PersonasSummary)

-- | The persona that defines the specific permissions of the user or group
-- in your IAM Identity Center identity source. The available personas or
-- access roles are @Owner@ and @Viewer@. For more information on these
-- personas, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/deploying-search-experience-no-code.html#access-search-experience Providing access to your search page>.
personasSummary_persona :: Lens.Lens' PersonasSummary (Prelude.Maybe Persona)
personasSummary_persona :: Lens' PersonasSummary (Maybe Persona)
personasSummary_persona = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonasSummary' {Maybe Persona
persona :: Maybe Persona
$sel:persona:PersonasSummary' :: PersonasSummary -> Maybe Persona
persona} -> Maybe Persona
persona) (\s :: PersonasSummary
s@PersonasSummary' {} Maybe Persona
a -> PersonasSummary
s {$sel:persona:PersonasSummary' :: Maybe Persona
persona = Maybe Persona
a} :: PersonasSummary)

-- | The date-time the summary information was last updated.
personasSummary_updatedAt :: Lens.Lens' PersonasSummary (Prelude.Maybe Prelude.UTCTime)
personasSummary_updatedAt :: Lens' PersonasSummary (Maybe UTCTime)
personasSummary_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PersonasSummary' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:PersonasSummary' :: PersonasSummary -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: PersonasSummary
s@PersonasSummary' {} Maybe POSIX
a -> PersonasSummary
s {$sel:updatedAt:PersonasSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: PersonasSummary) 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 :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON PersonasSummary where
  parseJSON :: Value -> Parser PersonasSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PersonasSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text -> Maybe Persona -> Maybe POSIX -> PersonasSummary
PersonasSummary'
            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
"CreatedAt")
            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
"EntityId")
            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
"Persona")
            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
"UpdatedAt")
      )

instance Prelude.Hashable PersonasSummary where
  hashWithSalt :: Int -> PersonasSummary -> Int
hashWithSalt Int
_salt PersonasSummary' {Maybe Text
Maybe POSIX
Maybe Persona
updatedAt :: Maybe POSIX
persona :: Maybe Persona
entityId :: Maybe Text
createdAt :: Maybe POSIX
$sel:updatedAt:PersonasSummary' :: PersonasSummary -> Maybe POSIX
$sel:persona:PersonasSummary' :: PersonasSummary -> Maybe Persona
$sel:entityId:PersonasSummary' :: PersonasSummary -> Maybe Text
$sel:createdAt:PersonasSummary' :: PersonasSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
entityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Persona
persona
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updatedAt

instance Prelude.NFData PersonasSummary where
  rnf :: PersonasSummary -> ()
rnf PersonasSummary' {Maybe Text
Maybe POSIX
Maybe Persona
updatedAt :: Maybe POSIX
persona :: Maybe Persona
entityId :: Maybe Text
createdAt :: Maybe POSIX
$sel:updatedAt:PersonasSummary' :: PersonasSummary -> Maybe POSIX
$sel:persona:PersonasSummary' :: PersonasSummary -> Maybe Persona
$sel:entityId:PersonasSummary' :: PersonasSummary -> Maybe Text
$sel:createdAt:PersonasSummary' :: PersonasSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
entityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Persona
persona
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updatedAt