{-# 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.BatchUpdateFindingsUnprocessedFinding
-- 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.BatchUpdateFindingsUnprocessedFinding where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsSecurityFindingIdentifier

-- | A finding from a @BatchUpdateFindings@ request that Security Hub was
-- unable to update.
--
-- /See:/ 'newBatchUpdateFindingsUnprocessedFinding' smart constructor.
data BatchUpdateFindingsUnprocessedFinding = BatchUpdateFindingsUnprocessedFinding'
  { -- | The identifier of the finding that was not updated.
    BatchUpdateFindingsUnprocessedFinding
-> AwsSecurityFindingIdentifier
findingIdentifier :: AwsSecurityFindingIdentifier,
    -- | The code associated with the error.
    BatchUpdateFindingsUnprocessedFinding -> Text
errorCode :: Prelude.Text,
    -- | The message associated with the error.
    BatchUpdateFindingsUnprocessedFinding -> Text
errorMessage :: Prelude.Text
  }
  deriving (BatchUpdateFindingsUnprocessedFinding
-> BatchUpdateFindingsUnprocessedFinding -> Bool
(BatchUpdateFindingsUnprocessedFinding
 -> BatchUpdateFindingsUnprocessedFinding -> Bool)
-> (BatchUpdateFindingsUnprocessedFinding
    -> BatchUpdateFindingsUnprocessedFinding -> Bool)
-> Eq BatchUpdateFindingsUnprocessedFinding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateFindingsUnprocessedFinding
-> BatchUpdateFindingsUnprocessedFinding -> Bool
$c/= :: BatchUpdateFindingsUnprocessedFinding
-> BatchUpdateFindingsUnprocessedFinding -> Bool
== :: BatchUpdateFindingsUnprocessedFinding
-> BatchUpdateFindingsUnprocessedFinding -> Bool
$c== :: BatchUpdateFindingsUnprocessedFinding
-> BatchUpdateFindingsUnprocessedFinding -> Bool
Prelude.Eq, ReadPrec [BatchUpdateFindingsUnprocessedFinding]
ReadPrec BatchUpdateFindingsUnprocessedFinding
Int -> ReadS BatchUpdateFindingsUnprocessedFinding
ReadS [BatchUpdateFindingsUnprocessedFinding]
(Int -> ReadS BatchUpdateFindingsUnprocessedFinding)
-> ReadS [BatchUpdateFindingsUnprocessedFinding]
-> ReadPrec BatchUpdateFindingsUnprocessedFinding
-> ReadPrec [BatchUpdateFindingsUnprocessedFinding]
-> Read BatchUpdateFindingsUnprocessedFinding
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateFindingsUnprocessedFinding]
$creadListPrec :: ReadPrec [BatchUpdateFindingsUnprocessedFinding]
readPrec :: ReadPrec BatchUpdateFindingsUnprocessedFinding
$creadPrec :: ReadPrec BatchUpdateFindingsUnprocessedFinding
readList :: ReadS [BatchUpdateFindingsUnprocessedFinding]
$creadList :: ReadS [BatchUpdateFindingsUnprocessedFinding]
readsPrec :: Int -> ReadS BatchUpdateFindingsUnprocessedFinding
$creadsPrec :: Int -> ReadS BatchUpdateFindingsUnprocessedFinding
Prelude.Read, Int -> BatchUpdateFindingsUnprocessedFinding -> ShowS
[BatchUpdateFindingsUnprocessedFinding] -> ShowS
BatchUpdateFindingsUnprocessedFinding -> String
(Int -> BatchUpdateFindingsUnprocessedFinding -> ShowS)
-> (BatchUpdateFindingsUnprocessedFinding -> String)
-> ([BatchUpdateFindingsUnprocessedFinding] -> ShowS)
-> Show BatchUpdateFindingsUnprocessedFinding
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateFindingsUnprocessedFinding] -> ShowS
$cshowList :: [BatchUpdateFindingsUnprocessedFinding] -> ShowS
show :: BatchUpdateFindingsUnprocessedFinding -> String
$cshow :: BatchUpdateFindingsUnprocessedFinding -> String
showsPrec :: Int -> BatchUpdateFindingsUnprocessedFinding -> ShowS
$cshowsPrec :: Int -> BatchUpdateFindingsUnprocessedFinding -> ShowS
Prelude.Show, (forall x.
 BatchUpdateFindingsUnprocessedFinding
 -> Rep BatchUpdateFindingsUnprocessedFinding x)
