{-# 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.FailedEntity
-- 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.FailedEntity 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

-- | Information on the users or groups in your IAM Identity Center identity
-- source that failed to properly configure with your Amazon Kendra
-- experience.
--
-- /See:/ 'newFailedEntity' smart constructor.
data FailedEntity = FailedEntity'
  { -- | The identifier of the user or group in your IAM Identity Center identity
    -- source. For example, a user ID could be an email.
    FailedEntity -> Maybe Text
entityId :: Prelude.Maybe Prelude.Text,
    -- | The reason the user or group in your IAM Identity Center identity source
    -- failed to properly configure with your Amazon Kendra experience.
    FailedEntity -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (FailedEntity -> FailedEntity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailedEntity -> FailedEntity -> Bool
$c/= :: FailedEntity -> FailedEntity -> Bool
== :: FailedEntity -> FailedEntity -> Bool
$c== :: FailedEntity -> FailedEntity -> Bool
Prelude.Eq, ReadPrec [FailedEntity]
ReadPrec FailedEntity
Int -> ReadS FailedEntity
ReadS [FailedEntity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailedEntity]
$creadListPrec :: ReadPrec [FailedEntity]
readPrec :: ReadPrec FailedEntity
$creadPrec :: ReadPrec FailedEntity
readList :: ReadS [FailedEntity]
$creadList :: ReadS [FailedEntity]
readsPrec :: Int -> ReadS FailedEntity
$creadsPrec :: Int -> ReadS FailedEntity
Prelude.Read, Int -> FailedEntity -> ShowS
[FailedEntity] -> ShowS
FailedEntity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailedEntity] -> ShowS
$cshowList :: [FailedEntity] -> ShowS
show :: FailedEntity -> String
$cshow :: FailedEntity -> String
showsPrec :: Int -> FailedEntity -> ShowS
$cshowsPrec :: Int -> FailedEntity -> ShowS
Prelude.Show, forall x. Rep FailedEntity x -> FailedEntity
forall x. FailedEntity -> Rep FailedEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailedEntity x -> FailedEntity
$cfrom :: forall x. FailedEntity -> Rep FailedEntity x
Prelude.Generic)

-- |
-- Create a value of 'FailedEntity' 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:
--
-- 'entityId', 'failedEntity_entityId' - The identifier of the user or group in your IAM Identity Center identity
-- source. For example, a user ID could be an email.
--
-- 'errorMessage', 'failedEntity_errorMessage' - The reason the user or group in your IAM Identity Center identity source
-- failed to properly configure with your Amazon Kendra experience.
newFailedEntity ::
  FailedEntity
newFailedEntity :: FailedEntity
newFailedEntity =
  FailedEntity'
    { $sel:entityId:FailedEntity' :: Maybe Text
entityId = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:FailedEntity' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The reason the user or group in your IAM Identity Center identity source
-- failed to properly configure with your Amazon Kendra experience.
failedEntity_errorMessage :: Lens.Lens' FailedEntity (Prelude.Maybe Prelude.Text)
failedEntity_errorMessage :: Lens' FailedEntity (Maybe Text)
failedEntity_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedEntity' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:FailedEntity' :: FailedEntity -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: FailedEntity
s@FailedEntity' {} Maybe Text
a -> FailedEntity
s {$sel:errorMessage:FailedEntity' :: Maybe Text
errorMessage = Maybe Text
a} :: FailedEntity)

instance Data.FromJSON FailedEntity where
  parseJSON :: Value -> Parser FailedEntity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FailedEntity"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> FailedEntity
FailedEntity'
            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
"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
"ErrorMessage")
      )

instance Prelude.Hashable FailedEntity where
  hashWithSalt :: Int -> FailedEntity -> Int
hashWithSalt Int
_salt FailedEntity' {Maybe Text
errorMessage :: Maybe Text
entityId :: Maybe Text
$sel:errorMessage:FailedEntity' :: FailedEntity -> Maybe Text
$sel:entityId:FailedEntity' :: FailedEntity -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
entityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage

instance Prelude.NFData FailedEntity where
  rnf :: FailedEntity -> ()
rnf FailedEntity' {Maybe Text
errorMessage :: Maybe Text
entityId :: Maybe Text
$sel:errorMessage:FailedEntity' :: FailedEntity -> Maybe Text
$sel:entityId:FailedEntity' :: FailedEntity -> Maybe Text
..} =
    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 Text
errorMessage