{-# 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.IoTEventsData.Types.BatchUpdateDetectorErrorEntry
-- 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.IoTEventsData.Types.BatchUpdateDetectorErrorEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTEventsData.Types.ErrorCode
import qualified Amazonka.Prelude as Prelude

-- | Information about the error that occurred when attempting to update a
-- detector.
--
-- /See:/ 'newBatchUpdateDetectorErrorEntry' smart constructor.
data BatchUpdateDetectorErrorEntry = BatchUpdateDetectorErrorEntry'
  { -- | The error code.
    BatchUpdateDetectorErrorEntry -> Maybe ErrorCode
errorCode :: Prelude.Maybe ErrorCode,
    -- | A message that describes the error.
    BatchUpdateDetectorErrorEntry -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The @\"messageId\"@ of the update request that caused the error. (The
    -- value of the @\"messageId\"@ in the update request @\"Detector\"@
    -- object.)
    BatchUpdateDetectorErrorEntry -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchUpdateDetectorErrorEntry
-> BatchUpdateDetectorErrorEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateDetectorErrorEntry
-> BatchUpdateDetectorErrorEntry -> Bool
$c/= :: BatchUpdateDetectorErrorEntry
-> BatchUpdateDetectorErrorEntry -> Bool
== :: BatchUpdateDetectorErrorEntry
-> BatchUpdateDetectorErrorEntry -> Bool
$c== :: BatchUpdateDetectorErrorEntry
-> BatchUpdateDetectorErrorEntry -> Bool
Prelude.Eq, ReadPrec [BatchUpdateDetectorErrorEntry]
ReadPrec BatchUpdateDetectorErrorEntry
Int -> ReadS BatchUpdateDetectorErrorEntry
ReadS [BatchUpdateDetectorErrorEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateDetectorErrorEntry]
$creadListPrec :: ReadPrec [BatchUpdateDetectorErrorEntry]
readPrec :: ReadPrec BatchUpdateDetectorErrorEntry
$creadPrec :: ReadPrec BatchUpdateDetectorErrorEntry
readList :: ReadS [BatchUpdateDetectorErrorEntry]
$creadList :: ReadS [BatchUpdateDetectorErrorEntry]
readsPrec :: Int -> ReadS BatchUpdateDetectorErrorEntry
$creadsPrec :: Int -> ReadS BatchUpdateDetectorErrorEntry
Prelude.Read, Int -> BatchUpdateDetectorErrorEntry -> ShowS
[BatchUpdateDetectorErrorEntry] -> ShowS
BatchUpdateDetectorErrorEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateDetectorErrorEntry] -> ShowS
$cshowList :: [BatchUpdateDetectorErrorEntry] -> ShowS
show :: BatchUpdateDetectorErrorEntry -> String
$cshow :: BatchUpdateDetectorErrorEntry -> String
showsPrec :: Int -> BatchUpdateDetectorErrorEntry -> ShowS
$cshowsPrec :: Int -> BatchUpdateDetectorErrorEntry -> ShowS
Prelude.Show, forall x.
Rep BatchUpdateDetectorErrorEntry x
-> BatchUpdateDetectorErrorEntry
forall x.
BatchUpdateDetectorErrorEntry
-> Rep BatchUpdateDetectorErrorEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdateDetectorErrorEntry x
-> BatchUpdateDetectorErrorEntry
$cfrom :: forall x.
BatchUpdateDetectorErrorEntry
-> Rep BatchUpdateDetectorErrorEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdateDetectorErrorEntry' 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:
--
-- 'errorCode', 'batchUpdateDetectorErrorEntry_errorCode' - The error code.
--
-- 'errorMessage', 'batchUpdateDetectorErrorEntry_errorMessage' - A message that describes the error.
--
-- 'messageId', 'batchUpdateDetectorErrorEntry_messageId' - The @\"messageId\"@ of the update request that caused the error. (The
-- value of the @\"messageId\"@ in the update request @\"Detector\"@
-- object.)
newBatchUpdateDetectorErrorEntry ::
  BatchUpdateDetectorErrorEntry