-> (forall x.
    Rep BatchUpdateFindingsUnprocessedFinding x
    -> BatchUpdateFindingsUnprocessedFinding)
-> Generic BatchUpdateFindingsUnprocessedFinding
forall x.
Rep BatchUpdateFindingsUnprocessedFinding x
-> BatchUpdateFindingsUnprocessedFinding
forall x.
BatchUpdateFindingsUnprocessedFinding
-> Rep BatchUpdateFindingsUnprocessedFinding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateFindingsUnprocessedFinding x
-> BatchUpdateFindingsUnprocessedFinding
$cfrom :: forall x.
BatchUpdateFindingsUnprocessedFinding
-> Rep BatchUpdateFindingsUnprocessedFinding x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdateFindingsUnprocessedFinding' 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:
--
-- 'findingIdentifier', 'batchUpdateFindingsUnprocessedFinding_findingIdentifier' - The identifier of the finding that was not updated.
--
-- 'errorCode', 'batchUpdateFindingsUnprocessedFinding_errorCode' - The code associated with the error.
--
-- 'errorMessage', 'batchUpdateFindingsUnprocessedFinding_errorMessage' - The message associated with the error.
newBatchUpdateFindingsUnprocessedFinding ::
  -- | 'findingIdentifier'
  AwsSecurityFindingIdentifier ->
  -- | 'errorCode'
  Prelude.Text ->
  -- | 'errorMessage'
  Prelude.Text ->
  BatchUpdateFindingsUnprocessedFinding
newBatchUpdateFindingsUnprocessedFinding :: AwsSecurityFindingIdentifier
-> Text -> Text -> BatchUpdateFindingsUnprocessedFinding
newBatchUpdateFindingsUnprocessedFinding
  AwsSecurityFindingIdentifier
pFindingIdentifier_
  Text
pErrorCode_
  Text
pErrorMessage_ =
    BatchUpdateFindingsUnprocessedFinding' :: AwsSecurityFindingIdentifier
-> Text -> Text -> BatchUpdateFindingsUnprocessedFinding
BatchUpdateFindingsUnprocessedFinding'
      { $sel:findingIdentifier:BatchUpdateFindingsUnprocessedFinding' :: AwsSecurityFindingIdentifier
findingIdentifier =
          AwsSecurityFindingIdentifier
pFindingIdentifier_,
        $sel:errorCode:BatchUpdateFindingsUnprocessedFinding' :: Text
errorCode = Text
pErrorCode_,
        $sel:errorMessage:BatchUpdateFindingsUnprocessedFinding' :: Text
errorMessage = Text
pErrorMessage_
      }

-- | The identifier of the finding that was not updated.
batchUpdateFindingsUnprocessedFinding_findingIdentifier :: Lens.Lens' BatchUpdateFindingsUnprocessedFinding AwsSecurityFindingIdentifier
batchUpdateFindingsUnprocessedFinding_findingIdentifier :: (AwsSecurityFindingIdentifier -> f AwsSecurityFindingIdentifier)
-> BatchUpdateFindingsUnprocessedFinding
-> f BatchUpdateFindingsUnprocessedFinding
batchUpdateFindingsUnprocessedFinding_findingIdentifier = (BatchUpdateFindingsUnprocessedFinding
 -> AwsSecurityFindingIdentifier)
-> (BatchUpdateFindingsUnprocessedFinding
    -> AwsSecurityFindingIdentifier
    -> BatchUpdateFindingsUnprocessedFinding)
-> Lens
     BatchUpdateFindingsUnprocessedFinding
     BatchUpdateFindingsUnprocessedFinding
     AwsSecurityFindingIdentifier
     AwsSecurityFindingIdentifier
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateFindingsUnprocessedFinding' {AwsSecurityFindingIdentifier
findingIdentifier :: AwsSecurityFindingIdentifier
$sel:findingIdentifier:BatchUpdateFindingsUnprocessedFinding' :: BatchUpdateFindingsUnprocessedFinding
-> AwsSecurityFindingIdentifier
findingIdentifier} -> AwsSecurityFindingIdentifier
findingIdentifier) (\s :: BatchUpdateFindingsUnprocessedFinding
s@BatchUpdateFindingsUnprocessedFinding' {} AwsSecurityFindingIdentifier
a -> BatchUpdateFindingsUnprocessedFinding
s {$sel:findingIdentifier:BatchUpdateFindingsUnprocessedFinding' :: AwsSecurityFindingIdentifier
findingIdentifier = AwsSecurityFindingIdentifier
a} :: BatchUpdateFindingsUnprocessedFinding)

