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

import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.ErrorCode
import qualified Amazonka.Lens as Lens
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
(BatchUpdateDetectorErrorEntry
 -> BatchUpdateDetectorErrorEntry -> Bool)
-> (BatchUpdateDetectorErrorEntry
    -> BatchUpdateDetectorErrorEntry -> Bool)
-> Eq BatchUpdateDetectorErrorEntry
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]
(Int -> ReadS BatchUpdateDetectorErrorEntry)
-> ReadS [BatchUpdateDetectorErrorEntry]
-> ReadPrec BatchUpdateDetectorErrorEntry
-> ReadPrec [BatchUpdateDetectorErrorEntry]
-> Read 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
(Int -> BatchUpdateDetectorErrorEntry -> ShowS)
-> (BatchUpdateDetectorErrorEntry -> String)
-> ([BatchUpdateDetectorErrorEntry] -> ShowS)
-> Show BatchUpdateDetectorErrorEntry
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.
 BatchUpdateDetectorErrorEntry
 -> Rep BatchUpdateDetectorErrorEntry x)
-> (forall x.
    Rep BatchUpdateDetectorErrorEntry x
    -> BatchUpdateDetectorErrorEntry)
-> Generic BatchUpdateDetectorErrorEntry
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' :: Maybe ErrorCode
-> Maybe Text -> Maybe Text -> BatchUpdateDetectorErrorEntry
BatchUpdateDetectorErrorEntry'
    { $sel:errorCode:BatchUpdateDetectorErrorEntry' :: Maybe ErrorCode
errorCode =
        Maybe ErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchUpdateDetectorErrorEntry' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:messageId:BatchUpdateDetectorErrorEntry' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
batchUpdateDetectorErrorEntry_errorCode :: Lens.Lens' BatchUpdateDetectorErrorEntry (Prelude.Maybe ErrorCode)
batchUpdateDetectorErrorEntry_errorCode :: (Maybe ErrorCode -> f (Maybe ErrorCode))
-> BatchUpdateDetectorErrorEntry -> f BatchUpdateDetectorErrorEntry
batchUpdateDetectorErrorEntry_errorCode = (BatchUpdateDetectorErrorEntry -> Maybe ErrorCode)
-> (BatchUpdateDetectorErrorEntry
    -> Maybe ErrorCode -> BatchUpdateDetectorErrorEntry)
-> Lens
     BatchUpdateDetectorErrorEntry
     BatchUpdateDetectorErrorEntry
     (Maybe ErrorCode)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> BatchUpdateDetectorErrorEntry -> f BatchUpdateDetectorErrorEntry
batchUpdateDetectorErrorEntry_errorMessage = (BatchUpdateDetectorErrorEntry -> Maybe Text)
-> (BatchUpdateDetectorErrorEntry
    -> Maybe Text -> BatchUpdateDetectorErrorEntry)
-> Lens
     BatchUpdateDetectorErrorEntry
     BatchUpdateDetectorErrorEntry
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> BatchUpdateDetectorErrorEntry -> f BatchUpdateDetectorErrorEntry
batchUpdateDetectorErrorEntry_messageId = (BatchUpdateDetectorErrorEntry -> Maybe Text)
-> (BatchUpdateDetectorErrorEntry
    -> Maybe Text -> BatchUpdateDetectorErrorEntry)
-> Lens
     BatchUpdateDetectorErrorEntry
     BatchUpdateDetectorErrorEntry
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON BatchUpdateDetectorErrorEntry where
  parseJSON :: Value -> Parser BatchUpdateDetectorErrorEntry
parseJSON =
    String
-> (Object -> Parser BatchUpdateDetectorErrorEntry)
-> Value
-> Parser BatchUpdateDetectorErrorEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchUpdateDetectorErrorEntry"
      ( \Object
x ->
          Maybe ErrorCode
-> Maybe Text -> Maybe Text -> BatchUpdateDetectorErrorEntry
BatchUpdateDetectorErrorEntry'
            (Maybe ErrorCode
 -> Maybe Text -> Maybe Text -> BatchUpdateDetectorErrorEntry)
-> Parser (Maybe ErrorCode)
-> Parser
     (Maybe Text -> Maybe Text -> BatchUpdateDetectorErrorEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"errorCode")
            Parser (Maybe Text -> Maybe Text -> BatchUpdateDetectorErrorEntry)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> BatchUpdateDetectorErrorEntry)
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")
            Parser (Maybe Text -> BatchUpdateDetectorErrorEntry)
-> Parser (Maybe Text) -> Parser BatchUpdateDetectorErrorEntry
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
"messageId")
      )

instance
  Prelude.Hashable
    BatchUpdateDetectorErrorEntry

instance Prelude.NFData BatchUpdateDetectorErrorEntry