{-# 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.AuditManager.Types.BatchCreateDelegationByAssessmentError
-- 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.AuditManager.Types.BatchCreateDelegationByAssessmentError where

import Amazonka.AuditManager.Types.CreateDelegationRequest
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

-- | An error entity for the @BatchCreateDelegationByAssessment@ API. This is
-- used to provide more meaningful errors than a simple string message.
--
-- /See:/ 'newBatchCreateDelegationByAssessmentError' smart constructor.
data BatchCreateDelegationByAssessmentError = BatchCreateDelegationByAssessmentError'
  { -- | The API request to batch create delegations in Audit Manager.
    BatchCreateDelegationByAssessmentError
-> Maybe CreateDelegationRequest
createDelegationRequest :: Prelude.Maybe CreateDelegationRequest,
    -- | The error code that the @BatchCreateDelegationByAssessment@ API
    -- returned.
    BatchCreateDelegationByAssessmentError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message that the @BatchCreateDelegationByAssessment@ API
    -- returned.
    BatchCreateDelegationByAssessmentError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchCreateDelegationByAssessmentError
-> BatchCreateDelegationByAssessmentError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateDelegationByAssessmentError
-> BatchCreateDelegationByAssessmentError -> Bool
$c/= :: BatchCreateDelegationByAssessmentError
-> BatchCreateDelegationByAssessmentError -> Bool
== :: BatchCreateDelegationByAssessmentError
-> BatchCreateDelegationByAssessmentError -> Bool
$c== :: BatchCreateDelegationByAssessmentError
-> BatchCreateDelegationByAssessmentError -> Bool
Prelude.Eq, ReadPrec [BatchCreateDelegationByAssessmentError]
ReadPrec BatchCreateDelegationByAssessmentError
Int -> ReadS BatchCreateDelegationByAssessmentError
ReadS [BatchCreateDelegationByAssessmentError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateDelegationByAssessmentError]
$creadListPrec :: ReadPrec [BatchCreateDelegationByAssessmentError]
readPrec :: ReadPrec BatchCreateDelegationByAssessmentError
$creadPrec :: ReadPrec BatchCreateDelegationByAssessmentError
readList :: ReadS [BatchCreateDelegationByAssessmentError]
$creadList :: ReadS [BatchCreateDelegationByAssessmentError]
readsPrec :: Int -> ReadS BatchCreateDelegationByAssessmentError
$creadsPrec :: Int -> ReadS BatchCreateDelegationByAssessmentError
Prelude.Read, Int -> BatchCreateDelegationByAssessmentError -> ShowS
[BatchCreateDelegationByAssessmentError] -> ShowS
BatchCreateDelegationByAssessmentError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateDelegationByAssessmentError] -> ShowS
$cshowList :: [BatchCreateDelegationByAssessmentError] -> ShowS
show :: BatchCreateDelegationByAssessmentError -> String
$cshow :: BatchCreateDelegationByAssessmentError -> String
showsPrec :: Int -> BatchCreateDelegationByAssessmentError -> ShowS
$cshowsPrec :: Int -> BatchCreateDelegationByAssessmentError -> ShowS
Prelude.Show, forall x.
Rep BatchCreateDelegationByAssessmentError x
-> BatchCreateDelegationByAssessmentError
forall x.
BatchCreateDelegationByAssessmentError
-> Rep BatchCreateDelegationByAssessmentError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateDelegationByAssessmentError x
-> BatchCreateDelegationByAssessmentError
$cfrom :: forall x.
BatchCreateDelegationByAssessmentError
-> Rep BatchCreateDelegationByAssessmentError x
Prelude.Generic)

-- |
-- Create a value of 'BatchCreateDelegationByAssessmentError' 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:
--
-- 'createDelegationRequest', 'batchCreateDelegationByAssessmentError_createDelegationRequest' - The API request to batch create delegations in Audit Manager.
--
-- 'errorCode', 'batchCreateDelegationByAssessmentError_errorCode' - The error code that the @BatchCreateDelegationByAssessment@ API
-- returned.
--
-- 'errorMessage', 'batchCreateDelegationByAssessmentError_errorMessage' - The error message that the @BatchCreateDelegationByAssessment@ API
-- returned.
newBatchCreateDelegationByAssessmentError ::
  BatchCreateDelegationByAssessmentError