-- | The code associated with the error.
batchUpdateFindingsUnprocessedFinding_errorCode :: Lens.Lens' BatchUpdateFindingsUnprocessedFinding Prelude.Text
batchUpdateFindingsUnprocessedFinding_errorCode :: (Text -> f Text)
-> BatchUpdateFindingsUnprocessedFinding
-> f BatchUpdateFindingsUnprocessedFinding
batchUpdateFindingsUnprocessedFinding_errorCode = (BatchUpdateFindingsUnprocessedFinding -> Text)
-> (BatchUpdateFindingsUnprocessedFinding
    -> Text -> BatchUpdateFindingsUnprocessedFinding)
-> Lens
     BatchUpdateFindingsUnprocessedFinding
     BatchUpdateFindingsUnprocessedFinding
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateFindingsUnprocessedFinding' {Text
errorCode :: Text
$sel:errorCode:BatchUpdateFindingsUnprocessedFinding' :: BatchUpdateFindingsUnprocessedFinding -> Text
errorCode} -> Text
errorCode) (\s :: BatchUpdateFindingsUnprocessedFinding
s@BatchUpdateFindingsUnprocessedFinding' {} Text
a -> BatchUpdateFindingsUnprocessedFinding
s {$sel:errorCode:BatchUpdateFindingsUnprocessedFinding' :: Text
errorCode = Text
a} :: BatchUpdateFindingsUnprocessedFinding)

-- | The message associated with the error.
batchUpdateFindingsUnprocessedFinding_errorMessage :: Lens.Lens' BatchUpdateFindingsUnprocessedFinding Prelude.Text
batchUpdateFindingsUnprocessedFinding_errorMessage :: (Text -> f Text)
-> BatchUpdateFindingsUnprocessedFinding
-> f BatchUpdateFindingsUnprocessedFinding
batchUpdateFindingsUnprocessedFinding_errorMessage = (BatchUpdateFindingsUnprocessedFinding -> Text)
-> (BatchUpdateFindingsUnprocessedFinding
    -> Text -> BatchUpdateFindingsUnprocessedFinding)
-> Lens
     BatchUpdateFindingsUnprocessedFinding
     BatchUpdateFindingsUnprocessedFinding
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateFindingsUnprocessedFinding' {Text
errorMessage :: Text
$sel:errorMessage:BatchUpdateFindingsUnprocessedFinding' :: BatchUpdateFindingsUnprocessedFinding -> Text
errorMessage} -> Text
errorMessage) (\s :: BatchUpdateFindingsUnprocessedFinding
s@BatchUpdateFindingsUnprocessedFinding' {} Text
a -> BatchUpdateFindingsUnprocessedFinding
s {$sel:errorMessage:BatchUpdateFindingsUnprocessedFinding' :: Text
errorMessage = Text
a} :: BatchUpdateFindingsUnprocessedFinding)

instance
  Core.FromJSON
    BatchUpdateFindingsUnprocessedFinding
  where
  parseJSON :: Value -> Parser BatchUpdateFindingsUnprocessedFinding
parseJSON =
    String
-> (Object -> Parser BatchUpdateFindingsUnprocessedFinding)
-> Value
-> Parser BatchUpdateFindingsUnprocessedFinding
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchUpdateFindingsUnprocessedFinding"
      ( \Object
x ->
          AwsSecurityFindingIdentifier
-> Text -> Text -> BatchUpdateFindingsUnprocessedFinding
BatchUpdateFindingsUnprocessedFinding'
            (AwsSecurityFindingIdentifier
 -> Text -> Text -> BatchUpdateFindingsUnprocessedFinding)
-> Parser AwsSecurityFindingIdentifier
-> Parser (Text -> Text -> BatchUpdateFindingsUnprocessedFinding)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser AwsSecurityFindingIdentifier
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FindingIdentifier")
            Parser (Text -> Text -> BatchUpdateFindingsUnprocessedFinding)
-> Parser Text
-> Parser (Text -> BatchUpdateFindingsUnprocessedFinding)
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 -> BatchUpdateFindingsUnprocessedFinding)
-> Parser Text -> Parser BatchUpdateFindingsUnprocessedFinding
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
    BatchUpdateFindingsUnprocessedFinding

instance
  Prelude.NFData
    BatchUpdateFindingsUnprocessedFinding