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

import qualified Amazonka.Core as Core
import Amazonka.IoTEventsData.Types.ErrorCode
import qualified Amazonka.Lens as Lens
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 request ID. Each ID must be unique within each batch.
    BatchAlarmActionErrorEntry -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The error code.
    BatchAlarmActionErrorEntry -> Maybe ErrorCode
errorCode :: Prelude.Maybe ErrorCode,
    -- | A message that describes the error.
    BatchAlarmActionErrorEntry -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool
(BatchAlarmActionErrorEntry -> BatchAlarmActionErrorEntry -> Bool)
-> (BatchAlarmActionErrorEntry
    -> BatchAlarmActionErrorEntry -> Bool)
-> Eq BatchAlarmActionErrorEntry
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]
(Int -> ReadS BatchAlarmActionErrorEntry)
-> ReadS [BatchAlarmActionErrorEntry]
-> ReadPrec BatchAlarmActionErrorEntry
-> ReadPrec [BatchAlarmActionErrorEntry]
-> Read 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
(Int -> BatchAlarmActionErrorEntry -> ShowS)
-> (BatchAlarmActionErrorEntry -> String)
-> ([BatchAlarmActionErrorEntry] -> ShowS)
-> Show BatchAlarmActionErrorEntry
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.
 BatchAlarmActionErrorEntry -> Rep BatchAlarmActionErrorEntry x)
-> (forall x.
    Rep BatchAlarmActionErrorEntry x -> BatchAlarmActionErrorEntry)
-> Generic BatchAlarmActionErrorEntry
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:
--
-- 'requestId', 'batchAlarmActionErrorEntry_requestId' - The request ID. Each ID must be unique within each batch.
--
-- 'errorCode', 'batchAlarmActionErrorEntry_errorCode' - The error code.
--
-- 'errorMessage', 'batchAlarmActionErrorEntry_errorMessage' - A message that describes the error.
newBatchAlarmActionErrorEntry ::
  BatchAlarmActionErrorEntry
newBatchAlarmActionErrorEntry :: BatchAlarmActionErrorEntry
newBatchAlarmActionErrorEntry =
  BatchAlarmActionErrorEntry' :: Maybe Text
-> Maybe ErrorCode -> Maybe Text -> BatchAlarmActionErrorEntry
BatchAlarmActionErrorEntry'
    { $sel:requestId:BatchAlarmActionErrorEntry' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:BatchAlarmActionErrorEntry' :: Maybe ErrorCode
errorCode = Maybe ErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchAlarmActionErrorEntry' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The request ID. Each ID must be unique within each batch.
batchAlarmActionErrorEntry_requestId :: Lens.Lens' BatchAlarmActionErrorEntry (Prelude.Maybe Prelude.Text)
batchAlarmActionErrorEntry_requestId :: (Maybe Text -> f (Maybe Text))
-> BatchAlarmActionErrorEntry -> f BatchAlarmActionErrorEntry
batchAlarmActionErrorEntry_requestId = (BatchAlarmActionErrorEntry -> Maybe Text)
-> (BatchAlarmActionErrorEntry
    -> Maybe Text -> BatchAlarmActionErrorEntry)
-> Lens
     BatchAlarmActionErrorEntry
     BatchAlarmActionErrorEntry
     (Maybe Text)
     (Maybe Text)
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)

-- | The error code.
batchAlarmActionErrorEntry_errorCode :: Lens.Lens' BatchAlarmActionErrorEntry (Prelude.Maybe ErrorCode)
batchAlarmActionErrorEntry_errorCode :: (Maybe ErrorCode -> f (Maybe ErrorCode))
-> BatchAlarmActionErrorEntry -> f BatchAlarmActionErrorEntry
batchAlarmActionErrorEntry_errorCode = (BatchAlarmActionErrorEntry -> Maybe ErrorCode)
-> (BatchAlarmActionErrorEntry
    -> Maybe ErrorCode -> BatchAlarmActionErrorEntry)
-> Lens
     BatchAlarmActionErrorEntry
     BatchAlarmActionErrorEntry
     (Maybe ErrorCode)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> BatchAlarmActionErrorEntry -> f BatchAlarmActionErrorEntry
batchAlarmActionErrorEntry_errorMessage = (BatchAlarmActionErrorEntry -> Maybe Text)
-> (BatchAlarmActionErrorEntry
    -> Maybe Text -> BatchAlarmActionErrorEntry)
-> Lens
     BatchAlarmActionErrorEntry
     BatchAlarmActionErrorEntry
     (Maybe Text)
     (Maybe Text)
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)

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

instance Prelude.Hashable BatchAlarmActionErrorEntry

instance Prelude.NFData BatchAlarmActionErrorEntry