newBatchUpdateDetectorErrorEntry :: BatchUpdateDetectorErrorEntry
newBatchUpdateDetectorErrorEntry =
  BatchUpdateDetectorErrorEntry'
    { $sel:errorCode:BatchUpdateDetectorErrorEntry' :: Maybe ErrorCode
errorCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchUpdateDetectorErrorEntry' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:messageId:BatchUpdateDetectorErrorEntry' :: Maybe Text
messageId = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
batchUpdateDetectorErrorEntry_errorCode :: Lens.Lens' BatchUpdateDetectorErrorEntry (Prelude.Maybe ErrorCode)
batchUpdateDetectorErrorEntry_errorCode :: Lens' BatchUpdateDetectorErrorEntry (Maybe ErrorCode)
batchUpdateDetectorErrorEntry_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDetectorErrorEntry' {Maybe ErrorCode
errorCode :: Maybe ErrorCode
$sel:errorCode:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe ErrorCode
errorCode} -> Maybe ErrorCode
errorCode) (\s :: BatchUpdateDetectorErrorEntry
s@BatchUpdateDetectorErrorEntry' {} Maybe ErrorCode
a -> BatchUpdateDetectorErrorEntry
s {$sel:errorCode:BatchUpdateDetectorErrorEntry' :: Maybe ErrorCode
errorCode = Maybe ErrorCode
a} :: BatchUpdateDetectorErrorEntry)

-- | A message that describes the error.
batchUpdateDetectorErrorEntry_errorMessage :: Lens.Lens' BatchUpdateDetectorErrorEntry (Prelude.Maybe Prelude.Text)
batchUpdateDetectorErrorEntry_errorMessage :: Lens' BatchUpdateDetectorErrorEntry (Maybe Text)
batchUpdateDetectorErrorEntry_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDetectorErrorEntry' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: BatchUpdateDetectorErrorEntry
s@BatchUpdateDetectorErrorEntry' {} Maybe Text
a -> BatchUpdateDetectorErrorEntry
s {$sel:errorMessage:BatchUpdateDetectorErrorEntry' :: Maybe Text
errorMessage = Maybe Text
a} :: BatchUpdateDetectorErrorEntry)

-- | The @\"messageId\"@ of the update request that caused the error. (The
-- value of the @\"messageId\"@ in the update request @\"Detector\"@
-- object.)
batchUpdateDetectorErrorEntry_messageId :: Lens.Lens' BatchUpdateDetectorErrorEntry (Prelude.Maybe Prelude.Text)
batchUpdateDetectorErrorEntry_messageId :: Lens' BatchUpdateDetectorErrorEntry (Maybe Text)
batchUpdateDetectorErrorEntry_messageId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateDetectorErrorEntry' {Maybe Text
messageId :: Maybe Text
$sel:messageId:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: BatchUpdateDetectorErrorEntry
s@BatchUpdateDetectorErrorEntry' {} Maybe Text
a -> BatchUpdateDetectorErrorEntry
s {$sel:messageId:BatchUpdateDetectorErrorEntry' :: Maybe Text
messageId = Maybe Text
a} :: BatchUpdateDetectorErrorEntry)

instance Data.FromJSON BatchUpdateDetectorErrorEntry where
  parseJSON :: Value -> Parser BatchUpdateDetectorErrorEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BatchUpdateDetectorErrorEntry"
      ( \Object
x ->
          Maybe ErrorCode
-> Maybe Text -> Maybe Text -> BatchUpdateDetectorErrorEntry
BatchUpdateDetectorErrorEntry'
            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
"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")
            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
"messageId")
      )

instance
  Prelude.Hashable
    BatchUpdateDetectorErrorEntry
  where
  hashWithSalt :: Int -> BatchUpdateDetectorErrorEntry -> Int
hashWithSalt Int
_salt BatchUpdateDetectorErrorEntry' {Maybe Text
Maybe ErrorCode
messageId :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe ErrorCode
$sel:messageId:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe Text
$sel:errorMessage:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe Text
$sel:errorCode:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe ErrorCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorCode
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
messageId

instance Prelude.NFData BatchUpdateDetectorErrorEntry where
  rnf :: BatchUpdateDetectorErrorEntry -> ()
rnf BatchUpdateDetectorErrorEntry' {Maybe Text
Maybe ErrorCode
messageId :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe ErrorCode
$sel:messageId:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe Text
$sel:errorMessage:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe Text
$sel:errorCode:BatchUpdateDetectorErrorEntry' :: BatchUpdateDetectorErrorEntry -> Maybe ErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorCode
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
messageId