{-# 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.BatchAlarmActionErrorEntry
-- 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.BatchAlarmActionErrorEntry 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

-- | Contains error messages associated with one of the following requests:
--
-- -   <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_BatchAcknowledgeAlarm.html BatchAcknowledgeAlarm>
--
-- -   <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_BatchDisableAlarm.html BatchDisableAlarm>
--
-- -   <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_BatchEnableAlarm.html BatchEnableAlarm>
--
-- -   <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_BatchResetAlarm.html BatchResetAlarm>
--
-- -   <https://docs.aws.amazon.com/iotevents/latest/apireference/API_iotevents-data_BatchSnoozeAlarm.html BatchSnoozeAlarm>
--
-- /See:/ 'newBatchAlarmActionErrorEntry' smart constructor.
data BatchAlarmActionErrorEntry = BatchAlarmActionErrorEntry'
  { -- | The error code.
    BatchAlarmActionErrorEntry -> Maybe ErrorCode
errorCode :: Prelude.Maybe ErrorCode,
    -- | A message that describes the error.
    BatchAlarmActionErrorEntry -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The request ID. Each ID must be unique within each batch.
    BatchAlarmActionErrorEntry -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool
$c/= :: BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool
== :: BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool
$c== :: BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool
Prelude.Eq, ReadPrec [BatchAlarmActionErrorEntry]
ReadPrec BatchAlarmActionErrorEntry
Int -> ReadS BatchAlarmActionErrorEntry
ReadS [BatchAlarmActionErrorEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchAlarmActionErrorEntry]
$creadListPrec :: ReadPrec [BatchAlarmActionErrorEntry]
readPrec :: ReadPrec BatchAlarmActionErrorEntry
$creadPrec :: ReadPrec BatchAlarmActionErrorEntry
readList :: ReadS [BatchAlarmActionErrorEntry]
$creadList :: ReadS [BatchAlarmActionErrorEntry]
readsPrec :: Int -> ReadS BatchAlarmActionErrorEntry
$creadsPrec :: Int -> ReadS BatchAlarmActionErrorEntry
Prelude.Read, Int -> BatchAlarmActionErrorEntry -> ShowS
[BatchAlarmActionErrorEntry] -> ShowS
BatchAlarmActionErrorEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchAlarmActionErrorEntry] -> ShowS
$cshowList :: [BatchAlarmActionErrorEntry] -> ShowS
show :: BatchAlarmActionErrorEntry -> String
$cshow :: BatchAlarmActionErrorEntry -> String
showsPrec :: Int -> BatchAlarmActionErrorEntry -> ShowS
$cshowsPrec :: Int -> BatchAlarmActionErrorEntry -> ShowS
Prelude.Show, forall x.
Rep BatchAlarmActionErrorEntry x -> BatchAlarmActionErrorEntry
forall x.
BatchAlarmActionErrorEntry -> Rep BatchAlarmActionErrorEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchAlarmActionErrorEntry x -> BatchAlarmActionErrorEntry
$cfrom :: forall x.
BatchAlarmActionErrorEntry -> Rep BatchAlarmActionErrorEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchAlarmActionErrorEntry' 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', 'batchAlarmActionErrorEntry_errorCode' - The error code.
--
-- 'errorMessage', 'batchAlarmActionErrorEntry_errorMessage' - A message that describes the error.
--
-- 'requestId', 'batchAlarmActionErrorEntry_requestId' - The request ID. Each ID must be unique within each batch.
newBatchAlarmActionErrorEntry ::
  BatchAlarmActionErrorEntry
newBatchAlarmActionErrorEntry :: BatchAlarmActionErrorEntry
newBatchAlarmActionErrorEntry =
  BatchAlarmActionErrorEntry'
    { $sel:errorCode:BatchAlarmActionErrorEntry' :: Maybe ErrorCode
errorCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchAlarmActionErrorEntry' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:BatchAlarmActionErrorEntry' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The request ID. Each ID must be unique within each batch.
batchAlarmActionErrorEntry_requestId :: Lens.Lens' BatchAlarmActionErrorEntry (Prelude.Maybe Prelude.Text)
batchAlarmActionErrorEntry_requestId :: Lens' BatchAlarmActionErrorEntry (Maybe Text)
batchAlarmActionErrorEntry_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchAlarmActionErrorEntry' {Maybe Text
requestId :: Maybe Text
$sel:requestId:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: BatchAlarmActionErrorEntry
s@BatchAlarmActionErrorEntry' {} Maybe Text
a -> BatchAlarmActionErrorEntry
s {$sel:requestId:BatchAlarmActionErrorEntry' :: Maybe Text
requestId = Maybe Text
a} :: BatchAlarmActionErrorEntry)

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

instance Prelude.Hashable BatchAlarmActionErrorEntry where
  hashWithSalt :: Int -> BatchAlarmActionErrorEntry -> Int
hashWithSalt Int
_salt BatchAlarmActionErrorEntry' {Maybe Text
Maybe ErrorCode
requestId :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe ErrorCode
$sel:requestId:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> Maybe Text
$sel:errorMessage:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> Maybe Text
$sel:errorCode:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> 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
requestId

instance Prelude.NFData BatchAlarmActionErrorEntry where
  rnf :: BatchAlarmActionErrorEntry -> ()
rnf BatchAlarmActionErrorEntry' {Maybe Text
Maybe ErrorCode
requestId :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe ErrorCode
$sel:requestId:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> Maybe Text
$sel:errorMessage:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> Maybe Text
$sel:errorCode:BatchAlarmActionErrorEntry' :: BatchAlarmActionErrorEntry -> 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
requestId