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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(BatchGetCommitsError -> BatchGetCommitsError -> Bool)
-> (BatchGetCommitsError -> BatchGetCommitsError -> Bool)
-> Eq BatchGetCommitsError
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]
(Int -> ReadS BatchGetCommitsError)
-> ReadS [BatchGetCommitsError]
-> ReadPrec BatchGetCommitsError
-> ReadPrec [BatchGetCommitsError]
-> Read 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
(Int -> BatchGetCommitsError -> ShowS)
-> (BatchGetCommitsError -> String)
-> ([BatchGetCommitsError] -> ShowS)
-> Show BatchGetCommitsError
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. BatchGetCommitsError -> Rep BatchGetCommitsError x)
-> (forall x. Rep BatchGetCommitsError x -> BatchGetCommitsError)
-> Generic BatchGetCommitsError
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' :: Maybe Text -> Maybe Text -> Maybe Text -> BatchGetCommitsError
BatchGetCommitsError'
    { $sel:commitId:BatchGetCommitsError' :: Maybe Text
commitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:BatchGetCommitsError' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchGetCommitsError' :: Maybe Text
errorMessage = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> BatchGetCommitsError -> f BatchGetCommitsError
batchGetCommitsError_commitId = (BatchGetCommitsError -> Maybe Text)
-> (BatchGetCommitsError -> Maybe Text -> BatchGetCommitsError)
-> Lens
     BatchGetCommitsError BatchGetCommitsError (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> BatchGetCommitsError -> f BatchGetCommitsError
batchGetCommitsError_errorCode = (BatchGetCommitsError -> Maybe Text)
-> (BatchGetCommitsError -> Maybe Text -> BatchGetCommitsError)
-> Lens
     BatchGetCommitsError BatchGetCommitsError (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> BatchGetCommitsError -> f BatchGetCommitsError
batchGetCommitsError_errorMessage = (BatchGetCommitsError -> Maybe Text)
-> (BatchGetCommitsError -> Maybe Text -> BatchGetCommitsError)
-> Lens
     BatchGetCommitsError BatchGetCommitsError (Maybe Text) (Maybe Text)
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 Core.FromJSON BatchGetCommitsError where
  parseJSON :: Value -> Parser BatchGetCommitsError
parseJSON =
    String
-> (Object -> Parser BatchGetCommitsError)
-> Value
-> Parser BatchGetCommitsError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchGetCommitsError"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> BatchGetCommitsError
BatchGetCommitsError'
            (Maybe Text -> Maybe Text -> Maybe Text -> BatchGetCommitsError)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> BatchGetCommitsError)
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
"commitId")
            Parser (Maybe Text -> Maybe Text -> BatchGetCommitsError)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> BatchGetCommitsError)
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 -> BatchGetCommitsError)
-> Parser (Maybe Text) -> Parser BatchGetCommitsError
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 BatchGetCommitsError

instance Prelude.NFData BatchGetCommitsError