{-# 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.CognitoIdentity.Types.UnprocessedIdentityId
-- 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.CognitoIdentity.Types.UnprocessedIdentityId where

import Amazonka.CognitoIdentity.Types.CognitoErrorCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An array of UnprocessedIdentityId objects, each of which contains an
-- ErrorCode and IdentityId.
--
-- /See:/ 'newUnprocessedIdentityId' smart constructor.
data UnprocessedIdentityId = UnprocessedIdentityId'
  { -- | The error code indicating the type of error that occurred.
    UnprocessedIdentityId -> Maybe CognitoErrorCode
errorCode :: Prelude.Maybe CognitoErrorCode,
    -- | A unique identifier in the format REGION:GUID.
    UnprocessedIdentityId -> Maybe Text
identityId :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
(UnprocessedIdentityId -> UnprocessedIdentityId -> Bool)
-> (UnprocessedIdentityId -> UnprocessedIdentityId -> Bool)
-> Eq UnprocessedIdentityId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
$c/= :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
== :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
$c== :: UnprocessedIdentityId -> UnprocessedIdentityId -> Bool
Prelude.Eq, ReadPrec [UnprocessedIdentityId]
ReadPrec UnprocessedIdentityId
Int -> ReadS UnprocessedIdentityId
ReadS [UnprocessedIdentityId]
(Int -> ReadS UnprocessedIdentityId)
-> ReadS [UnprocessedIdentityId]
-> ReadPrec UnprocessedIdentityId
-> ReadPrec [UnprocessedIdentityId]
-> Read UnprocessedIdentityId
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedIdentityId]
$creadListPrec :: ReadPrec [UnprocessedIdentityId]
readPrec :: ReadPrec UnprocessedIdentityId
$creadPrec :: ReadPrec UnprocessedIdentityId
readList :: ReadS [UnprocessedIdentityId]
$creadList :: ReadS [UnprocessedIdentityId]
readsPrec :: Int -> ReadS UnprocessedIdentityId
$creadsPrec :: Int -> ReadS UnprocessedIdentityId
Prelude.Read, Int -> UnprocessedIdentityId -> ShowS
[UnprocessedIdentityId] -> ShowS
UnprocessedIdentityId -> String
(Int -> UnprocessedIdentityId -> ShowS)
-> (UnprocessedIdentityId -> String)
-> ([UnprocessedIdentityId] -> ShowS)
-> Show UnprocessedIdentityId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedIdentityId] -> ShowS
$cshowList :: [UnprocessedIdentityId] -> ShowS
show :: UnprocessedIdentityId -> String
$cshow :: UnprocessedIdentityId -> String
showsPrec :: Int -> UnprocessedIdentityId -> ShowS
$cshowsPrec :: Int -> UnprocessedIdentityId -> ShowS
Prelude.Show, (forall x. UnprocessedIdentityId -> Rep UnprocessedIdentityId x)
-> (forall x. Rep UnprocessedIdentityId x -> UnprocessedIdentityId)
-> Generic UnprocessedIdentityId
forall x. Rep UnprocessedIdentityId x -> UnprocessedIdentityId
forall x. UnprocessedIdentityId -> Rep UnprocessedIdentityId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedIdentityId x -> UnprocessedIdentityId
$cfrom :: forall x. UnprocessedIdentityId -> Rep UnprocessedIdentityId x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedIdentityId' 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', 'unprocessedIdentityId_errorCode' - The error code indicating the type of error that occurred.
--
-- 'identityId', 'unprocessedIdentityId_identityId' - A unique identifier in the format REGION:GUID.
newUnprocessedIdentityId ::
  UnprocessedIdentityId
newUnprocessedIdentityId :: UnprocessedIdentityId
newUnprocessedIdentityId =
  UnprocessedIdentityId' :: Maybe CognitoErrorCode -> Maybe Text -> UnprocessedIdentityId
UnprocessedIdentityId'
    { $sel:errorCode:UnprocessedIdentityId' :: Maybe CognitoErrorCode
errorCode = Maybe CognitoErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:identityId:UnprocessedIdentityId' :: Maybe Text
identityId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code indicating the type of error that occurred.
unprocessedIdentityId_errorCode :: Lens.Lens' UnprocessedIdentityId (Prelude.Maybe CognitoErrorCode)
unprocessedIdentityId_errorCode :: (Maybe CognitoErrorCode -> f (Maybe CognitoErrorCode))
-> UnprocessedIdentityId -> f UnprocessedIdentityId
unprocessedIdentityId_errorCode = (UnprocessedIdentityId -> Maybe CognitoErrorCode)
-> (UnprocessedIdentityId
    -> Maybe CognitoErrorCode -> UnprocessedIdentityId)
-> Lens
     UnprocessedIdentityId
     UnprocessedIdentityId
     (Maybe CognitoErrorCode)
     (Maybe CognitoErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedIdentityId' {Maybe CognitoErrorCode
errorCode :: Maybe CognitoErrorCode
$sel:errorCode:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe CognitoErrorCode
errorCode} -> Maybe CognitoErrorCode
errorCode) (\s :: UnprocessedIdentityId
s@UnprocessedIdentityId' {} Maybe CognitoErrorCode
a -> UnprocessedIdentityId
s {$sel:errorCode:UnprocessedIdentityId' :: Maybe CognitoErrorCode
errorCode = Maybe CognitoErrorCode
a} :: UnprocessedIdentityId)

-- | A unique identifier in the format REGION:GUID.
unprocessedIdentityId_identityId :: Lens.Lens' UnprocessedIdentityId (Prelude.Maybe Prelude.Text)
unprocessedIdentityId_identityId :: (Maybe Text -> f (Maybe Text))
-> UnprocessedIdentityId -> f UnprocessedIdentityId
unprocessedIdentityId_identityId = (UnprocessedIdentityId -> Maybe Text)
-> (UnprocessedIdentityId -> Maybe Text -> UnprocessedIdentityId)
-> Lens
     UnprocessedIdentityId
     UnprocessedIdentityId
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedIdentityId' {Maybe Text
identityId :: Maybe Text
$sel:identityId:UnprocessedIdentityId' :: UnprocessedIdentityId -> Maybe Text
identityId} -> Maybe Text
identityId) (\s :: UnprocessedIdentityId
s@UnprocessedIdentityId' {} Maybe Text
a -> UnprocessedIdentityId
s {$sel:identityId:UnprocessedIdentityId' :: Maybe Text
identityId = Maybe Text
a} :: UnprocessedIdentityId)

instance Core.FromJSON UnprocessedIdentityId where
  parseJSON :: Value -> Parser UnprocessedIdentityId
parseJSON =
    String
-> (Object -> Parser UnprocessedIdentityId)
-> Value
-> Parser UnprocessedIdentityId
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UnprocessedIdentityId"
      ( \Object
x ->
          Maybe CognitoErrorCode -> Maybe Text -> UnprocessedIdentityId
UnprocessedIdentityId'
            (Maybe CognitoErrorCode -> Maybe Text -> UnprocessedIdentityId)
-> Parser (Maybe CognitoErrorCode)
-> Parser (Maybe Text -> UnprocessedIdentityId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CognitoErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
            Parser (Maybe Text -> UnprocessedIdentityId)
-> Parser (Maybe Text) -> Parser UnprocessedIdentityId
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
"IdentityId")
      )

instance Prelude.Hashable UnprocessedIdentityId

instance Prelude.NFData UnprocessedIdentityId