{-# 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.SecurityHub.Types.ImportFindingsError
-- 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.SecurityHub.Types.ImportFindingsError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The list of the findings that cannot be imported. For each finding, the
-- list provides the error.
--
-- /See:/ 'newImportFindingsError' smart constructor.
data ImportFindingsError = ImportFindingsError'
  { -- | The identifier of the finding that could not be updated.
    ImportFindingsError -> Text
id :: Prelude.Text,
    -- | The code of the error returned by the @BatchImportFindings@ operation.
    ImportFindingsError -> Text
errorCode :: Prelude.Text,
    -- | The message of the error returned by the @BatchImportFindings@
    -- operation.
    ImportFindingsError -> Text
errorMessage :: Prelude.Text
  }
  deriving (ImportFindingsError -> ImportFindingsError -> Bool
(ImportFindingsError -> ImportFindingsError -> Bool)
-> (ImportFindingsError -> ImportFindingsError -> Bool)
-> Eq ImportFindingsError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportFindingsError -> ImportFindingsError -> Bool
$c/= :: ImportFindingsError -> ImportFindingsError -> Bool
== :: ImportFindingsError -> ImportFindingsError -> Bool
$c== :: ImportFindingsError -> ImportFindingsError -> Bool
Prelude.Eq, ReadPrec [ImportFindingsError]
ReadPrec ImportFindingsError
Int -> ReadS ImportFindingsError
ReadS [ImportFindingsError]
(Int -> ReadS ImportFindingsError)
-> ReadS [ImportFindingsError]
-> ReadPrec ImportFindingsError
-> ReadPrec [ImportFindingsError]
-> Read ImportFindingsError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportFindingsError]
$creadListPrec :: ReadPrec [ImportFindingsError]
readPrec :: ReadPrec ImportFindingsError
$creadPrec :: ReadPrec ImportFindingsError
readList :: ReadS [ImportFindingsError]
$creadList :: ReadS [ImportFindingsError]
readsPrec :: Int -> ReadS ImportFindingsError
$creadsPrec :: Int -> ReadS ImportFindingsError
Prelude.Read, Int -> ImportFindingsError -> ShowS
[ImportFindingsError] -> ShowS
ImportFindingsError -> String
(Int -> ImportFindingsError -> ShowS)
-> (ImportFindingsError -> String)
-> ([ImportFindingsError] -> ShowS)
-> Show ImportFindingsError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportFindingsError] -> ShowS
$cshowList :: [ImportFindingsError] -> ShowS
show :: ImportFindingsError -> String
$cshow :: ImportFindingsError -> String
showsPrec :: Int -> ImportFindingsError -> ShowS
$cshowsPrec :: Int -> ImportFindingsError -> ShowS
Prelude.Show, (forall x. ImportFindingsError -> Rep ImportFindingsError x)
-> (forall x. Rep ImportFindingsError x -> ImportFindingsError)
-> Generic ImportFindingsError
forall x. Rep ImportFindingsError x -> ImportFindingsError
forall x. ImportFindingsError -> Rep ImportFindingsError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportFindingsError x -> ImportFindingsError
$cfrom :: forall x. ImportFindingsError -> Rep ImportFindingsError x
Prelude.Generic)

-- |
-- Create a value of 'ImportFindingsError' 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:
--
-- 'id', 'importFindingsError_id' - The identifier of the finding that could not be updated.
--
-- 'errorCode', 'importFindingsError_errorCode' - The code of the error returned by the @BatchImportFindings@ operation.
--
-- 'errorMessage', 'importFindingsError_errorMessage' - The message of the error returned by the @BatchImportFindings@
-- operation.
newImportFindingsError ::
  -- | 'id'
  Prelude.Text ->
  -- | 'errorCode'
  Prelude.Text ->
  -- | 'errorMessage'
  Prelude.Text ->
  ImportFindingsError
newImportFindingsError :: Text -> Text -> Text -> ImportFindingsError
newImportFindingsError
  Text