newBatchCreateDelegationByAssessmentError :: BatchCreateDelegationByAssessmentError
newBatchCreateDelegationByAssessmentError =
  BatchCreateDelegationByAssessmentError'
    { $sel:createDelegationRequest:BatchCreateDelegationByAssessmentError' :: Maybe CreateDelegationRequest
createDelegationRequest =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:BatchCreateDelegationByAssessmentError' :: Maybe Text
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchCreateDelegationByAssessmentError' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The API request to batch create delegations in Audit Manager.
batchCreateDelegationByAssessmentError_createDelegationRequest :: Lens.Lens' BatchCreateDelegationByAssessmentError (Prelude.Maybe CreateDelegationRequest)
batchCreateDelegationByAssessmentError_createDelegationRequest :: Lens'
  BatchCreateDelegationByAssessmentError
  (Maybe CreateDelegationRequest)
batchCreateDelegationByAssessmentError_createDelegationRequest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateDelegationByAssessmentError' {Maybe CreateDelegationRequest
createDelegationRequest :: Maybe CreateDelegationRequest
$sel:createDelegationRequest:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError
-> Maybe CreateDelegationRequest
createDelegationRequest} -> Maybe CreateDelegationRequest
createDelegationRequest) (\s :: BatchCreateDelegationByAssessmentError
s@BatchCreateDelegationByAssessmentError' {} Maybe CreateDelegationRequest
a -> BatchCreateDelegationByAssessmentError
s {$sel:createDelegationRequest:BatchCreateDelegationByAssessmentError' :: Maybe CreateDelegationRequest
createDelegationRequest = Maybe CreateDelegationRequest
a} :: BatchCreateDelegationByAssessmentError)

-- | The error code that the @BatchCreateDelegationByAssessment@ API
-- returned.
batchCreateDelegationByAssessmentError_errorCode :: Lens.Lens' BatchCreateDelegationByAssessmentError (Prelude.Maybe Prelude.Text)
batchCreateDelegationByAssessmentError_errorCode :: Lens' BatchCreateDelegationByAssessmentError (Maybe Text)
batchCreateDelegationByAssessmentError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateDelegationByAssessmentError' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: BatchCreateDelegationByAssessmentError
s@BatchCreateDelegationByAssessmentError' {} Maybe Text
a -> BatchCreateDelegationByAssessmentError
s {$sel:errorCode:BatchCreateDelegationByAssessmentError' :: Maybe Text
errorCode = Maybe Text
a} :: BatchCreateDelegationByAssessmentError)

-- | The error message that the @BatchCreateDelegationByAssessment@ API
-- returned.
batchCreateDelegationByAssessmentError_errorMessage :: Lens.Lens' BatchCreateDelegationByAssessmentError (Prelude.Maybe Prelude.Text)
batchCreateDelegationByAssessmentError_errorMessage :: Lens' BatchCreateDelegationByAssessmentError (Maybe Text)
batchCreateDelegationByAssessmentError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateDelegationByAssessmentError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: BatchCreateDelegationByAssessmentError
s@BatchCreateDelegationByAssessmentError' {} Maybe Text
a -> BatchCreateDelegationByAssessmentError
s {$sel:errorMessage:BatchCreateDelegationByAssessmentError' :: Maybe Text
errorMessage = Maybe Text
a} :: BatchCreateDelegationByAssessmentError)

instance
  Data.FromJSON
    BatchCreateDelegationByAssessmentError
  where
  parseJSON :: Value -> Parser BatchCreateDelegationByAssessmentError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchCreateDelegationByAssessmentError"
      ( \Object
x ->
          Maybe CreateDelegationRequest
-> Maybe Text
-> Maybe Text
-> BatchCreateDelegationByAssessmentError
BatchCreateDelegationByAssessmentError'
            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
"createDelegationRequest")
            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
"errorCode")
            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
    BatchCreateDelegationByAssessmentError
  where
  hashWithSalt :: Int -> BatchCreateDelegationByAssessmentError -> Int
hashWithSalt
    Int
_salt
    BatchCreateDelegationByAssessmentError' {Maybe Text
Maybe CreateDelegationRequest
errorMessage :: Maybe Text
errorCode :: Maybe Text
createDelegationRequest :: Maybe CreateDelegationRequest
$sel:errorMessage:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError -> Maybe Text
$sel:errorCode:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError -> Maybe Text
$sel:createDelegationRequest:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError
-> Maybe CreateDelegationRequest
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateDelegationRequest
createDelegationRequest
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorCode
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage

instance
  Prelude.NFData
    BatchCreateDelegationByAssessmentError
  where
  rnf :: BatchCreateDelegationByAssessmentError -> ()
rnf BatchCreateDelegationByAssessmentError' {Maybe Text
Maybe CreateDelegationRequest
errorMessage :: Maybe Text
errorCode :: Maybe Text
createDelegationRequest :: Maybe CreateDelegationRequest
$sel:errorMessage:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError -> Maybe Text
$sel:errorCode:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError -> Maybe Text
$sel:createDelegationRequest:BatchCreateDelegationByAssessmentError' :: BatchCreateDelegationByAssessmentError
-> Maybe CreateDelegationRequest
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateDelegationRequest
createDelegationRequest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage