{-# 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.MacieV2.Types.UnprocessedAccount
-- 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.MacieV2.Types.UnprocessedAccount where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.ErrorCode
import qualified Amazonka.Prelude as Prelude

-- | Provides information about an account-related request that hasn\'t been
-- processed.
--
-- /See:/ 'newUnprocessedAccount' smart constructor.
data UnprocessedAccount = UnprocessedAccount'
  { -- | The Amazon Web Services account ID for the account that the request
    -- applies to.
    UnprocessedAccount -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The source of the issue or delay in processing the request.
    UnprocessedAccount -> Maybe ErrorCode
errorCode :: Prelude.Maybe ErrorCode,
    -- | The reason why the request hasn\'t been processed.
    UnprocessedAccount -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (UnprocessedAccount -> UnprocessedAccount -> Bool
(UnprocessedAccount -> UnprocessedAccount -> Bool)
-> (UnprocessedAccount -> UnprocessedAccount -> Bool)
-> Eq UnprocessedAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnprocessedAccount -> UnprocessedAccount -> Bool
$c/= :: UnprocessedAccount -> UnprocessedAccount -> Bool
== :: UnprocessedAccount -> UnprocessedAccount -> Bool
$c== :: UnprocessedAccount -> UnprocessedAccount -> Bool
Prelude.Eq, ReadPrec [UnprocessedAccount]
ReadPrec UnprocessedAccount
Int -> ReadS UnprocessedAccount
ReadS [UnprocessedAccount]
(Int -> ReadS UnprocessedAccount)
-> ReadS [UnprocessedAccount]
-> ReadPrec UnprocessedAccount
-> ReadPrec [UnprocessedAccount]
-> Read UnprocessedAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnprocessedAccount]
$creadListPrec :: ReadPrec [UnprocessedAccount]
readPrec :: ReadPrec UnprocessedAccount
$creadPrec :: ReadPrec UnprocessedAccount
readList :: ReadS [UnprocessedAccount]
$creadList :: ReadS [UnprocessedAccount]
readsPrec :: Int -> ReadS UnprocessedAccount
$creadsPrec :: Int -> ReadS UnprocessedAccount
Prelude.Read, Int -> UnprocessedAccount -> ShowS
[UnprocessedAccount] -> ShowS
UnprocessedAccount -> String
(Int -> UnprocessedAccount -> ShowS)
-> (UnprocessedAccount -> String)
-> ([UnprocessedAccount] -> ShowS)
-> Show UnprocessedAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnprocessedAccount] -> ShowS
$cshowList :: [UnprocessedAccount] -> ShowS
show :: UnprocessedAccount -> String
$cshow :: UnprocessedAccount -> String
showsPrec :: Int -> UnprocessedAccount -> ShowS
$cshowsPrec :: Int -> UnprocessedAccount -> ShowS
Prelude.Show, (forall x. UnprocessedAccount -> Rep UnprocessedAccount x)
-> (forall x. Rep UnprocessedAccount x -> UnprocessedAccount)
-> Generic UnprocessedAccount
forall x. Rep UnprocessedAccount x -> UnprocessedAccount
forall x. UnprocessedAccount -> Rep UnprocessedAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnprocessedAccount x -> UnprocessedAccount
$cfrom :: forall x. UnprocessedAccount -> Rep UnprocessedAccount x
Prelude.Generic)

-- |
-- Create a value of 'UnprocessedAccount' 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:
--
-- 'accountId', 'unprocessedAccount_accountId' - The Amazon Web Services account ID for the account that the request
-- applies to.
--
-- 'errorCode', 'unprocessedAccount_errorCode' - The source of the issue or delay in processing the request.
--
-- 'errorMessage', 'unprocessedAccount_errorMessage' - The reason why the request hasn\'t been processed.
newUnprocessedAccount ::
  UnprocessedAccount
newUnprocessedAccount :: UnprocessedAccount
newUnprocessedAccount =
  UnprocessedAccount' :: Maybe Text -> Maybe ErrorCode -> Maybe Text -> UnprocessedAccount
UnprocessedAccount'
    { $sel:accountId:UnprocessedAccount' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:UnprocessedAccount' :: Maybe ErrorCode
errorCode = Maybe ErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:UnprocessedAccount' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID for the account that the request
-- applies to.
unprocessedAccount_accountId :: Lens.Lens' UnprocessedAccount (Prelude.Maybe Prelude.Text)
unprocessedAccount_accountId :: (Maybe Text -> f (Maybe Text))
-> UnprocessedAccount -> f UnprocessedAccount
unprocessedAccount_accountId = (UnprocessedAccount -> Maybe Text)
-> (UnprocessedAccount -> Maybe Text -> UnprocessedAccount)
-> Lens
     UnprocessedAccount UnprocessedAccount (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedAccount' {Maybe Text
accountId :: Maybe Text
$sel:accountId:UnprocessedAccount' :: UnprocessedAccount -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: UnprocessedAccount
s@UnprocessedAccount' {} Maybe Text
a -> UnprocessedAccount
s {$sel:accountId:UnprocessedAccount' :: Maybe Text
accountId = Maybe Text
a} :: UnprocessedAccount)

-- | The source of the issue or delay in processing the request.
unprocessedAccount_errorCode :: Lens.Lens' UnprocessedAccount (Prelude.Maybe ErrorCode)
unprocessedAccount_errorCode :: (Maybe ErrorCode -> f (Maybe ErrorCode))
-> UnprocessedAccount -> f UnprocessedAccount
unprocessedAccount_errorCode = (UnprocessedAccount -> Maybe ErrorCode)
-> (UnprocessedAccount -> Maybe ErrorCode -> UnprocessedAccount)
-> Lens
     UnprocessedAccount
     UnprocessedAccount
     (Maybe ErrorCode)
     (Maybe ErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedAccount' {Maybe ErrorCode
errorCode :: Maybe ErrorCode
$sel:errorCode:UnprocessedAccount' :: UnprocessedAccount -> Maybe ErrorCode
errorCode} -> Maybe ErrorCode
errorCode) (\s :: UnprocessedAccount
s@UnprocessedAccount' {} Maybe ErrorCode
a -> UnprocessedAccount
s {$sel:errorCode:UnprocessedAccount' :: Maybe ErrorCode
errorCode = Maybe ErrorCode
a} :: UnprocessedAccount)

-- | The reason why the request hasn\'t been processed.
unprocessedAccount_errorMessage :: Lens.Lens' UnprocessedAccount (Prelude.Maybe Prelude.Text)
unprocessedAccount_errorMessage :: (Maybe Text -> f (Maybe Text))
-> UnprocessedAccount -> f UnprocessedAccount
unprocessedAccount_errorMessage = (UnprocessedAccount -> Maybe Text)
-> (UnprocessedAccount -> Maybe Text -> UnprocessedAccount)
-> Lens
     UnprocessedAccount UnprocessedAccount (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnprocessedAccount' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:UnprocessedAccount' :: UnprocessedAccount -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: UnprocessedAccount
s@UnprocessedAccount' {} Maybe Text
a -> UnprocessedAccount
s {$sel:errorMessage:UnprocessedAccount' :: Maybe Text
errorMessage = Maybe Text
a} :: UnprocessedAccount)

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

instance Prelude.Hashable UnprocessedAccount

instance Prelude.NFData UnprocessedAccount