{-# 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.CodeCommit.Types.BatchGetCommitsError
-- 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.CodeCommit.Types.BatchGetCommitsError where

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

-- | Returns information about errors in a BatchGetCommits operation.
--
-- /See:/ 'newBatchGetCommitsError' smart constructor.
data BatchGetCommitsError = BatchGetCommitsError'
  { -- | A commit ID that either could not be found or was not in a valid format.
    BatchGetCommitsError -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
    -- | An error code that specifies whether the commit ID was not valid or not
    -- found.
    BatchGetCommitsError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | An error message that provides detail about why the commit ID either was
    -- not found or was not valid.
    BatchGetCommitsError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchGetCommitsError -> BatchGetCommitsError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetCommitsError -> BatchGetCommitsError -> Bool
$c/= :: BatchGetCommitsError -> BatchGetCommitsError -> Bool
== :: BatchGetCommitsError -> BatchGetCommitsError -> Bool
$c== :: BatchGetCommitsError -> BatchGetCommitsError -> Bool
Prelude.Eq, ReadPrec [BatchGetCommitsError]
ReadPrec BatchGetCommitsError
Int -> ReadS BatchGetCommitsError
ReadS [BatchGetCommitsError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetCommitsError]
$creadListPrec :: ReadPrec [BatchGetCommitsError]
readPrec :: ReadPrec BatchGetCommitsError
$creadPrec :: ReadPrec BatchGetCommitsError
readList :: ReadS [BatchGetCommitsError]
$creadList :: ReadS [BatchGetCommitsError]
readsPrec :: Int -> ReadS BatchGetCommitsError
$creadsPrec :: Int -> ReadS BatchGetCommitsError
Prelude.Read, Int -> BatchGetCommitsError -> ShowS
[BatchGetCommitsError] -> ShowS
BatchGetCommitsError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetCommitsError] -> ShowS
$cshowList :: [BatchGetCommitsError] -> ShowS
show :: BatchGetCommitsError -> String
$cshow :: BatchGetCommitsError -> String
showsPrec :: Int -> BatchGetCommitsError -> ShowS
$cshowsPrec :: Int -> BatchGetCommitsError -> ShowS
Prelude.Show, forall x. Rep BatchGetCommitsError x -> BatchGetCommitsError
forall x. BatchGetCommitsError -> Rep BatchGetCommitsError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetCommitsError x -> BatchGetCommitsError
$cfrom :: forall x. BatchGetCommitsError -> Rep BatchGetCommitsError x
Prelude.Generic)

-- |
-- Create a value of 'BatchGetCommitsError' 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:
--
-- 'commitId', 'batchGetCommitsError_commitId' - A commit ID that either could not be found or was not in a valid format.
--
-- 'errorCode', 'batchGetCommitsError_errorCode' - An error code that specifies whether the commit ID was not valid or not
-- found.
--
-- 'errorMessage', 'batchGetCommitsError_errorMessage' - An error message that provides detail about why the commit ID either was
-- not found or was not valid.
newBatchGetCommitsError ::
  BatchGetCommitsError
newBatchGetCommitsError :: BatchGetCommitsError
newBatchGetCommitsError =
  BatchGetCommitsError'
    { $sel:commitId:BatchGetCommitsError' :: Maybe Text
commitId = forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:BatchGetCommitsError' :: Maybe Text
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchGetCommitsError' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | A commit ID that either could not be found or was not in a valid format.
batchGetCommitsError_commitId :: Lens.Lens' BatchGetCommitsError (Prelude.Maybe Prelude.Text)
batchGetCommitsError_commitId :: Lens' BatchGetCommitsError (Maybe Text)
batchGetCommitsError_commitId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCommitsError' {Maybe Text
commitId :: Maybe Text
$sel:commitId:BatchGetCommitsError' :: BatchGetCommitsError -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: BatchGetCommitsError
s@BatchGetCommitsError' {} Maybe Text
a -> BatchGetCommitsError
s {$sel:commitId:BatchGetCommitsError' :: Maybe Text
commitId = Maybe Text
a} :: BatchGetCommitsError)

-- | An error code that specifies whether the commit ID was not valid or not
-- found.
batchGetCommitsError_errorCode :: Lens.Lens' BatchGetCommitsError (Prelude.Maybe Prelude.Text)
batchGetCommitsError_errorCode :: Lens' BatchGetCommitsError (Maybe Text)
batchGetCommitsError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCommitsError' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:BatchGetCommitsError' :: BatchGetCommitsError -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: BatchGetCommitsError
s@BatchGetCommitsError' {} Maybe Text
a -> BatchGetCommitsError
s {$sel:errorCode:BatchGetCommitsError' :: Maybe Text
errorCode = Maybe Text
a} :: BatchGetCommitsError)

-- | An error message that provides detail about why the commit ID either was
-- not found or was not valid.
batchGetCommitsError_errorMessage :: Lens.Lens' BatchGetCommitsError (Prelude.Maybe Prelude.Text)
batchGetCommitsError_errorMessage :: Lens' BatchGetCommitsError (Maybe Text)
batchGetCommitsError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetCommitsError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:BatchGetCommitsError' :: BatchGetCommitsError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: BatchGetCommitsError
s@BatchGetCommitsError' {} Maybe Text
a -> BatchGetCommitsError
s {$sel:errorMessage:BatchGetCommitsError' :: Maybe Text
errorMessage = Maybe Text
a} :: BatchGetCommitsError)

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