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

import Amazonka.AuditManager.Types.CreateDelegationRequest
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 returned by the @BatchCreateDelegationByAssessment@ API.
    BatchCreateDelegationByAssessmentError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message returned by the @BatchCreateDelegationByAssessment@
    -- API.
    BatchCreateDelegationByAssessmentError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchCreateDelegationByAssessmentError
-> BatchCreateDelegationByAssessmentError -> Bool
(BatchCreateDelegationByAssessmentError
 -> BatchCreateDelegationByAssessmentError -> Bool)
-> (BatchCreateDelegationByAssessmentError
    -> BatchCreateDelegationByAssessmentError -> Bool)
-> Eq BatchCreateDelegationByAssessmentError
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]
(Int -> ReadS BatchCreateDelegationByAssessmentError)
-> ReadS [BatchCreateDelegationByAssessmentError]
-> ReadPrec BatchCreateDelegationByAssessmentError
-> ReadPrec [BatchCreateDelegationByAssessmentError]
-> Read 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
(Int -> BatchCreateDelegationByAssessmentError -> ShowS)
-> (BatchCreateDelegationByAssessmentError -> String)
-> ([BatchCreateDelegationByAssessmentError] -> ShowS)
-> Show BatchCreateDelegationByAssessmentError
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.
 BatchCreateDelegationByAssessmentError
 -> Rep BatchCreateDelegationByAssessmentError x)
-> (forall x.
    Rep BatchCreateDelegationByAssessmentError x
    -> BatchCreateDelegationByAssessmentError)
-> Generic BatchCreateDelegationByAssessmentError
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 returned by the @BatchCreateDelegationByAssessment@ API.
--
-- 'errorMessage', 'batchCreateDelegationByAssessmentError_errorMessage' - The error message returned by the @BatchCreateDelegationByAssessment@
-- API.
newBatchCreateDelegationByAssessmentError ::
  BatchCreateDelegationByAssessmentError
newBatchCreateDelegationByAssessmentError :: BatchCreateDelegationByAssessmentError
newBatchCreateDelegationByAssessmentError =
  BatchCreateDelegationByAssessmentError' :: Maybe CreateDelegationRequest
-> Maybe Text
-> Maybe Text
-> BatchCreateDelegationByAssessmentError
BatchCreateDelegationByAssessmentError'
    { $sel:createDelegationRequest:BatchCreateDelegationByAssessmentError' :: Maybe CreateDelegationRequest
createDelegationRequest =
        Maybe CreateDelegationRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:BatchCreateDelegationByAssessmentError' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchCreateDelegationByAssessmentError' :: Maybe Text
errorMessage = Maybe Text
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 :: (Maybe CreateDelegationRequest
 -> f (Maybe CreateDelegationRequest))
-> BatchCreateDelegationByAssessmentError
-> f BatchCreateDelegationByAssessmentError
batchCreateDelegationByAssessmentError_createDelegationRequest = (BatchCreateDelegationByAssessmentError
 -> Maybe CreateDelegationRequest)
-> (BatchCreateDelegationByAssessmentError
    -> Maybe CreateDelegationRequest
    -> BatchCreateDelegationByAssessmentError)
-> Lens
     BatchCreateDelegationByAssessmentError
     BatchCreateDelegationByAssessmentError
     (Maybe CreateDelegationRequest)
     (Maybe 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 returned by the @BatchCreateDelegationByAssessment@ API.
batchCreateDelegationByAssessmentError_errorCode :: Lens.Lens' BatchCreateDelegationByAssessmentError (Prelude.Maybe Prelude.Text)
batchCreateDelegationByAssessmentError_errorCode :: (Maybe Text -> f (Maybe Text))
-> BatchCreateDelegationByAssessmentError
-> f BatchCreateDelegationByAssessmentError
batchCreateDelegationByAssessmentError_errorCode = (BatchCreateDelegationByAssessmentError -> Maybe Text)
-> (BatchCreateDelegationByAssessmentError
    -> Maybe Text -> BatchCreateDelegationByAssessmentError)
-> Lens
     BatchCreateDelegationByAssessmentError
     BatchCreateDelegationByAssessmentError
     (Maybe Text)
     (Maybe Text)
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 returned by the @BatchCreateDelegationByAssessment@
-- API.
batchCreateDelegationByAssessmentError_errorMessage :: Lens.Lens' BatchCreateDelegationByAssessmentError (Prelude.Maybe Prelude.Text)
batchCreateDelegationByAssessmentError_errorMessage :: (Maybe Text -> f (Maybe Text))
-> BatchCreateDelegationByAssessmentError
-> f BatchCreateDelegationByAssessmentError
batchCreateDelegationByAssessmentError_errorMessage = (BatchCreateDelegationByAssessmentError -> Maybe Text)
-> (BatchCreateDelegationByAssessmentError
    -> Maybe Text -> BatchCreateDelegationByAssessmentError)
-> Lens
     BatchCreateDelegationByAssessmentError
     BatchCreateDelegationByAssessmentError
     (Maybe Text)
     (Maybe Text)
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
  Core.FromJSON
    BatchCreateDelegationByAssessmentError
  where
  parseJSON :: Value -> Parser BatchCreateDelegationByAssessmentError
parseJSON =
    String
-> (Object -> Parser BatchCreateDelegationByAssessmentError)
-> Value
-> Parser BatchCreateDelegationByAssessmentError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchCreateDelegationByAssessmentError"
      ( \Object
x ->
          Maybe CreateDelegationRequest
-> Maybe Text
-> Maybe Text
-> BatchCreateDelegationByAssessmentError
BatchCreateDelegationByAssessmentError'
            (Maybe CreateDelegationRequest
 -> Maybe Text
 -> Maybe Text
 -> BatchCreateDelegationByAssessmentError)
-> Parser (Maybe CreateDelegationRequest)
-> Parser
     (Maybe Text
      -> Maybe Text -> BatchCreateDelegationByAssessmentError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CreateDelegationRequest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createDelegationRequest")
            Parser
  (Maybe Text
   -> Maybe Text -> BatchCreateDelegationByAssessmentError)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> BatchCreateDelegationByAssessmentError)
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
"errorCode")
            Parser (Maybe Text -> BatchCreateDelegationByAssessmentError)
-> Parser (Maybe Text)
-> Parser BatchCreateDelegationByAssessmentError
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
    BatchCreateDelegationByAssessmentError

instance
  Prelude.NFData
    BatchCreateDelegationByAssessmentError