{-# 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.Chime.Types.CreateAttendeeError
-- 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.Chime.Types.CreateAttendeeError where

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

-- | The list of errors returned when errors are encountered during the
-- BatchCreateAttendee and CreateAttendee actions. This includes external
-- user IDs, error codes, and error messages.
--
-- /See:/ 'newCreateAttendeeError' smart constructor.
data CreateAttendeeError = CreateAttendeeError'
  { -- | The error code.
    CreateAttendeeError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message.
    CreateAttendeeError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Chime SDK external user ID. An idempotency token. Links the
    -- attendee to an identity managed by a builder application.
    CreateAttendeeError -> Maybe (Sensitive Text)
externalUserId :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (CreateAttendeeError -> CreateAttendeeError -> Bool
(CreateAttendeeError -> CreateAttendeeError -> Bool)
-> (CreateAttendeeError -> CreateAttendeeError -> Bool)
-> Eq CreateAttendeeError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAttendeeError -> CreateAttendeeError -> Bool
$c/= :: CreateAttendeeError -> CreateAttendeeError -> Bool
== :: CreateAttendeeError -> CreateAttendeeError -> Bool
$c== :: CreateAttendeeError -> CreateAttendeeError -> Bool
Prelude.Eq, Int -> CreateAttendeeError -> ShowS
[CreateAttendeeError] -> ShowS
CreateAttendeeError -> String
(Int -> CreateAttendeeError -> ShowS)
-> (CreateAttendeeError -> String)
-> ([CreateAttendeeError] -> ShowS)
-> Show CreateAttendeeError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAttendeeError] -> ShowS
$cshowList :: [CreateAttendeeError] -> ShowS
show :: CreateAttendeeError -> String
$cshow :: CreateAttendeeError -> String
showsPrec :: Int -> CreateAttendeeError -> ShowS
$cshowsPrec :: Int -> CreateAttendeeError -> ShowS
Prelude.Show, (forall x. CreateAttendeeError -> Rep CreateAttendeeError x)
-> (forall x. Rep CreateAttendeeError x -> CreateAttendeeError)
-> Generic CreateAttendeeError
forall x. Rep CreateAttendeeError x -> CreateAttendeeError
forall x. CreateAttendeeError -> Rep CreateAttendeeError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAttendeeError x -> CreateAttendeeError
$cfrom :: forall x. CreateAttendeeError -> Rep CreateAttendeeError x
Prelude.Generic)

-- |
-- Create a value of 'CreateAttendeeError' 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:
--
-- 'errorCode', 'createAttendeeError_errorCode' - The error code.
--
-- 'errorMessage', 'createAttendeeError_errorMessage' - The error message.
--
-- 'externalUserId', 'createAttendeeError_externalUserId' - The Amazon Chime SDK external user ID. An idempotency token. Links the
-- attendee to an identity managed by a builder application.
newCreateAttendeeError ::
  CreateAttendeeError
newCreateAttendeeError :: CreateAttendeeError
newCreateAttendeeError =
  CreateAttendeeError' :: Maybe Text
-> Maybe Text -> Maybe (Sensitive Text) -> CreateAttendeeError
CreateAttendeeError'
    { $sel:errorCode:CreateAttendeeError' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:CreateAttendeeError' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:externalUserId:CreateAttendeeError' :: Maybe (Sensitive Text)
externalUserId = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
createAttendeeError_errorCode :: Lens.Lens' CreateAttendeeError (Prelude.Maybe Prelude.Text)
createAttendeeError_errorCode :: (Maybe Text -> f (Maybe Text))
-> CreateAttendeeError -> f CreateAttendeeError
createAttendeeError_errorCode = (CreateAttendeeError -> Maybe Text)
-> (CreateAttendeeError -> Maybe Text -> CreateAttendeeError)
-> Lens
     CreateAttendeeError CreateAttendeeError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeError' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:CreateAttendeeError' :: CreateAttendeeError -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: CreateAttendeeError
s@CreateAttendeeError' {} Maybe Text
a -> CreateAttendeeError
s {$sel:errorCode:CreateAttendeeError' :: Maybe Text
errorCode = Maybe Text
a} :: CreateAttendeeError)

-- | The error message.
createAttendeeError_errorMessage :: Lens.Lens' CreateAttendeeError (Prelude.Maybe Prelude.Text)
createAttendeeError_errorMessage :: (Maybe Text -> f (Maybe Text))
-> CreateAttendeeError -> f CreateAttendeeError
createAttendeeError_errorMessage = (CreateAttendeeError -> Maybe Text)
-> (CreateAttendeeError -> Maybe Text -> CreateAttendeeError)
-> Lens
     CreateAttendeeError CreateAttendeeError (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:CreateAttendeeError' :: CreateAttendeeError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: CreateAttendeeError
s@CreateAttendeeError' {} Maybe Text
a -> CreateAttendeeError
s {$sel:errorMessage:CreateAttendeeError' :: Maybe Text
errorMessage = Maybe Text
a} :: CreateAttendeeError)

-- | The Amazon Chime SDK external user ID. An idempotency token. Links the
-- attendee to an identity managed by a builder application.
createAttendeeError_externalUserId :: Lens.Lens' CreateAttendeeError (Prelude.Maybe Prelude.Text)
createAttendeeError_externalUserId :: (Maybe Text -> f (Maybe Text))
-> CreateAttendeeError -> f CreateAttendeeError
createAttendeeError_externalUserId = (CreateAttendeeError -> Maybe (Sensitive Text))
-> (CreateAttendeeError
    -> Maybe (Sensitive Text) -> CreateAttendeeError)
-> Lens
     CreateAttendeeError
     CreateAttendeeError
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAttendeeError' {Maybe (Sensitive Text)
externalUserId :: Maybe (Sensitive Text)
$sel:externalUserId:CreateAttendeeError' :: CreateAttendeeError -> Maybe (Sensitive Text)
externalUserId} -> Maybe (Sensitive Text)
externalUserId) (\s :: CreateAttendeeError
s@CreateAttendeeError' {} Maybe (Sensitive Text)
a -> CreateAttendeeError
s {$sel:externalUserId:CreateAttendeeError' :: Maybe (Sensitive Text)
externalUserId = Maybe (Sensitive Text)
a} :: CreateAttendeeError) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateAttendeeError -> f CreateAttendeeError)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateAttendeeError
-> f CreateAttendeeError
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON CreateAttendeeError where
  parseJSON :: Value -> Parser CreateAttendeeError
parseJSON =
    String
-> (Object -> Parser CreateAttendeeError)
-> Value
-> Parser CreateAttendeeError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CreateAttendeeError"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe (Sensitive Text) -> CreateAttendeeError
CreateAttendeeError'
            (Maybe Text
 -> Maybe Text -> Maybe (Sensitive Text) -> CreateAttendeeError)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe (Sensitive Text) -> CreateAttendeeError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
            Parser
  (Maybe Text -> Maybe (Sensitive Text) -> CreateAttendeeError)
-> Parser (Maybe Text)
-> Parser (Maybe (Sensitive Text) -> CreateAttendeeError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorMessage")
            Parser (Maybe (Sensitive Text) -> CreateAttendeeError)
-> Parser (Maybe (Sensitive Text)) -> Parser CreateAttendeeError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExternalUserId")
      )

instance Prelude.Hashable CreateAttendeeError

instance Prelude.NFData CreateAttendeeError