pId_
  Text
pErrorCode_
  Text
pErrorMessage_ =
    ImportFindingsError' :: Text -> Text -> Text -> ImportFindingsError
ImportFindingsError'
      { $sel:id:ImportFindingsError' :: Text
id = Text
pId_,
        $sel:errorCode:ImportFindingsError' :: Text
errorCode = Text
pErrorCode_,
        $sel:errorMessage:ImportFindingsError' :: Text
errorMessage = Text
pErrorMessage_
      }

-- | The identifier of the finding that could not be updated.
importFindingsError_id :: Lens.Lens' ImportFindingsError Prelude.Text
importFindingsError_id :: (Text -> f Text) -> ImportFindingsError -> f ImportFindingsError
importFindingsError_id = (ImportFindingsError -> Text)
-> (ImportFindingsError -> Text -> ImportFindingsError)
-> Lens ImportFindingsError ImportFindingsError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportFindingsError' {Text
id :: Text
$sel:id:ImportFindingsError' :: ImportFindingsError -> Text
id} -> Text
id) (\s :: ImportFindingsError
s@ImportFindingsError' {} Text
a -> ImportFindingsError
s {$sel:id:ImportFindingsError' :: Text
id = Text
a} :: ImportFindingsError)

-- | The code of the error returned by the @BatchImportFindings@ operation.
importFindingsError_errorCode :: Lens.Lens' ImportFindingsError Prelude.Text
importFindingsError_errorCode :: (Text -> f Text) -> ImportFindingsError -> f ImportFindingsError
importFindingsError_errorCode = (ImportFindingsError -> Text)
-> (ImportFindingsError -> Text -> ImportFindingsError)
-> Lens ImportFindingsError ImportFindingsError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportFindingsError' {Text
errorCode :: Text
$sel:errorCode:ImportFindingsError' :: ImportFindingsError -> Text
errorCode} -> Text
errorCode) (\s :: ImportFindingsError
s@ImportFindingsError' {} Text
a -> ImportFindingsError
s {$sel:errorCode:ImportFindingsError' :: Text
errorCode = Text
a} :: ImportFindingsError)

-- | The message of the error returned by the @BatchImportFindings@
-- operation.
importFindingsError_errorMessage :: Lens.Lens' ImportFindingsError Prelude.Text
importFindingsError_errorMessage :: (Text -> f Text) -> ImportFindingsError -> f ImportFindingsError
importFindingsError_errorMessage = (ImportFindingsError -> Text)
-> (ImportFindingsError -> Text -> ImportFindingsError)
-> Lens ImportFindingsError ImportFindingsError Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportFindingsError' {Text
errorMessage :: Text
$sel:errorMessage:ImportFindingsError' :: ImportFindingsError -> Text
errorMessage} -> Text
errorMessage) (\s :: ImportFindingsError
s@ImportFindingsError' {} Text
a -> ImportFindingsError
s {$sel:errorMessage:ImportFindingsError' :: Text
errorMessage = Text
a} :: ImportFindingsError)

instance Core.FromJSON ImportFindingsError where
  parseJSON :: Value -> Parser ImportFindingsError
parseJSON =
    String
-> (Object -> Parser ImportFindingsError)
-> Value
-> Parser ImportFindingsError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImportFindingsError"
      ( \Object
x ->
          Text -> Text -> Text -> ImportFindingsError
ImportFindingsError'
            (Text -> Text -> Text -> ImportFindingsError)
-> Parser Text -> Parser (Text -> Text -> ImportFindingsError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
            Parser (Text -> Text -> ImportFindingsError)
-> Parser Text -> Parser (Text -> ImportFindingsError)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ErrorCode")
            Parser (Text -> ImportFindingsError)
-> Parser Text -> Parser ImportFindingsError
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ErrorMessage")
      )

instance Prelude.Hashable ImportFindingsError

instance Prelude.NFData ImportFindingsError